Dataset Viewer
Auto-converted to Parquet Duplicate
prefix
stringclasses
1 value
input_text
stringlengths
19
27.3k
target_text
stringlengths
2
24.8k
QA
how can find the full path to font from its display name on mac am using the photoshop javascript api to find the fonts in given psd given font name returned by the api want to find the actual physical font file that that font name corresponds to on the disc this is all happening in python program running on osx so gue...
open up terminal applications utilities terminal and type this in locate insertfonthere this will spit out every file that has the name you want warning there may be alot to wade through
QA
how can find the full path to font from its display name on mac am using the photoshop javascript api to find the fonts in given psd given font name returned by the api want to find the actual physical font file that that font name corresponds to on the disc this is all happening in python program running on osx so gue...
have not been able to find anything that does this directly think you will have to iterate through the various font folders on the system system library fonts library fonts and there can probably be user level directory as well library fonts
QA
get preview jpeg of pdf on windows have cross platform python application which needs to generate jpeg preview of the first page of pdf on the mac am spawning sips is there something similarly simple can do on windows
you can use imagemagick convert utility for this see some examples in http studio imagemagick org pipermail magick users may html convert taxes pdf taxes jpg will convert two page pdf file into jpeg files taxes jpg taxes jpg can also convert these jpegs to thumbnail as follows convert size taxes jpg geometry profile th...
QA
continuous integration system for python codebase am starting work on hobby project with python codebase and would like to set up some form of continuous integration running battery of test cases each time check in is made and sending nag mails to responsible persons when the tests fail similar to cruisecontrol or team...
one possibility is hudson it is written in java but there is integration with python projects hudson embraces python have never tried it myself however update sept after trademark dispute hudson has been renamed to jenkins
QA
continuous integration system for python codebase am starting work on hobby project with python codebase and would like to set up some form of continuous integration running battery of test cases each time check in is made and sending nag mails to responsible persons when the tests fail similar to cruisecontrol or team...
we run buildbot trac at work have not used it too much since my code base is not part of the release cycle yet but we run the tests on different environments osx linux win and it sends emails and it is written in python
QA
cx oracle how do iterate over result set there are several ways to iterate over result set what are the tradeoff of each
the canonical way is to use the built in cursor iterator curs execute select from people for row in curs print row you can use fetchall to get all rows at once for row in curs fetchall print row it can be convenient to use this to create python list containing the values returned curs execute select first name from peo...
QA
continuous integration system for python codebase am starting work on hobby project with python codebase and would like to set up some form of continuous integration running battery of test cases each time check in is made and sending nag mails to responsible persons when the tests fail similar to cruisecontrol or team...
second the buildbot trac integration you can find more information about the integration on the buildbot website at my previous job we wrote and used the plugin they mention tracbb what the plugin does is rewriting all of the buildbot urls so you can use buildbot from within trac http example com tracbb the really nice...
QA
using in to match an attribute of python objects in an array do not remember whether was dreaming or not but seem to recall there being function which allowed something like foo in iter attr array of python objects attribute name have looked over the docs but this kind of thing does not fall under any obvious listed he...
no you were not dreaming python has pretty excellent list comprehension system that let us you manipulate lists pretty elegantly and depending on exactly what you want to accomplish this can be done couple of ways in essence what you are doing is saying for item in list if criteria matches and from that you can just it...
QA
using in to match an attribute of python objects in an array do not remember whether was dreaming or not but seem to recall there being function which allowed something like foo in iter attr array of python objects attribute name have looked over the docs but this kind of thing does not fall under any obvious listed he...
are you looking to get list of objects that have certain attribute if so list comprehension is the right way to do this result obj for obj in listofobjs if hasattr obj attributename
QA
using in to match an attribute of python objects in an array do not remember whether was dreaming or not but seem to recall there being function which allowed something like foo in iter attr array of python objects attribute name have looked over the docs but this kind of thing does not fall under any obvious listed he...
what was thinking of can be achieved using list comprehensions but thought that there was function that did this in slightly neater way bar is list of objects all of which have the attribute id the mythical functional way foo foo in iter attr bar id the list comprehension way foo foo in obj id for obj in bar in retrosp...
QA
class views in django django view points to function which can be problem if you want to change only bit of functionality yes could have million keyword arguments and even more if statements in the function but was thinking more of an object oriented approach for example have page that displays user this page is very s...
sounds to me like you are trying to combine things that should not be combined if you need to do different processing in your view depending on if it is user or group object you are trying to look at then you should use two different view functions on the other hand there can be common idioms you would want to extract ...
QA
python and mysql can get python to work with postgresql but cannot get it to work with mysql the main problem is that on the shared hosting account have do not have the ability to install things such as django or pysql generally fail when installing them on my computer so maybe it is good cannot install on the host fou...
do not have any experience with http www siteground com as web host personally this is just guess but it is common for shared host to support python and mysql with the mysqldb module godaddy does this try the following cgi script to see if mysqldb is installed usr bin pythonmodule name mysqldb head content type text ht...
QA
how do use python itertools groupby have not been able to find an understandable explanation of how to actually use python itertools groupby function what am trying to do is this take list in this case the children of an objectified lxml element divide it into groups based on some criteria then later iterate over each ...
can you show us your code the example on the python docs is quite straightforward groups uniquekeys for in groupby data keyfunc groups append list store group iterator as list uniquekeys append so in your case data is list of nodes keyfunc is where the logic of your criteria function goes and then groupby groups the da...
QA
python and mysql can get python to work with postgresql but cannot get it to work with mysql the main problem is that on the shared hosting account have do not have the ability to install things such as django or pysql generally fail when installing them on my computer so maybe it is good cannot install on the host fou...
uploaded it and got an internal error premature end of script headers after much playing around found that if had import cgiimport cgitb cgitb enable import mysqldb it would give me much more useful answer and say that it was not installed you can see it yourself http woarl com db py oddly enough this would produce an ...
QA
adding method to an existing object instance have read that it is possible to add method to an existing object not in the class definition in python think this is called monkey patching or in some cases duck punching understand that it is not always good decision to do so but how might one do this update est that looks...
in python monkey patching generally works by overwriting class or functions signature with your own below is an example from the zope wiki from someotherproduct somemodule import someclassdef speak self return ook ook eee eee eee someclass speak speak that code will overwrite create method called speak on the class in ...
QA
how do you express binary literals in python how do you express an integer as binary number with python literals was easily able to find the answer for hex af and octal how do you use literals to express binary in python summary of answers python and earlier can express binary using int but not with literal python and ...
print int print int another way
QA
python and mysql can get python to work with postgresql but cannot get it to work with mysql the main problem is that on the shared hosting account have do not have the ability to install things such as django or pysql generally fail when installing them on my computer so maybe it is good cannot install on the host fou...
mysqldb is what have used before if you host is using python version or higher support for sqlite databases is built in sqlite allows you to have relational database that is simply file in your filesystem but buyer beware sqlite is not suited for production so it may depend what you are trying to do with it another opt...
QA
any experiences with protocol buffers was just looking through some information about google protocol buffers data interchange format has anyone played around with the code or even created project around it am currently using xml in python project for structured content created by hand in text editor and was wondering ...
if you are looking for user facing interaction stick with xml it has more support understanding and general acceptance currently if it is internal would say that protocol buffers are great idea maybe in few years as more tools come out to support protocol buffers then start looking towards that for public facing api un...
QA
how do make menu that does not require the user to press enter to make selection have got menu in python that part was easy am using raw input to get the selection from the user the problem is that raw input and input require the user to press enter after they make selection is there any way to make the program act imm...
on linux set raw mode select and read the keystroke restore normal settings import sys import select import termios import tty def getkey old settings termios tcgetattr sys stdin tty setraw sys stdin fileno select select sys stdin answer sys stdin read termios tcsetattr sys stdin termios tcsadrain old settings return a...
QA
how do make menu that does not require the user to press enter to make selection have got menu in python that part was easy am using raw input to get the selection from the user the problem is that raw input and input require the user to press enter after they make selection is there any way to make the program act imm...
on windows import msvcrt answer msvcrt getch
QA
how to check what os am running on in python what do need to look at to see if am on windows unix etc
import os print os name posix import platform platform system linux platform release generic see platform access to underlying platform identifying data
QA
how do make menu that does not require the user to press enter to make selection have got menu in python that part was easy am using raw input to get the selection from the user the problem is that raw input and input require the user to press enter after they make selection is there any way to make the program act imm...
wow that took forever ok here is what have ended up with python python exeimport msvcrtprint menu say foo say bar while char msvcrt getch if char chr escape break if char print foo break if char print bar break it fails hard using idle the python thing that comes with python but once tried it in dos er cmd exe as real ...
QA
how to check what os am running on in python what do need to look at to see if am on windows unix etc
dang lbrandy beat me to the punch but that does not mean cannot provide you with the system results for vista import os os name nt import platform platform system windows platform release vista
QA
how to check what os am running on in python what do need to look at to see if am on windows unix etc
for the record here is the results on mac import os os name posix import platform platform system darwin platform release
QA
how do make menu that does not require the user to press enter to make selection have got menu in python that part was easy am using raw input to get the selection from the user the problem is that raw input and input require the user to press enter after they make selection is there any way to make the program act imm...
the reason msvcrt fails in idle is because idle is not accessing the library that runs msvcrt whereas when you run the program natively in cmd exe it works nicely for the same reason that your program blows up on mac and linux terminals but guess if you are going to be using this specifically for windows more power to ...
QA
python what is the difference between and and when should use each in many places and can be used interchangeably when should use one or the other and why
the list is dynamic and flexible but that flexibility comes at speed cost the tuple is fixed immutable and therefore faster
QA
python what is the difference between and and when should use each in many places and can be used interchangeably when should use one or the other and why
from the python faq lists and tuples while similar in many respects are generally used in fundamentally different ways tuples can be thought of as being similar to pascal records or structs they are small collections of related data which may be of different types which are operated on as group for example cartesian co...
QA
file size differences after copying file to server ftp have created php script to update webserver that is live inside local directory am migrating the script into python it works fine for the most part but after put command the size of the file appears to change thus the size of the file is different from that of the ...
do you need to open the locfile in binary using rb open locfile rb
QA
file size differences after copying file to server ftp have created php script to update webserver that is live inside local directory am migrating the script into python it works fine for the most part but after put command the size of the file appears to change thus the size of the file is different from that of the ...
well if you go under the properties of your file in windows or nix environment you will notice two sizes one is the sector size and one is the actual size the sector size is the number of sectors in bytes that are used up on your hard disk that is because two files cannot be in the same sector with most modern file sys...
QA
file size differences after copying file to server ftp have created php script to update webserver that is live inside local directory am migrating the script into python it works fine for the most part but after put command the size of the file appears to change thus the size of the file is different from that of the ...
small files take up whole node on the filesystem whatever size that is my host tends to report all small files as kb in ftp but in she will gives an accurate size so it might be feature common to ftp clients
QA
how can create directly executable cross platform gui app using python python works on multiple platforms and can be used for desktop and web applications thus conclude that there is some way to compile it into an executable for mac windows and linux the problem being have no idea where to start or how to write gui wit...
first you will need some gui library with python bindings and then if you want some program that will convert your python scripts into standalone executables cross platform gui libraries with python bindings windows linux mac of course there are many but the most popular that have seen in wild are tkinter based on tk g...
QA
how can create directly executable cross platform gui app using python python works on multiple platforms and can be used for desktop and web applications thus conclude that there is some way to compile it into an executable for mac windows and linux the problem being have no idea where to start or how to write gui wit...
you do not need to compile python for mac windows linux it is an interpreted language so you simply need to have the python interpreter installed on the system of your choice it is available for all three platforms as for gui library that works cross platform python tk tcl widget library works very well and believe is ...
QA
how can create directly executable cross platform gui app using python python works on multiple platforms and can be used for desktop and web applications thus conclude that there is some way to compile it into an executable for mac windows and linux the problem being have no idea where to start or how to write gui wit...
since python is installed on nearly every non windows os by default now the only thing you really need to make sure of is that all of the non standard libraries you use are installed having said that it is possible to build executables that include the python interpreter and any libraries you use this is likely to crea...
QA
adding method to an existing object instance have read that it is possible to add method to an existing object not in the class definition in python think this is called monkey patching or in some cases duck punching understand that it is not always good decision to do so but how might one do this update est that looks...
in python there is difference between functions and bound methods def foo print foo class def bar self print bar foo function foo at bar bound method bar of main instance at bc bound methods have been bound how descriptive to an instance and that instance will be passed as the first argument whenever the method is call...
QA
how can find the full path to font from its display name on mac am using the photoshop javascript api to find the fonts in given psd given font name returned by the api want to find the actual physical font file that that font name corresponds to on the disc this is all happening in python program running on osx so gue...
unfortunately the only api that is not deprecated is located in the applicationservices framework which does not have bridge support file and thus is not available in the bridge if you are wanting to use ctypes you can use atsfontgetfilereference after looking up the atsfontref cocoa does not have any native support at...
QA
calling function of module from string with the function name in python what is the best way to go about calling function given string with the function name in python program for example let us say that have module foo and have string whose contents are bar what is the best way to go about calling foo bar need to get ...
assuming module foo with method bar import foo methodtocall getattr foo bar result methodtocall as far as that goes lines and can be compressed to result getattr foo bar if that makes more sense for your use case you can use getattr in this fashion on class instance bound methods module level methods class methods the ...
QA
programmatically talking to serial port in os or linux have prolite led sign that like to set up to show scrolling search queries from apache logs and other fun statistics the problem is my does not have serial port so have to use usb to serial dongle it shows up as dev cu usbserial and dev tty usbserial when do this e...
have you tried watching the traffic between the gui and the serial port to see if there is some kind of special command being sent across also just curious python is sending ascii and not utf or something else right the reason ask is because noticed your quote changes for the strings and in some languages that actually...
QA
programmatically talking to serial port in os or linux have prolite led sign that like to set up to show scrolling search queries from apache logs and other fun statistics the problem is my does not have serial port so have to use usb to serial dongle it shows up as dev cu usbserial and dev tty usbserial when do this e...
dev cu xxxxx is the callout device it is what you use when you establish connection to the serial device and start talking to it dev tty xxxxx is the dialin device used for monitoring port for incoming calls for fax listener
QA
class views in django django view points to function which can be problem if you want to change only bit of functionality yes could have million keyword arguments and even more if statements in the function but was thinking more of an object oriented approach for example have page that displays user this page is very s...
if you are simply displaying data from models why not use the django generic views they are designed to let you easy show data from model without having to write your own view and stuff about mapping url paramaters to views fetching data handling edge cases rendering output etc
QA
python what is the difference between and and when should use each in many places and can be used interchangeably when should use one or the other and why
tuples are quick flexible way to create composite data types lists are containers for well lists of objects for example you would use list to store list of student details in class each student detail in that list may be tuple containing their roll number name and test score mark john also because tuples are immutable ...
QA
adding method to an existing object instance have read that it is possible to add method to an existing object not in the class definition in python think this is called monkey patching or in some cases duck punching understand that it is not always good decision to do so but how might one do this update est that looks...
what you are looking for is setattr believe use this to set an attribute on an object def printme print repr class pass setattr printme printme printme becomes the implicit self variable main instance at xabcdefg
QA
calling function of module from string with the function name in python what is the best way to go about calling function given string with the function name in python program for example let us say that have module foo and have string whose contents are bar what is the best way to go about calling foo bar need to get ...
patrick solution is probably the cleanest if you need to dynamically pick up the module as well you can import it like import foo func getattr bar func
QA
how to sell python to client boss person with lots of cash when asked to create system xyz and you ask to do it in python over php or ruby what are the main features you can mention when they require you to explain it
focus on the shorter time needed for development prototype and possibly easier maintenance none of this may apply against ruby
QA
how to sell python to client boss person with lots of cash when asked to create system xyz and you ask to do it in python over php or ruby what are the main features you can mention when they require you to explain it
this is one of those cases that really boil down to personal preference or situational details if you are more comfortable and experienced with python then say so are they asking you to justify it because they are more comfortable with one of the other environments after you are done will the system be passed off to so...
QA
how to sell python to client boss person with lots of cash when asked to create system xyz and you ask to do it in python over php or ruby what are the main features you can mention when they require you to explain it
would consider that using python on new project is completely dependent on what problem you are trying to solve with python if you want someone to agree with you that you should use python then show them how python features apply specifically to that problem in the case of web development with python talk about wsgi an...
QA
how do you set up python scripts to work in apache tried to follow couple of googled up tutorials on setting up mod python but failed every time do you have good step by step rock solid howto my dev box is os production centos
there are two main ways of running python on apache the simplest would be to use cgi and write normal python scripts while the second is using web framework like django or pylons using cgi is straightforward make sure your apache config file has cgi bin set up if not follow their documentation http httpd apache org doc...
QA
how do you set up python scripts to work in apache tried to follow couple of googled up tutorials on setting up mod python but failed every time do you have good step by step rock solid howto my dev box is os production centos
yes mod python is pretty confusing to set up here is how did it in httpd conf loadmodule python module modules mod python so directory serverbase htdocs myapp addhandler mod python py pythonhandler myapp pythondebug on and in your application directory serverbase htdocs myapp ls ltotal xr xr root sys may myapp py repea...
QA
how do you set up python scripts to work in apache tried to follow couple of googled up tutorials on setting up mod python but failed every time do you have good step by step rock solid howto my dev box is os production centos
are you running python on unix or windows an alternative to mod python and fastcgi is mod wsgi you can find out more at modwsgi have built and installed this on solaris without problems had previously tried mod python but ran into problems with shared libraries as part of the build there are good install docs available
QA
does anyone have experience creating shared library in matlab researcher has created small simulation in matlab and we want to make it accessible to others my plan is to take the simulation clean up few things and turn it into set of functions then plan to compile it into library and use swig to create python wrapper a...
will not help much but remember that was able to wrap matlab simulation into dll and then call it from delphi app it work really well anyway good luck
QA
cross platform language agnostic gui markup language learned swing back in the day but now have moved to python and want to make some apps with guis have not had the time to learn new gui api so have been using jython but would prefer to use cpython it would be great if can have one simple markup that allows me to swit...
erm html trying to be funny here while we wait for real answers
QA
cross platform language agnostic gui markup language learned swing back in the day but now have moved to python and want to make some apps with guis have not had the time to learn new gui api so have been using jython but would prefer to use cpython it would be great if can have one simple markup that allows me to swit...
the wxwidgets formerly known as wxwindows library might be what you are looking for there is particularly good port for python wxpython as well as versions for different languages perl and ruby come to mind and for various guis win mac os gtk motif wince the library been around for while and is pretty solid
QA
cross platform language agnostic gui markup language learned swing back in the day but now have moved to python and want to make some apps with guis have not had the time to learn new gui api so have been using jython but would prefer to use cpython it would be great if can have one simple markup that allows me to swit...
not sure if this is what you are looking for but there is glade or windows download which is designer for gtk it generates an xml file which can then be used to build the gui in number of different languages
QA
cross platform language agnostic gui markup language learned swing back in the day but now have moved to python and want to make some apps with guis have not had the time to learn new gui api so have been using jython but would prefer to use cpython it would be great if can have one simple markup that allows me to swit...
qt pronounced cute by its creators is cross platform application development framework widely used for the development of gui programs qt uses with several non standard extensions implemented by an additional pre processor that generates standard code before compilation qt can also be used in several other programming ...
QA
python unicode and the windows console when try to print unicode string in windows console get unicodeencodeerror charmap codec cannot encode character error assume this is because the windows console does not accept unicode only characters what is the best way around this is there any way can make python automatically...
note this answer is sort of outdated from please use the solution below with care here is page that details the problem and solution search the page for the text wrapping sys stdout into an instance printfails python wiki here is code excerpt from that page python import sys codecs locale print sys stdout encoding sys ...
QA
convert bytes to floating point numbers in python have binary file that have to parse and am using python is there way to take bytes and convert it to single precision floating point number
you will want the struct package
QA
python what is the difference between and and when should use each in many places and can be used interchangeably when should use one or the other and why
as others have mentioned lists and tuples are both containers which can be used to store python objects lists are extensible and their contents can change by assignment on the other hand tuples are immutable also lists cannot be used as keys in dictionary whereas tuples can
QA
python what is the difference between and and when should use each in many places and can be used interchangeably when should use one or the other and why
if you can find solution that works with tuples use them as it forces immutability which kind of drives you down more functional path you almost never regret going down the functional immutable path
QA
get size of file before downloading in python am downloading an entire directory from web server it works ok but cannot figure how to get the file size before download to compare if it was updated on the server or not can this be done as if was downloading the file from ftp server import urllib import re url http www s...
the size of the file is sent as the content length header here is how to get it with urllib site urllib urlopen http python org meta site info print meta getheaders content length
QA
get size of file before downloading in python am downloading an entire directory from web server it works ok but cannot figure how to get the file size before download to compare if it was updated on the server or not can this be done as if was downloading the file from ftp server import urllib import re url http www s...
using the returned urllib object method info you can get various information on the retrived document example of grabbing the current google logo import urllib urllib urlopen http www google co uk logos olympics opening gif print info content type image giflast modified thu aug gmt expires sun jan gmt cache control pub...
QA
get size of file before downloading in python am downloading an entire directory from web server it works ok but cannot figure how to get the file size before download to compare if it was updated on the server or not can this be done as if was downloading the file from ftp server import urllib import re url http www s...
also if the server you are connecting to supports it look at etags and the if modified since and if none match headers using these will take advantage of the webserver caching rules and will return not modified status code if the content has not changed
QA
get size of file before downloading in python am downloading an entire directory from web server it works ok but cannot figure how to get the file size before download to compare if it was updated on the server or not can this be done as if was downloading the file from ftp server import urllib import re url http www s...
have reproduced what you are seeing import urllib oslink http python org print opening url linksite urllib urlopen link meta site info print content length meta getheaders content length open out txt print file on disk len read close open out txt write site read site close close open out txt print file on disk after do...
QA
best way to abstract season show episode data basically have written an api to www thetvdb com in python the current code can be found here it grabs data from the api as requested and has to store the data somehow and make it available by doing print tvdbinstance episodename get the name of episode of season what is th...
why not use sqlite there is good support in python and you can write sql queries to get the data out here is the python docs for sqlite if you do not want to use sqlite you could do an array of dicts episodes episodes append season episode name something episodes append season episode name something actors billy bob se...
QA
any experiences with protocol buffers was just looking through some information about google protocol buffers data interchange format has anyone played around with the code or even created project around it am currently using xml in python project for structured content created by hand in text editor and was wondering ...
protocol buffers are intended to optimize communications between machines they are really not intended for human interaction also the format is binary so it could not replace xml in that use case would also recommend json as being the most compact text based format
QA
cross platform language agnostic gui markup language learned swing back in the day but now have moved to python and want to make some apps with guis have not had the time to learn new gui api so have been using jython but would prefer to use cpython it would be great if can have one simple markup that allows me to swit...
xml user interface language do not know much about it so not sure if it meets your desires post back with your experience if you play with it
QA
best way to abstract season show episode data basically have written an api to www thetvdb com in python the current code can be found here it grabs data from the api as requested and has to store the data somehow and make it available by doing print tvdbinstance episodename get the name of episode of season what is th...
have done something similar in the past and used an in memory xml document as quick and dirty hierachical database for storage you can store each show season episode as an element nested appropriately and attributes of these things as xml attributes on the elements then you can use xquery to get info back out note am n...
QA
get preview jpeg of pdf on windows have cross platform python application which needs to generate jpeg preview of the first page of pdf on the mac am spawning sips is there something similarly simple can do on windows
is the pc likely to have acrobat installed think acrobat installs she will extension so previews of the first page of pdf document appear in windows explorer thumbnail view you can get thumbnails yourself via the iextractimage com api which you will need to wrap vbaccelerator has an example in that you could port to py...
QA
get preview jpeg of pdf on windows have cross platform python application which needs to generate jpeg preview of the first page of pdf on the mac am spawning sips is there something similarly simple can do on windows
imagemagick delegates the pdf bitmap conversion to ghostscript anyway so here is command you can use it is based on the actual command listed by the ps alpha delegate in imagemagick just adjusted to use jpeg as output gs dquiet dparanoidsafer dbatch dnopause dnoprompt dmaxbitmap dlastpage daligntopixels dgridfittt sdev...
QA
how do use python itertools groupby have not been able to find an understandable explanation of how to actually use python itertools groupby function what am trying to do is this take list in this case the children of an objectified lxml element divide it into groups based on some criteria then later iterate over each ...
as sebastjan said you first have to sort your data this is important the part did not get is that in the example construction groups uniquekeys for in groupby data keyfunc groups append list store group iterator as list uniquekeys append is the current grouping key and is an iterator that you can use to iterate over th...
QA
cross platform language agnostic gui markup language learned swing back in the day but now have moved to python and want to make some apps with guis have not had the time to learn new gui api so have been using jython but would prefer to use cpython it would be great if can have one simple markup that allows me to swit...
read little on xml user interface language xul and it looks really robust and well supported the main problem for me is it is tied to the gecko rendering engine so it is cross platform the way wxwidgets qt and gtk are cross platform also there python bindings do not seem as good as those other libraries gladexml and xr...
QA
cross platform language agnostic gui markup language learned swing back in the day but now have moved to python and want to make some apps with guis have not had the time to learn new gui api so have been using jython but would prefer to use cpython it would be great if can have one simple markup that allows me to swit...
cristian and antony cramp while xul is nice choice for ui development cross platform open source licensed used in firefox and other major software it is certainly not language agnostic you are tied to gecko with js for scripting there is experimental support for python scripting but it is only experimental afaik you ca...
QA
cross platform language agnostic gui markup language learned swing back in the day but now have moved to python and want to make some apps with guis have not had the time to learn new gui api so have been using jython but would prefer to use cpython it would be great if can have one simple markup that allows me to swit...
seriously doubt you are going to find markup language for giu that is not tied to specific library for such thing to exist there would need to be standardized gui markup language with several implementations
QA
best way to abstract season show episode data basically have written an api to www thetvdb com in python the current code can be found here it grabs data from the api as requested and has to store the data somehow and make it available by doing print tvdbinstance episodename get the name of episode of season what is th...
do not get this part here this worked okay but there was no easy way of checking if was supposed to exist or not so could not raise the seasonnotfound exception there is way to do it called in in true in false what seems to be the problem with that
QA
class views in django django view points to function which can be problem if you want to change only bit of functionality yes could have million keyword arguments and even more if statements in the function but was thinking more of an object oriented approach for example have page that displays user this page is very s...
unless you want to do something little complex using the generic views are the way to go they are far more powerful than their name implies and if you are just displaying model data generic views will do the job
QA
python and mysql can get python to work with postgresql but cannot get it to work with mysql the main problem is that on the shared hosting account have do not have the ability to install things such as django or pysql generally fail when installing them on my computer so maybe it is good cannot install on the host fou...
you could try setting up your own python installation using virtual python check out how to setup django using it here that was written long time ago but it shows how got mysqldb setup without having root access or anything like it once you have got the basics going you can install any python library you want
QA
how to use xpath in python what is the library is there full implementation how is the library used where is its website
the lxml package supports xpath it seems to work pretty well although have had some trouble with the self axis there is also amara but have not used it personally
QA
accessing mp meta data with python what is the best way to retrieve mp metadata in python have seen couple frameworks out there but am unsure as to which would be the best to use any ideas
this toolkit may do what you need cannot say if it is the best but really if it does what you need that is all that matters right hth
QA
accessing mp meta data with python what is the best way to retrieve mp metadata in python have seen couple frameworks out there but am unsure as to which would be the best to use any ideas
simple example from the book dive into python works ok for me this is the download link the example is fileinfo py do not know if it is the best but it can do the basic job the entire book is available online here
QA
accessing mp meta data with python what is the best way to retrieve mp metadata in python have seen couple frameworks out there but am unsure as to which would be the best to use any ideas
it can depend on exactly what you want to do in addition to reading the metadata if it is just simply the bitrate name etc that you need and nothing else something lightweight is probably best if you are manipulating the mp past that pymedia may be suitable there are quite few whatever you do get make sure and test it ...
QA
best way to abstract season show episode data basically have written an api to www thetvdb com in python the current code can be found here it grabs data from the api as requested and has to store the data somehow and make it available by doing print tvdbinstance episodename get the name of episode of season what is th...
bartosz to clarify this worked okay but there was no easy way of checking if was supposed to exist or not some show would return season episode of some show if there was no season want the pseudo dict to raise tvdbseasonnotfound if some show does not exist then raise tvdbshownotfound the current system of series of cla...
QA
how to use xpath in python what is the library is there full implementation how is the library used where is its website
pyxml works well you did not say what platform you are using however if you are on ubuntu you can get it with sudo apt get install python xml am sure other linux distros have it as well if you are on mac xpath is already installed but not immediately accessible you can set py use xmlplus in your environment or do it th...
QA
accessing mp meta data with python what is the best way to retrieve mp metadata in python have seen couple frameworks out there but am unsure as to which would be the best to use any ideas
what you are after is the id module it is very simple and will give you exactly what you need just copy the id py file into your site packages directory and you will be able to do something like the following from id import try id info id file mp print id info change the tags id info title green eggs and ham id info ar...
QA
how do treat an integer as an array of bytes in python am trying to decode the result of the python os wait function this returns according to the python docs tuple containing its pid and exit status indication bit number whose low byte is the signal number that killed the process and whose high byte is the exit status...
this will do what you want signum status xff exitstatus status xff
QA
how do treat an integer as an array of bytes in python am trying to decode the result of the python os wait function this returns according to the python docs tuple containing its pid and exit status indication bit number whose low byte is the signal number that killed the process and whose high byte is the exit status...
you can unpack the status using bit shifting and masking operators low status ff high status xff am not python programmer so hope got the syntax correct
QA
how do treat an integer as an array of bytes in python am trying to decode the result of the python os wait function this returns according to the python docs tuple containing its pid and exit status indication bit number whose low byte is the signal number that killed the process and whose high byte is the exit status...
the folks before me ve nailed it but if you really want it on one line you can do this signum exitstatus status xff status xff edit had it backwards
QA
how do treat an integer as an array of bytes in python am trying to decode the result of the python os wait function this returns according to the python docs tuple containing its pid and exit status indication bit number whose low byte is the signal number that killed the process and whose high byte is the exit status...
to answer your general question you can use bit manipulation techniques pid status os wait exitstatus signum status xff status xff however there are also built in functions for interpreting exit status values pid status os wait exitstatus signum os wexitstatus status os wtermsig status see also os wcoredump os wifconti...
QA
best way to abstract season show episode data basically have written an api to www thetvdb com in python the current code can be found here it grabs data from the api as requested and has to store the data somehow and make it available by doing print tvdbinstance episodename get the name of episode of season what is th...
ok what you need is classobj from new module that would allow you to construct exception classes dynamically classobj takes string as an argument for the class name import new myexc new classobj excname exception myexc this is the exc message raise this gives you traceback most recent call last file stdin line in modul...
QA
accessing mp meta data with python what is the best way to retrieve mp metadata in python have seen couple frameworks out there but am unsure as to which would be the best to use any ideas
have used mutagen to edit tags in media files before the nice thing about mutagen is that it can handle other formats such as mp flac etc have written several scripts with lot of success using this api
QA
how to use xpath in python what is the library is there full implementation how is the library used where is its website
the latest version of elementtree supports xpath pretty well not being an xpath expert cannot say for sure if the implementation is full but it has satisfied most of my needs when working in python have also use lxml and pyxml and find etree nice because it is standard module note have since found lxml and for me it is...
QA
how should unit test code generator this is difficult and open ended question know but thought would throw it to the floor and see if anyone had any interesting suggestions have developed code generator that takes our python interface to our code generated via swig and generates code needed to expose this as webservice...
started writing up summary of my experience with my own code generator then went back and re read your question and found you had already touched upon the same issues yourself focus on the execution results instead of the code layout look problem is this is hard to test the generated code might not be suited to actuall...
QA
how should unit test code generator this is difficult and open ended question know but thought would throw it to the floor and see if anyone had any interesting suggestions have developed code generator that takes our python interface to our code generated via swig and generates code needed to expose this as webservice...
yes results are the only thing that matters the real chore is writing framework that allows your generated code to run independently spend your time there
QA
how should unit test code generator this is difficult and open ended question know but thought would throw it to the floor and see if anyone had any interesting suggestions have developed code generator that takes our python interface to our code generated via swig and generates code needed to expose this as webservice...
if you are running on nux you might consider dumping the unittest framework in favor of bash script or makefile on windows you might consider building she will app function that runs the generator and then uses the code as another process and unittest that third option would be to generate the code and then build an ap...
QA
how should unit test code generator this is difficult and open ended question know but thought would throw it to the floor and see if anyone had any interesting suggestions have developed code generator that takes our python interface to our code generated via swig and generates code needed to expose this as webservice...
recall that unit testing is only one kind of testing you should be able to unit test the internal pieces of your code generator what you are really looking at here is system level testing regression testing it is not just semantics there are different mindsets approaches expectations etc it is certainly more work but y...
QA
how can create directly executable cross platform gui app using python python works on multiple platforms and can be used for desktop and web applications thus conclude that there is some way to compile it into an executable for mac windows and linux the problem being have no idea where to start or how to write gui wit...
an alternative tool to py exe is bbfreeze which generates executables for windows and linux it is newer than py exe and handles eggs quite well have found it magically works better without configuration for wide variety of applications
QA
how can create directly executable cross platform gui app using python python works on multiple platforms and can be used for desktop and web applications thus conclude that there is some way to compile it into an executable for mac windows and linux the problem being have no idea where to start or how to write gui wit...
am not sure that this is the best way to do it but when am deploying ruby gui apps not python but has the same problem as far as exe are concerned on windows just write short launcher in that calls on my main script it compiles to an executable and then have an application executable
QA
python what is the difference between and and when should use each in many places and can be used interchangeably when should use one or the other and why
whenever need to pass in collection of items to function if want the function to not change the values passed in use tuples else if want to have the function to alter the values use list always if you are using external libraries and need to pass in list of values to function and are unsure about the integrity of the d...
QA
python what is the difference between and and when should use each in many places and can be used interchangeably when should use one or the other and why
the notion of tuples are highly expressive pragmatically they are great for packing and unpacking values coord in combination with dictionaries hash tables they allow forms of mapping that would otherwise require many levels of association for example consider marking that has been found php if isset found found array ...
QA
can you check that an exception is thrown with doctest in python is it possible to write doctest unit test that will check that an exception is raised for example if have function foo that is supposed to raise an exception if how would write the doctest for that
yes you can do it the doctest module documentation and wikipedia has an example of it traceback most recent call last nameerror name is not defined
QA
using an xml catalog with python lxml is there way when parse an xml document using lxml to validate that document against its dtd using an external catalog file need to be able to work the fixed attributes defined in document dtd
can you give an example according to the lxml validation docs lxml can handle dtd validation specified in the xml doc or externally in code and system catalogs which covers most cases can think of stringio element empty dtd etree dtd dtd etree dtd external id oasis dtd docbook xml en
QA
how do you express binary literals in python how do you express an integer as binary number with python literals was easily able to find the answer for hex af and octal how do you use literals to express binary in python summary of answers python and earlier can express binary using int but not with literal python and ...
for reference future python possibilities starting with python you can express binary literals using the prefix or you can also use the new bin function to get the binary representation of number bin development version of the documentation what is new in python
QA
replacement for for if array iteration love list comprehensions in python because they concisely represent transformation of list however in other languages frequently find myself writing something along the lines of foreach int in intarray if generic condition on do other processing this example is in where am under t...
depends on the language and what you need to do map as it is called in many languages could be what you are looking for do not know but according to this page net calls map convertall the meaning of map is pretty simple take list and apply function to each element of it returning new list you may also be looking for fi...
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
3