content
stringlengths
85
101k
title
stringlengths
0
150
question
stringlengths
15
48k
answers
list
answers_scores
list
non_answers
list
non_answers_scores
list
tags
list
name
stringlengths
35
137
Q: Can you do LINQ-like queries in a language like Python or Boo? Take this simple C# LINQ query, and imagine that db.Numbers is an SQL table with one column Number: var result = from n in db.Numbers where n.Number < 5 select n.Number; This will run very efficiently in C#, because it generates a...
Can you do LINQ-like queries in a language like Python or Boo?
Take this simple C# LINQ query, and imagine that db.Numbers is an SQL table with one column Number: var result = from n in db.Numbers where n.Number < 5 select n.Number; This will run very efficiently in C#, because it generates an SQL query something like select Number from Numbers where Number <...
[ "sqlsoup in sqlalchemy gives you the quickest solution in python I think if you want a clear(ish) one liner . Look at the page to see.\nIt should be something like...\nresult = [n.Number for n in db.Numbers.filter(db.Numbers.Number < 5).all()]\n\n", "Look closely at SQLAlchemy. This can probably do much of what ...
[ 6, 5, 4, 4, 1, 0 ]
[]
[]
[ "boo", "ironpython", "linq", "linq_to_sql", "python" ]
stackoverflow_0000117732_boo_ironpython_linq_linq_to_sql_python.txt
Q: Python re.findall with groupdicts I kind of wish that there were a version of re.findall that returned groupdicts instead of just groups. Am I missing some simple way to accomplish the same result? Does anybody know of a reason that this function doesn't exist? A: You could use the finditer() function. This wil...
Python re.findall with groupdicts
I kind of wish that there were a version of re.findall that returned groupdicts instead of just groups. Am I missing some simple way to accomplish the same result? Does anybody know of a reason that this function doesn't exist?
[ "You could use the finditer() function. This will give you a sequence of match objects, so you can get the groupdict for each with:\n[m.groupdict() for m in regex.finditer(search_string)]\n\n" ]
[ 31 ]
[]
[]
[ "python", "regex" ]
stackoverflow_0000255332_python_regex.txt
Q: Determine if a named parameter was passed I would like to know if it is possible to determine if a function parameter with a default value was passed in Python. For example, how does dict.pop work? >>> {}.pop('test') Traceback (most recent call last): File "<stdin>", line 1, in <module> KeyError: 'pop(): diction...
Determine if a named parameter was passed
I would like to know if it is possible to determine if a function parameter with a default value was passed in Python. For example, how does dict.pop work? >>> {}.pop('test') Traceback (most recent call last): File "<stdin>", line 1, in <module> KeyError: 'pop(): dictionary is empty' >>> {}.pop('test',None) >>> {}.po...
[ "The convention is often to use arg=None and use\ndef foo(arg=None):\n if arg is None:\n arg = \"default value\"\n # other stuff\n # ...\n\nto check if it was passed or not. Allowing the user to pass None, which would be interpreted as if the argument was not passed.\n", "I guess you mean \"ke...
[ 17, 12, 4, 2, 1 ]
[]
[]
[ "default_value", "named_parameters", "python" ]
stackoverflow_0000255429_default_value_named_parameters_python.txt
Q: Python packages and egg-info directories Can someone explain how egg-info directories are tied to their respective modules? For example, I have the following: /usr/local/lib/python2.5/site-packages/quodlibet/ /usr/local/lib/python2.5/site-packages/quodlibet-2.0.egg-info/ I'm assuming the egg-info directory is to ...
Python packages and egg-info directories
Can someone explain how egg-info directories are tied to their respective modules? For example, I have the following: /usr/local/lib/python2.5/site-packages/quodlibet/ /usr/local/lib/python2.5/site-packages/quodlibet-2.0.egg-info/ I'm assuming the egg-info directory is to make the corresponding module visible to setup...
[ "The .egg-info directories get only created if --single-version-externally-managed was used to install the egg. \"Normally\", installing an egg would create a single directory (or zip file), containing both the code and the metadata. \npkg_resources (which is the library that reads the metadata) has a function requ...
[ 75 ]
[]
[]
[ "egg", "python", "setuptools" ]
stackoverflow_0000256417_egg_python_setuptools.txt
Q: How to override HTTP request verb in GAE In the context of a Google App Engine Webapp framework application: I want to changed the request verb of a request in the case a parameter _method is provided, for example if a POST request comes in with a parameter _method=PUT, I need to change the request to call the put...
How to override HTTP request verb in GAE
In the context of a Google App Engine Webapp framework application: I want to changed the request verb of a request in the case a parameter _method is provided, for example if a POST request comes in with a parameter _method=PUT, I need to change the request to call the put method of the handler. This is to cope with t...
[ "Calling the handler from initialize isn't the right way anyway - if you do that, the webapp will then call the original handler as well.\nInstead, you have a couple of options:\n\nYou can subclass webapp.WSGIApplication and override call to select the method based on _method when it exists.\nYou can check for the ...
[ 3, 2 ]
[]
[]
[ "google_app_engine", "metaclass", "python", "rest" ]
stackoverflow_0000255157_google_app_engine_metaclass_python_rest.txt
Q: Storage transactions in Redland's Python bindings? I've currently skimming through the Python-bindings for Redland and haven't found a clean way to do transactions on the storage engine via it. I found some model-transactions within the low-level Redland module: import RDF, Redland storage = RDF.Storage(...) mode...
Storage transactions in Redland's Python bindings?
I've currently skimming through the Python-bindings for Redland and haven't found a clean way to do transactions on the storage engine via it. I found some model-transactions within the low-level Redland module: import RDF, Redland storage = RDF.Storage(...) model = RDF.Model(storage) Redland.librdf_model_transaction_...
[ "Yes, this should work. There are no convenience functions for the model class in the python wrapper right now but they would be similar to what you wrote:\nclass Model(object):\n ...\n def transaction_start(self):\n return Redland.librdf_model_transaction_start(self._model) \n\n" ]
[ 4 ]
[]
[]
[ "python", "rdf", "rdfstore", "redland", "transactions" ]
stackoverflow_0000255263_python_rdf_rdfstore_redland_transactions.txt
Q: Java equivalent to pyftpdlib? Is there a good Java alternative to pyftpdlib? I am looking for an easy to setup and run embedded ftp server. A: Check out Apache's FTPServer. They have an example of how to embed it in a Java application.
Java equivalent to pyftpdlib?
Is there a good Java alternative to pyftpdlib? I am looking for an easy to setup and run embedded ftp server.
[ "Check out Apache's FTPServer.\nThey have an example of how to embed it in a Java application.\n" ]
[ 0 ]
[]
[]
[ "ftp", "java", "python" ]
stackoverflow_0000257956_ftp_java_python.txt
Q: Python: wrapping method invocations with pre and post methods I am instantiating a class A (which I am importing from somebody else, so I can't modify it) into my class X. Is there a way I can intercept or wrap calls to methods in A? I.e., in the code below can I call x.a.p1() and get the output X.pre A.p1 X.post...
Python: wrapping method invocations with pre and post methods
I am instantiating a class A (which I am importing from somebody else, so I can't modify it) into my class X. Is there a way I can intercept or wrap calls to methods in A? I.e., in the code below can I call x.a.p1() and get the output X.pre A.p1 X.post Many TIA! class A: # in my real application, this is an impor...
[ "Here is the solution I and my colleagues came up with:\nfrom types import MethodType\n\nclass PrePostCaller:\n def __init__(self, other):\n self.other = other\n\n def pre(self): print 'pre'\n def post(self): print 'post'\n\n def __getattr__(self, name):\n if hasattr(self.other, name):\n ...
[ 7, 1, 1, 1, 1, 0 ]
[]
[]
[ "metaprogramming", "python" ]
stackoverflow_0000258119_metaprogramming_python.txt
Q: Python filter/remove URLs from a list I have a text file of URLs, about 14000. Below is a couple of examples: http://www.domainname.com/pagename?CONTENT_ITEM_ID=100&param2=123 http://www.domainname.com/images?IMAGE_ID=10 http://www.domainname.com/pagename?CONTENT_ITEM_ID=101&param2=123 http://www.domainname.com/i...
Python filter/remove URLs from a list
I have a text file of URLs, about 14000. Below is a couple of examples: http://www.domainname.com/pagename?CONTENT_ITEM_ID=100&param2=123 http://www.domainname.com/images?IMAGE_ID=10 http://www.domainname.com/pagename?CONTENT_ITEM_ID=101&param2=123 http://www.domainname.com/images?IMAGE_ID=11 http://www.domainname.com...
[ "Here's another alternative to Graeme's, using the newer list comprehension syntax:\nlist2= [line for line in file if 'CONTENT_ITEM_ID' in line]\n\nWhich you prefer is a matter of taste!\n", "I liked @bobince's answer (+1), but will up the ante.\nSince you have a rather large starting set, you may wish to avoid l...
[ 21, 6, 5, 5 ]
[]
[]
[ "filter", "list", "python", "url" ]
stackoverflow_0000258390_filter_list_python_url.txt
Q: Why are Exceptions iterable? I have been bitten by something unexpected recently. I wanted to make something like that: try : thing.merge(iterable) # this is an iterable so I add it to the list except TypeError : thing.append(iterable) # this is not iterable, so I add it Well, It was working fine until ...
Why are Exceptions iterable?
I have been bitten by something unexpected recently. I wanted to make something like that: try : thing.merge(iterable) # this is an iterable so I add it to the list except TypeError : thing.append(iterable) # this is not iterable, so I add it Well, It was working fine until I passed an object inheriting from...
[ "Note that what is happening is not related to any kind of implicit string conversion etc, but because the Exception class implements ___getitem__ to return the values from the args tuple (ex.args). You can see this by the fact that you get the whole string as your first and only item in the iteration, rather than ...
[ 13, 2 ]
[]
[]
[ "exception", "python" ]
stackoverflow_0000258228_exception_python.txt
Q: Django: Overriding verbose_name for AutoField without dropping the model I am using 0.97-pre-SVN-unknown release of Django. I have a model for which I have not given any primary_key. Django, consequently, automatically provides an AutoField that is called "id". Everything's fine with that. But now, I have to chang...
Django: Overriding verbose_name for AutoField without dropping the model
I am using 0.97-pre-SVN-unknown release of Django. I have a model for which I have not given any primary_key. Django, consequently, automatically provides an AutoField that is called "id". Everything's fine with that. But now, I have to change the "verbose_name" of that AutoField to something other than "id". I cannot ...
[ "Hmm... and what about explicitly write id field in the model definition? Like this for example:\nclass Entry(models.Model):\n id = models.AutoField(verbose_name=\"custom name\")\n # and other fields...\n\nIt doesn't require any underlying database changes.\n", "Look into the command-line options for manage.p...
[ 4, 2 ]
[]
[]
[ "django", "python" ]
stackoverflow_0000258767_django_python.txt
Q: python, functions running from a list and adding to a list through functions How do I run a function on a loop so all the results go straight into a list and is there a way to run a function which acts on all the values in a list? A: Theres a couple ways to run a function on a loop like that - You can either use...
python, functions running from a list and adding to a list through functions
How do I run a function on a loop so all the results go straight into a list and is there a way to run a function which acts on all the values in a list?
[ "Theres a couple ways to run a function on a loop like that - You can either use a list comprehension\ntest = list('asdf')\n[function(x) for x in test]\n\nand use that result\nOr you could use the map function\ntest = list('asdf')\nmap(function, test)\n\nThe first answer is more \"pythonic\", while the second is mo...
[ 8, 1, 0 ]
[]
[]
[ "function", "list", "python" ]
stackoverflow_0000259234_function_list_python.txt
Q: Turning a GqlQuery result set into a python dictionary Let's say I have a model like this class Foo(db.Model): id = db.StringProperty() bar = db.StringProperty() baz = db.StringProperty() And I'm going a GqlQuery like this foos = db.GqlQuery("SELECT * FROM Foo") I want to take the results of the GqlQ...
Turning a GqlQuery result set into a python dictionary
Let's say I have a model like this class Foo(db.Model): id = db.StringProperty() bar = db.StringProperty() baz = db.StringProperty() And I'm going a GqlQuery like this foos = db.GqlQuery("SELECT * FROM Foo") I want to take the results of the GqlQuery and turn into some sort of JSON string that I can manip...
[ "Take a look at google.appengine.api.datastore. It's the lower level datastore API that google.appengine.ext.db builds on, and it returns Entity objects, which subclass dict. You can query it using GQL with google.appengine.ext.gql, or (my personal preference) use the Query class, which avoids the need for you to c...
[ 2, 1, 0 ]
[ "You can use web2py on GAE and do:\ndb.define_table('foo',SQLField('bar'),SQLField('baz'))\nrows=db(db.foo.id>0).select()\n### rows is a list, rows.response is a list of tuples\nfor row in rows: print dict(row)\n\nRuns on Oracle, Postgresql, Mssql, mysql, etc... too.\n" ]
[ -1 ]
[ "google_app_engine", "gqlquery", "python" ]
stackoverflow_0000212125_google_app_engine_gqlquery_python.txt
Q: exceptions.AttributeError : SMTP instance has no attribute 'login' : Hey I have a windows server running python CGI scripts and I'm having a little trouble with smtplib. The server is running python 2.1 (unfortunately and I can not upgrade it). Anyway I have the following code: session = smtplib.SMTP("smtp-auth.o...
exceptions.AttributeError : SMTP instance has no attribute 'login' :
Hey I have a windows server running python CGI scripts and I'm having a little trouble with smtplib. The server is running python 2.1 (unfortunately and I can not upgrade it). Anyway I have the following code: session = smtplib.SMTP("smtp-auth.ourhosting.com", 587) session.login(smtpuser, smtppass) and it's giving me ...
[ "login() was introduced in Python 2.2, unluckily for you! The only way to do it in Python 2.1's own smtplib would be to issue the AUTH commands manually, which wouldn't be much fun.\nI haven't tested it fully but it seems Python 2.2's smtplib should more or less work on 2.1 if you copy it across as you describe (pe...
[ 4, 0 ]
[]
[]
[ "python", "python_2.1", "smtp", "smtplib" ]
stackoverflow_0000259314_python_python_2.1_smtp_smtplib.txt
Q: How do I make Windows aware of a service I have written in Python? In another question I posted yesterday, I got very good advice on how a Python script could be run as a service in Windows. What I'm left wondering is: How is Windows aware of the services that can be managed in the native tools ("services" window ...
How do I make Windows aware of a service I have written in Python?
In another question I posted yesterday, I got very good advice on how a Python script could be run as a service in Windows. What I'm left wondering is: How is Windows aware of the services that can be managed in the native tools ("services" window in "administrative tools"). I. e. what is the Windows equivalent of putt...
[ "Don't muck with the registry directly. User the SC command-line tool. Namely, SC CREATE\n\n DESCRIPTION:\n SC is a command line program used for communicating with the\n NT Service Controller and services.\n USAGE:\n sc [command] [service name] ...\n\n The option has the form \...
[ 8, 7, 3, 0 ]
[]
[]
[ "cross_platform", "python", "windows" ]
stackoverflow_0000034328_cross_platform_python_windows.txt
Q: Is it safe to make an old-style class into a new-style class using Multiple Inheritance? In a program that I'm writing, I wanted to make a ConfigParser that's read only so that it can safely be used globally. I didn't realize this, but apparently the SafeConfigParser is an old-style class, thus I had to subclass ...
Is it safe to make an old-style class into a new-style class using Multiple Inheritance?
In a program that I'm writing, I wanted to make a ConfigParser that's read only so that it can safely be used globally. I didn't realize this, but apparently the SafeConfigParser is an old-style class, thus I had to subclass it like this: class ConstParser(SafeConfigParser, object): """This is a implementation of...
[ "Replace the call:\nsuper(ConstParser, self).__init__(defaults)\n\nwith:\nSafeConfigParser.__init__(self, defaults)\n\nand it works just fine without multiple Inheritance.\n" ]
[ 2 ]
[]
[]
[ "oop", "python" ]
stackoverflow_0000259578_oop_python.txt
Q: Does Python 2.5 include a package to natively transform an XML document? In my Python app, I have an XML document that I'd like to transform using my XSL file. I'm currently using xml.etree to generate the XML document, but I haven't found anything within Python 2.5 that will allow me to natively transform my XML...
Does Python 2.5 include a package to natively transform an XML document?
In my Python app, I have an XML document that I'd like to transform using my XSL file. I'm currently using xml.etree to generate the XML document, but I haven't found anything within Python 2.5 that will allow me to natively transform my XML document. I've already found one library (libxslt) which can execute the tran...
[ "If you have libxml2 and libxslt installed, then also install lxml. It provides a nice, easy-to-use binding for libxml2 and libxslt, and it also implements the ElementTree API.\nlibxml2/libxslt also come with their own, much lower-level Python bindings, but lxml is much more straightforward and pythonic, and it se...
[ 5, 4 ]
[]
[]
[ "elementtree", "python", "xml", "xslt" ]
stackoverflow_0000259782_elementtree_python_xml_xslt.txt
Q: How can I make a fake "active session" for gconf? I've automated my Ubuntu installation - I've got Python code that runs automatically (after a clean install, but before the first user login - it's in a temporary /etc/init.d/ script) that sets up everything from Apache & its configuration to my personal Gnome pref...
How can I make a fake "active session" for gconf?
I've automated my Ubuntu installation - I've got Python code that runs automatically (after a clean install, but before the first user login - it's in a temporary /etc/init.d/ script) that sets up everything from Apache & its configuration to my personal Gnome preferences. It's the latter that's giving me trouble. This...
[ "I can reproduce this by installing GConf 2.24 on my machine. GConf 2.22 works fine, but 2.24 breaks it.\nGConf is failing to launch because D-Bus is not running. Manually spawning D-Bus and the GConf daemon makes this work again.\nI tried to spawn the D-Bus session bus by doing the following:\nimport dbus\ndummy_b...
[ 8, 1, 1 ]
[]
[]
[ "gconf", "python", "ubuntu", "ubuntu_8.10" ]
stackoverflow_0000257658_gconf_python_ubuntu_ubuntu_8.10.txt
Q: What is the simplest way to find the difference between 2 times in python? I have 2 time values which have the type datetime.time. I want to find their difference. The obvious thing to do is t1 - t2, but this doesn't work. It works for objects of type datetime.datetime but not for datetime.time. So what is the bes...
What is the simplest way to find the difference between 2 times in python?
I have 2 time values which have the type datetime.time. I want to find their difference. The obvious thing to do is t1 - t2, but this doesn't work. It works for objects of type datetime.datetime but not for datetime.time. So what is the best way to do this?
[ "Also a little silly, but you could try picking an arbitrary day and embedding each time in it, using datetime.datetime.combine, then subtracting:\n>>> import datetime\n>>> t1 = datetime.time(2,3,4)\n>>> t2 = datetime.time(18,20,59)\n>>> dummydate = datetime.date(2000,1,1)\n>>> datetime.datetime.combine(dummydate,t...
[ 16, 7, 3, 1, -1 ]
[ "Retrieve the times in milliseconds and then do the subtraction.\n", "Environment.TickCount seems to work well if you need something quick.\nint start = Environment.TickCount\n...DoSomething()\nint elapsedtime = Environment.TickCount - start\nJon\n" ]
[ -1, -3 ]
[ "datetime", "python", "time" ]
stackoverflow_0000051010_datetime_python_time.txt
Q: launching VS2008 build from python if I paste this into the command prompt by hand, it works, but if I run it from python, I get The filename, directgory name, or volume label syntax is incorrect. os.system('%comspec% /k ""C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" x86') os.system('devenv Imme...
launching VS2008 build from python
if I paste this into the command prompt by hand, it works, but if I run it from python, I get The filename, directgory name, or volume label syntax is incorrect. os.system('%comspec% /k ""C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" x86') os.system('devenv Immersica.sln /rebuild Debug /Out last-build...
[ "I think the backslashes are messing you up. You need to use an R string (raw)\nr\"string\"\nSee https://docs.python.org/2/reference/lexical_analysis.html#string-literals for reference\n" ]
[ 1 ]
[]
[]
[ "build_automation", "python", "visual_studio_2008", "windows" ]
stackoverflow_0000263690_build_automation_python_visual_studio_2008_windows.txt
Q: How can I ask for root password but perform the action at a later time? I have a python script that I would like to add a "Shutdown when done" feature to. I know I can use gksudo (when the user clicks on "shutdown when done") to ask the user for root privileges but how can I use those privileges at a later time (w...
How can I ask for root password but perform the action at a later time?
I have a python script that I would like to add a "Shutdown when done" feature to. I know I can use gksudo (when the user clicks on "shutdown when done") to ask the user for root privileges but how can I use those privileges at a later time (when the script is actually finished). I have thought about chmod u+s on the s...
[ "Instead of chmod u+sing the shutdown command, allowing passwordless sudo access to that command would be better..\nAs for allowing shutdown at the end of the script, I suppose you could run the entire script with sudo, then drop privileges to the initial user at the start of the script?\n", "gksudo should have a...
[ 4, 3, 1 ]
[]
[]
[ "linux", "python", "ubuntu" ]
stackoverflow_0000263773_linux_python_ubuntu.txt
Q: We have a graphical designer, now they want a text based designer. Suggestions? I'm sorry I could not think of a better title. The problem is the following: For our customer we have created (as part of a larger application) a graphical designer which they can use to build "scenario's". These scenario's consist of ...
We have a graphical designer, now they want a text based designer. Suggestions?
I'm sorry I could not think of a better title. The problem is the following: For our customer we have created (as part of a larger application) a graphical designer which they can use to build "scenario's". These scenario's consist of "Composites" which in turn consist of "Commands". These command objects all derive fr...
[ "From what i think i've understood you have two options\nyou could either use an XML style \"markup\" to let them define entities and their groupings, but that may not be best.\nYour alternatives are yes, yoou could embedd a language, but do you really need to, wouldnt that be overkill, and how can you control it?\...
[ 4, 2, 2, 1, 1, 0 ]
[]
[]
[ "c#", "embedding", "parsing", "python", "scripting" ]
stackoverflow_0000263550_c#_embedding_parsing_python_scripting.txt
Q: making a programme run indefinitely in python Is there any way to make a function (the ones I'm thinking of are in the style of the simple ones I've made which generate the fibonnacci sequence from 0 to a point, and all the primes between two points) run indefinitely. E.g. until I press a certain key or until a ...
making a programme run indefinitely in python
Is there any way to make a function (the ones I'm thinking of are in the style of the simple ones I've made which generate the fibonnacci sequence from 0 to a point, and all the primes between two points) run indefinitely. E.g. until I press a certain key or until a time has passed, rather than until a number reaches...
[ "The simplest way is just to write a program with an infinite loop, and then hit control-C to stop it. Without more description it's hard to know if this works for you.\nIf you do it time-based, you don't need a generator. You can just have it pause for user input, something like a \"Continue? [y/n]\", read from st...
[ 2, 2, 2, 1, 1, 0, 0 ]
[]
[]
[ "indefinite", "key", "python", "time" ]
stackoverflow_0000262460_indefinite_key_python_time.txt
Q: Python - one variable equals another variable when it shouldn't Here is my sample code. It is meant to be an iterative procedure for gauss seidel (matrix solver). Essentially when the error is small enough it breaks out of the while loop. i=1 while (i>0): x_past = x_present j=0 while(j<3): val...
Python - one variable equals another variable when it shouldn't
Here is my sample code. It is meant to be an iterative procedure for gauss seidel (matrix solver). Essentially when the error is small enough it breaks out of the while loop. i=1 while (i>0): x_past = x_present j=0 while(j<3): value=0 k=0 while(k<3): if(k!=j): ...
[ "Yes, I think the answers here show your problem.\nJust to try and clarify a little bit.\nYou're referencing a list, so when the list changes any reference to that list will reflect that change. To demonstrate:\n>>> x_present = [4,5,6]\n>>>\n>>> x_past = x_present\n>>>\n>>> x_past\n[4, 5, 6]\n>>>\n>>> x_present.ap...
[ 31, 4, 3, 1, 0, 0 ]
[]
[]
[ "python", "variables" ]
stackoverflow_0000264575_python_variables.txt
Q: How can I optimize this Google App Engine code? I'm relatively new to the Python world, but this seems very straight forward. Google is yelling at me that this code needs to be optimized: class AddLinks(webapp.RequestHandler): def post(self): # Hash the textarea input to generate pseudo-unique value...
How can I optimize this Google App Engine code?
I'm relatively new to the Python world, but this seems very straight forward. Google is yelling at me that this code needs to be optimized: class AddLinks(webapp.RequestHandler): def post(self): # Hash the textarea input to generate pseudo-unique value hash = md5.new(self.request.get('links'))....
[ "The main overhead here is the multiple individual puts to the datastore. If you can, store the links as a single entity, as Andre suggests. You can always split the links into an array and store it in a ListProperty.\nIf you do need an entity for each link, try this:\n# For each line in the input, add to the datab...
[ 7, 3, 2, 0, 0, 0 ]
[]
[]
[ "google_app_engine", "optimization", "python" ]
stackoverflow_0000250209_google_app_engine_optimization_python.txt
Q: How do I process a string such as this using regular expressions? How can I create a regex for a string such as this: <SERVER> <SERVERKEY> <COMMAND> <FOLDERPATH> <RETENTION> <TRANSFERMODE> <OUTPUTPATH> <LOGTO> <OPTIONAL-MAXSIZE> <OPTIONAL-OFFSET> Most of these fields are just simple words, but some of them can be...
How do I process a string such as this using regular expressions?
How can I create a regex for a string such as this: <SERVER> <SERVERKEY> <COMMAND> <FOLDERPATH> <RETENTION> <TRANSFERMODE> <OUTPUTPATH> <LOGTO> <OPTIONAL-MAXSIZE> <OPTIONAL-OFFSET> Most of these fields are just simple words, but some of them can be paths, such as FOLDERPATH, OUTPUTPATH, these paths can also be paths w...
[ "The problem is that because you're allowing spaces in filenames and using spaces to separate fields, the solution is ambiguous. You either need to use a different field separator character that can't appear in filenames, or use some other method of representing filenames with spaces in them, e.g. putting them in ...
[ 4, 3, 1, 0 ]
[ "Are less than/greater than allowed inside the values? Because if not you have a very simple solution:\nJust replace ever occurance of \"> \" with just \">\", split on \"><\", and strip out all less than/greater than from each item. It's probably longer than the regex code, but it will be clearer what's going on....
[ -1 ]
[ "python", "regex" ]
stackoverflow_0000265814_python_regex.txt
Q: Why the Global Interpreter Lock? What is exactly the function of Python's Global Interpreter Lock? Do other languages that are compiled to bytecode employ a similar mechanism? A: In general, for any thread safety problem you will need to protect your internal data structures with locks. This can be done with var...
Why the Global Interpreter Lock?
What is exactly the function of Python's Global Interpreter Lock? Do other languages that are compiled to bytecode employ a similar mechanism?
[ "In general, for any thread safety problem you will need to protect your internal data structures with locks.\nThis can be done with various levels of granularity.\n\nYou can use fine-grained locking, where every separate structure has its own lock.\nYou can use coarse-grained locking where one lock protects everyt...
[ 72, 34, 20, 12, 7, 2 ]
[]
[]
[ "bytecode", "locking", "multithreading", "python", "scripting" ]
stackoverflow_0000265687_bytecode_locking_multithreading_python_scripting.txt
Q: What is a Ruby equivalent for Python's "zip" builtin? Is there any Ruby equivalent for Python's builtin zip function? If not, what is a concise way of doing the same thing? A bit of context: this came up when I was trying to find a clean way of doing a check involving two arrays. If I had zip, I could have written...
What is a Ruby equivalent for Python's "zip" builtin?
Is there any Ruby equivalent for Python's builtin zip function? If not, what is a concise way of doing the same thing? A bit of context: this came up when I was trying to find a clean way of doing a check involving two arrays. If I had zip, I could have written something like: zip(a, b).all? {|pair| pair[0] === pair[1]...
[ "Ruby has a zip function:\n[1,2].zip([3,4]) => [[1,3],[2,4]]\n\nso your code example is actually:\na.zip(b).all? {|pair| pair[0] === pair[1]}\n\nor perhaps more succinctly:\na.zip(b).all? {|a,b| a === b }\n\n", "Could you not do:\na.eql?(b)\n\nEdited to add an example:\na = %w[a b c]\nb = %w[1 2 3]\nc = ['a', 'b'...
[ 28, 0 ]
[ "This is from the ruby spec:\nit \"returns true if other has the same length and each pair of corresponding elements are eql\" do\n a = [1, 2, 3, 4]\n b = [1, 2, 3, 4]\n a.should eql(b)\n [].should eql([])\nend\n\nSo you should it should work for the example you mentioned.\nIf you're not using integers,...
[ -2 ]
[ "python", "ruby", "translation" ]
stackoverflow_0000263623_python_ruby_translation.txt
Q: using jython and open office 2.4 to convert docs to pdf I completed a python script using pyuno which successfully converted a document/ xls / rtf etc to a pdf. Then I needed to update a mssql database, due to open office currently supporting python 2.3, it's ancientness, lacks support for decent database libs. So...
using jython and open office 2.4 to convert docs to pdf
I completed a python script using pyuno which successfully converted a document/ xls / rtf etc to a pdf. Then I needed to update a mssql database, due to open office currently supporting python 2.3, it's ancientness, lacks support for decent database libs. So I have resorted to using Jython, this way im not burdened do...
[ "And so it goes, according to this guy, you need some oil.... and it works like a charm\nhttp://www.oooforum.org/forum/viewtopic.phtml?p=304263#304263\ninclude this lib C:\\OpenOffice_24\\program\\classes\\unoil.jar\n", "Using Jython is a great idea for this I think. But why could you not use two scripts, one wit...
[ 1, 0 ]
[]
[]
[ "jython", "openoffice.org", "python" ]
stackoverflow_0000264540_jython_openoffice.org_python.txt
Q: How to create a picture with animated aspects programmatically Background I have been asked by a client to create a picture of the world which has animated arrows/rays that come from one part of the world to another. The rays will be randomized, will represent a transaction, will fade out after they happen and ...
How to create a picture with animated aspects programmatically
Background I have been asked by a client to create a picture of the world which has animated arrows/rays that come from one part of the world to another. The rays will be randomized, will represent a transaction, will fade out after they happen and will increase in frequency as time goes on. The rays will start in ...
[ "\nThe client will present this as a slide in a presentation in a windows machine\n\nI think this is the key to your answer. Before going to a 3d implementation and writing all the code in the world to create this feature, you need to look at the presentation software. Chances are, your options will boil down to t...
[ 2, 1, 1 ]
[]
[]
[ "animation", "drawing", "graphics", "image", "python" ]
stackoverflow_0000267660_animation_drawing_graphics_image_python.txt
Q: apache user can not write to .python-eggs I have read that I need to set the PYTHON_EGG_CACHE environment variable, or install the python library as an uncompressed .egg Which do you suggest? A: It totally depends on if you want to make the egg available as a generally available library or just for a single (or ...
apache user can not write to .python-eggs
I have read that I need to set the PYTHON_EGG_CACHE environment variable, or install the python library as an uncompressed .egg Which do you suggest?
[ "It totally depends on if you want to make the egg available as a generally available library or just for a single (or a handful of applications). Are you talking about a Trac installation? If so, there are also a handful of alternatives to make the egg available per instance:\nhttp://trac.edgewall.org/wiki/TracPlu...
[ 1 ]
[]
[]
[ "apache", "egg", "python", "python_egg_cache" ]
stackoverflow_0000268015_apache_egg_python_python_egg_cache.txt
Q: C++ string diff (a la Python's difflib) I'm trying to diff two strings to determine whether or not they solely vary in one numerical subset of the string structure; for example, varies_in_single_number_field('foo7bar', 'foo123bar') # Returns True, because 7 != 123, and there's only one varying # number region betw...
C++ string diff (a la Python's difflib)
I'm trying to diff two strings to determine whether or not they solely vary in one numerical subset of the string structure; for example, varies_in_single_number_field('foo7bar', 'foo123bar') # Returns True, because 7 != 123, and there's only one varying # number region between the two strings. In Python I can use the...
[ "This might work, it at least passes your demonstration test:\nEDIT: I've made some modifications to deal with some string indexing issues. I believe it should be good now.\n#include <iostream>\n#include <string>\n#include <vector>\n#include <algorithm>\n#include <cctype>\n\nbool starts_with(const std::string &s1, ...
[ 2, 1, 1, 0, 0 ]
[]
[]
[ "algorithm", "c++", "diff", "python" ]
stackoverflow_0000269918_algorithm_c++_diff_python.txt
Q: How do I validate xml against a DTD file in Python I need to validate an XML string (and not a file) against a DTD description file. How can that be done in python? A: Another good option is lxml's validation which I find quite pleasant to use. A simple example taken from the lxml site: from StringIO import Str...
How do I validate xml against a DTD file in Python
I need to validate an XML string (and not a file) against a DTD description file. How can that be done in python?
[ "Another good option is lxml's validation which I find quite pleasant to use.\nA simple example taken from the lxml site:\nfrom StringIO import StringIO\n\nfrom lxml import etree\n\ndtd = etree.DTD(StringIO(\"\"\"<!ELEMENT foo EMPTY>\"\"\"))\nroot = etree.XML(\"<foo/>\")\nprint(dtd.validate(root))\n# True\n\nroot =...
[ 32, 7 ]
[]
[]
[ "dtd", "python", "validation", "xml" ]
stackoverflow_0000015798_dtd_python_validation_xml.txt
Q: Using Python to authenticate against raw username, hash, salt in DB created by ASP.NET roles/membership We have a current application where user login credentials are stored in a SQL Server DB. These are, basically, stored as a plain text username, a password hash, and an associated salt for this hash. These were...
Using Python to authenticate against raw username, hash, salt in DB created by ASP.NET roles/membership
We have a current application where user login credentials are stored in a SQL Server DB. These are, basically, stored as a plain text username, a password hash, and an associated salt for this hash. These were all created by built in functions in ASP.NET's membership/role system. Here's a row for a user named 'joe' ...
[ "It appears python is inserting a byte order marker when you convert a UTF16 string to binary. The .NET byte array contains no BOM, so I did some ghetto python that turns the UTF16 into hex, removes the first 4 characters, then decodes it to binary.\nThere may be a better way to rip out the BOM, but this works for...
[ 8, 0 ]
[]
[]
[ "asp.net", "hash", "passwords", "python" ]
stackoverflow_0000269713_asp.net_hash_passwords_python.txt
Q: How can I apply authenticated proxy exceptions to an opener using urllib2? When using urllib2 (and maybe urllib) on windows python seems to magically pick up the authenticated proxy setting applied to InternetExplorer. However, it doesn't seem to check and process the Advance setting "Exceptions" list. Is there a...
How can I apply authenticated proxy exceptions to an opener using urllib2?
When using urllib2 (and maybe urllib) on windows python seems to magically pick up the authenticated proxy setting applied to InternetExplorer. However, it doesn't seem to check and process the Advance setting "Exceptions" list. Is there a way I can get it to process the exceptions list? Or, ignore the IE proxy setti...
[ "By default urllib2 gets the proxy settings from the environment variable, which is why it is using the IE settings. This is very handy, because you don't need to setup authentication yourself.\nYou can't apply exceptions like you want to, the easiest way to do this would be to have two openers and decide which on...
[ 2 ]
[]
[]
[ "proxy", "python", "windows" ]
stackoverflow_0000270983_proxy_python_windows.txt
Q: Replacing multiple occurrences in nested arrays I've got this python dictionary "mydict", containing arrays, here's what it looks like : mydict = dict( one=['foo', 'bar', 'foobar', 'barfoo', 'example'], two=['bar', 'example', 'foobar'], three=['foo', 'example']) i'd like to replace all the occurrenc...
Replacing multiple occurrences in nested arrays
I've got this python dictionary "mydict", containing arrays, here's what it looks like : mydict = dict( one=['foo', 'bar', 'foobar', 'barfoo', 'example'], two=['bar', 'example', 'foobar'], three=['foo', 'example']) i'd like to replace all the occurrences of "example" by "someotherword". While I can alre...
[ "for arr in mydict.values():\n for i, s in enumerate(arr):\n if s == 'example':\n arr[i] = 'someotherword'\n\n", "If you want to leave the original untouched, and just return a new dictionary with the modifications applied, you can use:\nreplacements = {'example' : 'someotherword'}\n\nnewdict...
[ 2, 2, 1 ]
[]
[]
[ "arrays", "dictionary", "python", "replace" ]
stackoverflow_0000268891_arrays_dictionary_python_replace.txt
Q: How to scan a webpage and get images and youtube embeds? I am building a web app where I need to get all the images and any flash videos that are embedded (e.g. youtube) on a given URL. I'm using Python. I've googled, but have not found any good information about this (probably because I don't know what this is ca...
How to scan a webpage and get images and youtube embeds?
I am building a web app where I need to get all the images and any flash videos that are embedded (e.g. youtube) on a given URL. I'm using Python. I've googled, but have not found any good information about this (probably because I don't know what this is called to search for), does anyone have any experience with this...
[ "BeautifulSoup is a great screen-scraping library. Use urllib2 to fetch the page, and BeautifulSoup to parse it apart. Here's a code sample from their docs:\nimport urllib2\nfrom BeautifulSoup import BeautifulSoup\n\npage = urllib2.urlopen(\"http://www.icc-ccs.org/prc/piracyreport.php\")\nsoup = BeautifulSoup(pag...
[ 7 ]
[]
[]
[ "python", "screen_scraping", "web_applications" ]
stackoverflow_0000271855_python_screen_scraping_web_applications.txt
Q: What mime-type should I return for a python string I have a web API that returns python dictionaries or lists as a response that I eval() in python scripts that use the API, for completness I wanted to set a proper content-type but not sure what would be best to use "text/x-python" or maybe "application/python", o...
What mime-type should I return for a python string
I have a web API that returns python dictionaries or lists as a response that I eval() in python scripts that use the API, for completness I wanted to set a proper content-type but not sure what would be best to use "text/x-python" or maybe "application/python", or something else? [edit] I'm also outputting JSON, I'm ...
[ "I doubt there's an established MIME type. Have you considered using JSON instead, it is almost the same as a Python dict, and has a better established culture of tools and techniques.\n", "The authoritative registry is at IANA and, no, there is no standard subtype for Python. So, do not use type like \"applicat...
[ 8, 3 ]
[]
[]
[ "http", "mime_types", "python" ]
stackoverflow_0000269292_http_mime_types_python.txt
Q: "File -X: does not exist" message from ipy.exe in Windows PowerShell If I type this line in an MS-DOS command prompt window: ipy -X:ColorfulConsole IronPython starts up as expected with the colorful console option enabled. However, if I type the same line in Windows PowerShell I get the message: File -X: does...
"File -X: does not exist" message from ipy.exe in Windows PowerShell
If I type this line in an MS-DOS command prompt window: ipy -X:ColorfulConsole IronPython starts up as expected with the colorful console option enabled. However, if I type the same line in Windows PowerShell I get the message: File -X: does not exist Can someone explain what I'm doing wrong?
[ "Try this code:\nipy '-X:ColorfulConsole'\n\nOr whatever quoting mechanism is supported in Windows PowerShell - the shell is splitting your argument. \nTyping\nipy -X: ColorfulConsole\n\nin MS-DOS command prompt window returns the same response:\nFile -X: does not exist.\n" ]
[ 5 ]
[]
[]
[ "ironpython", "powershell", "python" ]
stackoverflow_0000272233_ironpython_powershell_python.txt
Q: User Authentication in Django is there any way of making sure that, one user is logged in only once? I would like to avoid two different persons logging into the system with the same login/password. I guess I could do it myself by checking in the django_session table before logging in the user, but I rather prefer...
User Authentication in Django
is there any way of making sure that, one user is logged in only once? I would like to avoid two different persons logging into the system with the same login/password. I guess I could do it myself by checking in the django_session table before logging in the user, but I rather prefer using the framework, if there is a...
[ "Logged in twice is ambiguous over HTTP. There's no \"disconnecting\" signal that's sent. You can frustrate people if you're not careful.\nIf I shut down my browser and drop the cookies -- accidentally -- I might be prevented from logging in again. \nHow would the server know it was me trying to re-login vs. me ...
[ 5, 4 ]
[]
[]
[ "django", "python" ]
stackoverflow_0000272042_django_python.txt
Q: Python memory debugging with GDB We have a Linux application that makes use of OpenSSL's Python bindings and I suspect it is causing random crashes. Occasionally, we see it crash with the message: Python Fatal Error: GC Object already tracked which would appear to be either a programming error on the part of th...
Python memory debugging with GDB
We have a Linux application that makes use of OpenSSL's Python bindings and I suspect it is causing random crashes. Occasionally, we see it crash with the message: Python Fatal Error: GC Object already tracked which would appear to be either a programming error on the part of the library, or a symptom of memory corr...
[ "Yes, you can do this kind of thing:\n(gdb) print PyRun_SimpleString(\"import traceback; traceback.print_stack()\")\n File \"<string>\", line 1, in <module>\n File \"/var/tmp/foo.py\", line 2, in <module>\n i**2\n File \"<string>\", line 1, in <module>\n$1 = 0\n\nIt should also be possible to use the pystack ...
[ 5, 1, 0, 0 ]
[]
[]
[ "debugging", "linux", "openssl", "python" ]
stackoverflow_0000273043_debugging_linux_openssl_python.txt
Q: Is there a Python library function which attempts to guess the character-encoding of some bytes? I'm writing some mail-processing software in Python that is encountering strange bytes in header fields. I suspect this is just malformed mail; the message itself claims to be us-ascii, so I don't think there is a tru...
Is there a Python library function which attempts to guess the character-encoding of some bytes?
I'm writing some mail-processing software in Python that is encountering strange bytes in header fields. I suspect this is just malformed mail; the message itself claims to be us-ascii, so I don't think there is a true encoding, but I'd like to get out a unicode string approximating the original one without throwing a...
[ "+1 for the chardet module (suggested by @insin).\nIt is not in the standard library, but you can easily install it with the following command:\n$ pip install chardet\n\nExample:\n>>> import chardet\n>>> import urllib\n>>> detect = lambda url: chardet.detect(urllib.urlopen(url).read())\n>>> detect('http://stackover...
[ 27, 15, 1 ]
[]
[]
[ "character_encoding", "email", "invalid_characters", "python" ]
stackoverflow_0000269060_character_encoding_email_invalid_characters_python.txt
Q: Is there a cross-platform way of getting information from Python's OSError? On a simple directory creation operation for example, I can make an OSError like this: (Ubuntu Linux) >>> import os >>> os.mkdir('foo') >>> os.mkdir('foo') Traceback (most recent call last): File "<stdin>", line 1, in <module> OSError: [...
Is there a cross-platform way of getting information from Python's OSError?
On a simple directory creation operation for example, I can make an OSError like this: (Ubuntu Linux) >>> import os >>> os.mkdir('foo') >>> os.mkdir('foo') Traceback (most recent call last): File "<stdin>", line 1, in <module> OSError: [Errno 17] File exists: 'foo' Now I can catch that error like this: >>> import os...
[ "The errno attribute on the error should be the same on all platforms. You will get WindowsError exceptions on Windows, but since this is a subclass of OSError the same \"except OSError:\" block will catch it. Windows does have its own error codes, and these are accessible as .winerror, but the .errno attribute sho...
[ 60 ]
[]
[]
[ "cross_platform", "exception", "python" ]
stackoverflow_0000273698_cross_platform_exception_python.txt
Q: Python's os.execvp equivalent for PHP I've got a PHP command line program running. And I want to connect to a mysql shell straight from PHP. I've done this before in Python using os.execvp But I can't get the same thing to work in PHP. I've tried the following functions: system passthru exec shell_exec example: ...
Python's os.execvp equivalent for PHP
I've got a PHP command line program running. And I want to connect to a mysql shell straight from PHP. I've done this before in Python using os.execvp But I can't get the same thing to work in PHP. I've tried the following functions: system passthru exec shell_exec example: system('mysql -u root -pxxxx db_name'); Bu...
[ "If you want shell commands to be interactive, use:\nsystem(\"mysql -uroot -p db_name > `tty`\");\n\nThat will work for most cases, but will break if you aren't in a terminal.\n", "Give MySQL a script to run that's separate from the PHP script:\nsystem('mysql -u root -pxxxx db_name < script.mysql');\n\n", "In a...
[ 3, 0, 0 ]
[]
[]
[ "command_line_interface", "php", "python", "shell" ]
stackoverflow_0000272826_command_line_interface_php_python_shell.txt
Q: How do I Create an instance of a class in another class in Python I am trying to learn Python and WxPython. I have been a SAS programmer for years. This OOP stuff is slowly coming together but I am still fuzzy on a lot of the concepts. Below is a section of code. I am trying to use a button click to create an ...
How do I Create an instance of a class in another class in Python
I am trying to learn Python and WxPython. I have been a SAS programmer for years. This OOP stuff is slowly coming together but I am still fuzzy on a lot of the concepts. Below is a section of code. I am trying to use a button click to create an instance of another class. Specifically-I have my main panel in one cl...
[ "I don't know wxWidgets, but based on what I know of Python, I'm guessing that you need to change:\nself.Bind(wx.EVT_MENU, self.subPanel(None, -1, 'TEST'),id=1)\n\nto:\nself.Bind(wx.EVT_MENU, subPanel(None, -1, 'TEST'),id=1)\n\n\"subPanel\" is a globally defined class, not a member of \"self\" (which is a mainPanel...
[ 1, 1, 0 ]
[]
[]
[ "oop", "python", "wxpython" ]
stackoverflow_0000273937_oop_python_wxpython.txt
Q: UTF-8 latin-1 conversion issues, python django ok so my issue is i have the string '\222\222\223\225' which is stored as latin-1 in the db. What I get from django (by printing it) is the following string, 'ââââ¢' which I assume is the UTF conversion of it. Now I need to pass the string into a function that does...
UTF-8 latin-1 conversion issues, python django
ok so my issue is i have the string '\222\222\223\225' which is stored as latin-1 in the db. What I get from django (by printing it) is the following string, 'ââââ¢' which I assume is the UTF conversion of it. Now I need to pass the string into a function that does this operation: strdecryptedPassword + chr(ord(c) ...
[ "Your first error 'chr() arg not in range(256)' probably means you have underflowed the value, because chr cannot take negative numbers. I don't know what the encryption algorithm is supposed to do when the inputcounter + 33 is more than the actual character representation, you'll have to check what to do in that c...
[ 4, 2, 0 ]
[]
[]
[ "character_encoding", "django", "python", "utf_8" ]
stackoverflow_0000274361_character_encoding_django_python_utf_8.txt
Q: What is the regular expression for /urlchecker/http://www.google.com I'm writing a url rewrite in django that when a person goes to http://mysite.com/urlchecker/http://www.google.com it sends the url: http://ww.google.com to a view as a string variable. I tried doing: (r'^urlchecker/(?P<url>\w+)/$', 'mysite.mai...
What is the regular expression for /urlchecker/http://www.google.com
I'm writing a url rewrite in django that when a person goes to http://mysite.com/urlchecker/http://www.google.com it sends the url: http://ww.google.com to a view as a string variable. I tried doing: (r'^urlchecker/(?P<url>\w+)/$', 'mysite.main.views.urlchecker'), But that didn't work. Anyone know what I'm doing wr...
[ "Try this instead:\n(r'^urlchecker/(?P<url>.+)$', 'mysite.main.views.urlchecker'),\nThis differs from yours in that:\n\nIt will take anything after 'urlcheck/', not just \"word\" characters.\nIt does not force the url to end in a slash.\n\n", "I just learned something while grazing the Hidden Features of Python t...
[ 2, 0 ]
[]
[]
[ "django", "python", "regex" ]
stackoverflow_0000275109_django_python_regex.txt
Q: How do you get a thumbnail of a movie using IMDbPy? Using IMDbPy it is painfully easy to access movies from the IMDB site: import imdb access = imdb.IMDb() movie = access.get_movie(3242) # random ID print "title: %s year: %s" % (movie['title'], movie['year']) However I see no way to get the picture or thumbnail...
How do you get a thumbnail of a movie using IMDbPy?
Using IMDbPy it is painfully easy to access movies from the IMDB site: import imdb access = imdb.IMDb() movie = access.get_movie(3242) # random ID print "title: %s year: %s" % (movie['title'], movie['year']) However I see no way to get the picture or thumbnail of the movie cover. Suggestions?
[ "Note:\n\nNot every movie has a cover url. (The random ID in your example doesn't.)\nMake sure you're using an up-to-date version of IMDbPy. (IMDb changes, and IMDbPy with it.)\n\n...\nimport imdb\n\naccess = imdb.IMDb()\nmovie = access.get_movie(1132626)\n\nprint \"title: %s year: %s\" % (movie['title'], movie['ye...
[ 10, 2 ]
[]
[]
[ "imdb", "imdbpy", "python" ]
stackoverflow_0000275683_imdb_imdbpy_python.txt
Q: Database change underneath SQLObject I'm starting a web project that likely should be fine with SQLite. I have SQLObject on top of it, but thinking long term here -- if this project should require a more robust (e.g. able to handle high traffic), I will need to have a transition plan ready. My questions: How ea...
Database change underneath SQLObject
I'm starting a web project that likely should be fine with SQLite. I have SQLObject on top of it, but thinking long term here -- if this project should require a more robust (e.g. able to handle high traffic), I will need to have a transition plan ready. My questions: How easy is it to transition from one DB (SQLite...
[ "3) Is quite an interesting question. In general, SQLite is pretty useless for web-based stuff. It scales fairly well for size, but scales terribly for concurrency, and so if you are planning to hit it with a few requests at the same time, you will be in trouble.\nNow your idea in part 3) of the question is to use ...
[ 3, 2, 0 ]
[]
[]
[ "database", "mysql", "python", "sqlite", "sqlobject" ]
stackoverflow_0000275572_database_mysql_python_sqlite_sqlobject.txt
Q: What's the difference between all of the os.popen() methods? I was looking at the Python documentation and saw that there are 4-5 different versions of popen(), e.g. os.popen(), os.popen2(), etc. Apart from the fact that some include stderr while others don't, what are the differences between them and when would ...
What's the difference between all of the os.popen() methods?
I was looking at the Python documentation and saw that there are 4-5 different versions of popen(), e.g. os.popen(), os.popen2(), etc. Apart from the fact that some include stderr while others don't, what are the differences between them and when would you use each one? The documentation didn't really explain it very ...
[ "Jason has it right. To summarize in a way that's easier to see:\n\nos.popen() -> stdout\nos.popen2() -> (stdin, stdout)\nos.popen3() -> (stdin, stdout, stderr)\nos.popen4() -> (stdin, stdout_and_stderr)\n\n", "I would recommend to use the subprocess module which has all the features that these functions have and...
[ 15, 13, 10 ]
[]
[]
[ "popen", "python", "subprocess" ]
stackoverflow_0000275756_popen_python_subprocess.txt
Q: Remote debugging of multi threaded Python Applications How can I do remote debugging of a multi threaded Python application, running on an Embedded Linux based system, from Windows XP or Vista? So far I have only come across PyScripter based remote debugging. How does it perform? A: I've never used it except a f...
Remote debugging of multi threaded Python Applications
How can I do remote debugging of a multi threaded Python application, running on an Embedded Linux based system, from Windows XP or Vista? So far I have only come across PyScripter based remote debugging. How does it perform?
[ "I've never used it except a few quick trial runs, but winpdb sounds like it does just what you want:\n\nWinpdb is a platform independent GPL\n Python debugger with support for\n multiple threads, namespace\n modification, embedded debugging,\n encrypted communication and is up to\n 20 times faster than pdb.\n...
[ 1 ]
[]
[]
[ "python", "remote_debugging" ]
stackoverflow_0000275989_python_remote_debugging.txt
Q: Linking languages I asked a question earlier about which language to use for an AI prototype. The consensus seemed to be that if I want it to be fast, I need to use a language like Java or C++, but that Python / Perl / Ruby would be good for the interface bits. So, this leads me on to another question. How easy i...
Linking languages
I asked a question earlier about which language to use for an AI prototype. The consensus seemed to be that if I want it to be fast, I need to use a language like Java or C++, but that Python / Perl / Ruby would be good for the interface bits. So, this leads me on to another question. How easy is it to link these lang...
[ "Boost.Python provides an easy way to turn C++ code into Python modules. It's rather mature and works well in my experience. \nFor example, the inevitable Hello World...\nchar const* greet()\n{\n return \"hello, world\";\n}\n\ncan be exposed to Python by writing a Boost.Python wrapper:\n#include <boost/python.hpp>...
[ 14, 9, 6, 5, 4, 2, 2, 1, 1 ]
[]
[]
[ "c++", "java", "perl", "python", "ruby" ]
stackoverflow_0000271488_c++_java_perl_python_ruby.txt
Q: How to show the visitor a moved web page AND return a 301 redirect HTTP response status code in Django? When a webpage has moved to a new location, how do I show the moved web page AND return a 301 permanent redirect HTTP response status code in Django? A: from django import http return http.HttpResponseP...
How to show the visitor a moved web page AND return a 301 redirect HTTP response status code in Django?
When a webpage has moved to a new location, how do I show the moved web page AND return a 301 permanent redirect HTTP response status code in Django?
[ " from django import http\n\n return http.HttpResponsePermanentRedirect('/yournewpage.html')\n\nthe browser will get the 301, and go to /yournewpage.html as expected. the other answer is technically correct, in that python is not handling the redirection per se, the browser is. this is what's happening under th...
[ 10, 4 ]
[]
[]
[ "django", "http", "http_headers", "python", "redirect" ]
stackoverflow_0000276286_django_http_http_headers_python_redirect.txt
Q: Converting PDF to HTML with Python How can I convert PDF files to HTML with Python? I was thinking something alone the lines of what Google does (or seems to do) to index PDF files. My final goal is to setup Apache to show the HTML for the PDF files, so anything leading me in that direction would also be appreciat...
Converting PDF to HTML with Python
How can I convert PDF files to HTML with Python? I was thinking something alone the lines of what Google does (or seems to do) to index PDF files. My final goal is to setup Apache to show the HTML for the PDF files, so anything leading me in that direction would also be appreciated.
[ "The poppler package provides a pdf2html utility that you might be able to use. There is also a Python binding to libpoppler.\n" ]
[ 6 ]
[]
[]
[ "apache", "html", "pdf", "python" ]
stackoverflow_0000276434_apache_html_pdf_python.txt
Q: import mechanize module to python script I tried to import mechanize module to my python script like this, from mechanize import Browser But, Google appengine throws HTTP 500 when accessing my script. To make things more clear, Let me give you the snapshot of my package structure, root ....mechanize(where all th...
import mechanize module to python script
I tried to import mechanize module to my python script like this, from mechanize import Browser But, Google appengine throws HTTP 500 when accessing my script. To make things more clear, Let me give you the snapshot of my package structure, root ....mechanize(where all the mechanize related files there) ....main.py ...
[ "The mechanize main page says:\n\nmechanize.Browser is a subclass of mechanize.UserAgentBase, which is, in turn, a subclass of urllib2.OpenerDirector\n\nMy understanding is that urllib2 is one of the sandboxed modules in GAE, with its functionality being replaced by the Google-provided urlfetch. You'd need to re-im...
[ 2, 0 ]
[]
[]
[ "google_app_engine", "python" ]
stackoverflow_0000275980_google_app_engine_python.txt
Q: Django Forms - How to Use Prefix Parameter Say I have a form like: class GeneralForm(forms.Form): field1 = forms.IntegerField(required=False) field2 = forms. IntegerField(required=False) And I want to show it twice on a page within one form tag each time with a different prefix e.g.,: rest of page ... <fo...
Django Forms - How to Use Prefix Parameter
Say I have a form like: class GeneralForm(forms.Form): field1 = forms.IntegerField(required=False) field2 = forms. IntegerField(required=False) And I want to show it twice on a page within one form tag each time with a different prefix e.g.,: rest of page ... <form ..> GeneralForm(data,prefix="form1").as_table...
[ "You process each form as you normally would, ensuring that you create instances which have the same prefixes as those used to generate the form initially.\nHere's a slightly awkward example using the form you've given, as I don't know what the exact use case is:\ndef some_view(request):\n if request.method == '...
[ 39, 6 ]
[]
[]
[ "django", "forms", "html", "python" ]
stackoverflow_0000226510_django_forms_html_python.txt
Q: Syntax error whenever I put Python code inside a Django template I'm trying to do the following in my Django template: {% for embed in embeds %} {% embed2 = embed.replace("&lt;", "<") %} {{embed2}}<br /> {% endfor %} However, I always get an invalid block or some syntax error when I ...
Syntax error whenever I put Python code inside a Django template
I'm trying to do the following in my Django template: {% for embed in embeds %} {% embed2 = embed.replace("&lt;", "<") %} {{embed2}}<br /> {% endfor %} However, I always get an invalid block or some syntax error when I do anything like that (by that I mean {% %} code inside a loop). Pytho...
[ "I am quite sure that Django templates does not support that.\nFor your replace operation I would look into different filters.\nYou really should try to keep as much logic as you can in your views and not in the templates.\n", "Django's template language is deliberately hobbled. When used by non-programming desig...
[ 8, 7, 4, 3, 3 ]
[]
[]
[ "django", "django_templates", "python", "templates" ]
stackoverflow_0000276345_django_django_templates_python_templates.txt
Q: How to import a python file in python script more than once Is it possible to import a python file more than once in a python script because i run a loop back to my driver file in a function by using the import command but it only works once? thanks edit: Resolved myself thanks A: You most probably should not us...
How to import a python file in python script more than once
Is it possible to import a python file more than once in a python script because i run a loop back to my driver file in a function by using the import command but it only works once? thanks edit: Resolved myself thanks
[ "You most probably should not use import for what you are trying to do.\nWithout further information I can only guess, but you should move the code in the module you import from the top level into a function, do the import once and than simply call the function from you loop.\n", "The easiest answer is to put the...
[ 7, 4, 1, 1 ]
[]
[]
[ "python" ]
stackoverflow_0000276679_python.txt
Q: Dictionary or If statements, Jython I am writing a script at the moment that will grab certain information from HTML using dom4j. Since Python/Jython does not have a native switch statement I decided to use a whole bunch of if statements that call the appropriate method, like below: if type == 'extractTitle': ...
Dictionary or If statements, Jython
I am writing a script at the moment that will grab certain information from HTML using dom4j. Since Python/Jython does not have a native switch statement I decided to use a whole bunch of if statements that call the appropriate method, like below: if type == 'extractTitle': extractTitle(dom) if type == 'extractMeta...
[ "To avoid specifying the tag and handler in the dict, you could just use a handler class with methods named to match the type. Eg\nclass MyHandler(object):\n def handle_extractTitle(self, dom):\n # do something\n\n def handle_extractMetaTags(self, dom):\n # do something\n\n def handle(self,...
[ 14, 2, 1, 1, 1 ]
[]
[]
[ "jython", "python", "switch_statement" ]
stackoverflow_0000277965_jython_python_switch_statement.txt
Q: Can anyone recommend a decent FOSS PDF generator for Python? I need a basic pdf generator that'll let me toss some images and text into a pdf file. The ability to have some basic drawing commands (lines and so forth) would also be a plus. I did read through this question, but I really don't need a report generat...
Can anyone recommend a decent FOSS PDF generator for Python?
I need a basic pdf generator that'll let me toss some images and text into a pdf file. The ability to have some basic drawing commands (lines and so forth) would also be a plus. I did read through this question, but I really don't need a report generator and most of the responses there seemed like real overkill for w...
[ "For one of my projects, I have tested and/or implemented probably six or seven different methods of going from an image to a PDF in the last six months. Ultimately I ended up coming back to ReportLab (which I had initially avoided for reasons similar to those you described) because all of the others had glaring l...
[ 5, 1, 0 ]
[]
[]
[ "pdf_generation", "python" ]
stackoverflow_0000279129_pdf_generation_python.txt
Q: Python: How do I generate a keypress? I am opening a process (with os.popen() ) that, for some commands, detects certain keypresses (e.g. ESC - not the character, the key). Is there a way to send keypress events to the process? A: You probably want something like Pexpect. It's been around a while, and there ma...
Python: How do I generate a keypress?
I am opening a process (with os.popen() ) that, for some commands, detects certain keypresses (e.g. ESC - not the character, the key). Is there a way to send keypress events to the process?
[ "You probably want something like Pexpect. It's been around a while, and there may be a better alternative, now, but it will let you do what you want. \nAs far as I know, there is no easy way to do that kind of thing with os.popen or the commands in the subprocess module.\n", "The obvious way would be to start ...
[ 1, 0, 0 ]
[]
[]
[ "keypress", "popen", "python" ]
stackoverflow_0000279434_keypress_popen_python.txt
Q: making a python GUI How do I make a GUI for my python program because now it only runs in Idle and a command line and what software packages can I use and where can I get them? Thanks. A: The GuiProgramming page in the Python wiki has a good overview of the different options you have. A: The two most interesti...
making a python GUI
How do I make a GUI for my python program because now it only runs in Idle and a command line and what software packages can I use and where can I get them? Thanks.
[ "The GuiProgramming page in the Python wiki has a good overview of the different options you have.\n", "The two most interesting toolkits for use with python are probably PyQt4 or wxPython.\nThey are both open source, cross platform and well documented, and they both have gui builders available (Qt Designer and w...
[ 5, 5, 0, 0 ]
[]
[]
[ "python", "user_interface" ]
stackoverflow_0000279707_python_user_interface.txt
Q: How can one get the set of all classes with reverse relationships for a model in Django? Given: from django.db import models class Food(models.Model): """Food, by name.""" name = models.CharField(max_length=25) class Cat(models.Model): """A cat eats one type of food""" food = models.ForeignKe...
How can one get the set of all classes with reverse relationships for a model in Django?
Given: from django.db import models class Food(models.Model): """Food, by name.""" name = models.CharField(max_length=25) class Cat(models.Model): """A cat eats one type of food""" food = models.ForeignKey(Food) class Cow(models.Model): """A cow eats one type of food""" food = models.Fo...
[ "Some digging in the source code revealed:\ndjango/db/models/options.py:\ndef get_all_related_objects(self, local_only=False):\n\ndef get_all_related_many_to_many_objects(self, local_only=False)\n\nAnd, using these functions on the models from above, you hypothetically get:\n>>> Food._meta.get_all_related_objects()...
[ 14, 7 ]
[]
[]
[ "django", "django_models", "django_orm", "python" ]
stackoverflow_0000279782_django_django_models_django_orm_python.txt
Q: Python 2.5 dictionary 2 key sort I have a dictionary of 200,000 items (the keys are strings and the values are integers). What is the best/most pythonic way to print the items sorted by descending value then ascending key (i.e. a 2 key sort)? a={ 'keyC':1, 'keyB':2, 'keyA':1 } b = a.items() b.sort( key=lambda a:a...
Python 2.5 dictionary 2 key sort
I have a dictionary of 200,000 items (the keys are strings and the values are integers). What is the best/most pythonic way to print the items sorted by descending value then ascending key (i.e. a 2 key sort)? a={ 'keyC':1, 'keyB':2, 'keyA':1 } b = a.items() b.sort( key=lambda a:a[0]) b.sort( key=lambda a:a[1], revers...
[ "You can't sort dictionaries. You have to sort the list of items.\nPrevious versions were wrong. When you have a numeric value, it's easy to sort in reverse order. These will do that. But this isn't general. This only works because the value is numeric.\na = { 'key':1, 'another':2, 'key2':1 }\n\nb= a.items()\...
[ 18, 6, 1, 0, 0, 0 ]
[]
[]
[ "python" ]
stackoverflow_0000157424_python.txt
Q: When is "self" required? I have been using classes for only a short while and when I write a method, I make all variables reference self, e.g. self.foo. However, I'm looking through the wxPython in Action book and notice that "self" isn't used all the time. For example: import wx class TextFrame(wx.Frame): d...
When is "self" required?
I have been using classes for only a short while and when I write a method, I make all variables reference self, e.g. self.foo. However, I'm looking through the wxPython in Action book and notice that "self" isn't used all the time. For example: import wx class TextFrame(wx.Frame): def __init__(self): wx....
[ "You use self.attribute to reference an attribute of your current instance.\nYou use wx.Frame.__init__() to reference a method of the parent class.\nYou don't use self if you only reference a local name (variable) of the method (function) you are in.\nThese are not \"rules of thumb,\" because there are no exception...
[ 9, 4, 0 ]
[]
[]
[ "python", "wxpython" ]
stackoverflow_0000280324_python_wxpython.txt
Q: email body from a parsed email object in jython I have an object. fp = open(self.currentEmailPath, "rb") p = email.Parser.Parser() self._currentEmailParsedInstance= p.parse(fp) fp.close() self.currentEmailParsedInstance, from this object I want to get the body of an email, text only no HTML.... Ho...
email body from a parsed email object in jython
I have an object. fp = open(self.currentEmailPath, "rb") p = email.Parser.Parser() self._currentEmailParsedInstance= p.parse(fp) fp.close() self.currentEmailParsedInstance, from this object I want to get the body of an email, text only no HTML.... How do I do it? something like this? newmsg=...
[ "This will get you the contents of the message\nself.currentEmailParsedInstance.get_payload()\n\nAs for the text only part you will have to strip HTML on your own, for example using BeautifulSoup.\nCheck this link for more information about the Message class the Parser returns. If you mean getting the text part of ...
[ 4, 0 ]
[]
[]
[ "email", "jython", "parsing", "python" ]
stackoverflow_0000280207_email_jython_parsing_python.txt
Q: Calculate poisson probability percentage When you use the POISSON function in Excel (or in OpenOffice Calc), it takes two arguments: an integer an 'average' number and returns a float. In Python (I tried RandomArray and NumPy) it returns an array of random poisson numbers. What I really want is the percentage th...
Calculate poisson probability percentage
When you use the POISSON function in Excel (or in OpenOffice Calc), it takes two arguments: an integer an 'average' number and returns a float. In Python (I tried RandomArray and NumPy) it returns an array of random poisson numbers. What I really want is the percentage that this event will occur (it is a constant num...
[ "scipy has what you want\n>>> scipy.stats.distributions\n<module 'scipy.stats.distributions' from '/home/coventry/lib/python2.5/site-packages/scipy/stats/distributions.pyc'>\n>>> scipy.stats.distributions.poisson.pmf(6, 2.6)\narray(0.031867055625524499)\n\nIt's worth noting that it's pretty easy to calculate by han...
[ 26, 14, 1 ]
[]
[]
[ "poisson", "python", "statistics" ]
stackoverflow_0000280797_poisson_python_statistics.txt
Q: Python - sort a list of nested lists I have input consisting of a list of nested lists like this: l = [[[[[39]]]], [1, 2, 3], [4, [5, 3], 1], [[[[8, 9], 10], 11], 12]] I want to sort this list based on the sum of all the numbers in the nested lists... so, the values I want to sort by of l would look like this: [3...
Python - sort a list of nested lists
I have input consisting of a list of nested lists like this: l = [[[[[39]]]], [1, 2, 3], [4, [5, 3], 1], [[[[8, 9], 10], 11], 12]] I want to sort this list based on the sum of all the numbers in the nested lists... so, the values I want to sort by of l would look like this: [39, 6, 13, 50] Then I want to sort based o...
[ "A slight simplification and generalization to the answers provided so far, using a recent addition to python's syntax:\n>>> l = [[[[[39]]]], [1, 2, 3], [4, [5, 3], 1], [[[[8, 9], 10], 11], 12]]\n>>> def asum(t): return sum(map(asum, t)) if hasattr(t, '__iter__') else t\n...\n>>> sorted(l, key=asum)\n[[1, 2, 3], [4...
[ 16, 12, 5 ]
[]
[]
[ "list", "nested_lists", "python", "sorting" ]
stackoverflow_0000280222_list_nested_lists_python_sorting.txt
Q: Is there a more Pythonic way to merge two HTML header rows with colspans? I am using BeautifulSoup in Python to parse some HTML. One of the problems I am dealing with is that I have situations where the colspans are different across header rows. (Header rows are the rows that need to be combined to get the colum...
Is there a more Pythonic way to merge two HTML header rows with colspans?
I am using BeautifulSoup in Python to parse some HTML. One of the problems I am dealing with is that I have situations where the colspans are different across header rows. (Header rows are the rows that need to be combined to get the column headings in my jargon) That is one column may span a number of columns above ...
[ "Here is a modified version of your algorithm. zip is used to iterate over short lengths and headers and a class object is used to count and iterate the long items, as well as combine the headers. while is more appropriate for the inner loop.\n(forgive the too short names).\nclass collector(object):\n def __init...
[ 3, 2, 1, 0, 0 ]
[]
[]
[ "beautifulsoup", "python" ]
stackoverflow_0000277187_beautifulsoup_python.txt
Q: How to use Popen in Windows to invoke an external .py script and wait for its completion Have you ever tried this feedback calling an external zip.py script to work? My CGITB does not show any error messages. It simply did not invoke external .py script to work. It simply skipped over to gush. I should be gratef...
How to use Popen in Windows to invoke an external .py script and wait for its completion
Have you ever tried this feedback calling an external zip.py script to work? My CGITB does not show any error messages. It simply did not invoke external .py script to work. It simply skipped over to gush. I should be grateful if you can assist me in making this zip.py callable in feedback.py. Regards. David #*****...
[ "\nzip() is a built-in function in Python. Therefore it is a bad practice to use zip as a variable name. zip_ can be used instead of.\nexecfile() function reads and executes a Python script.\nIt is probably that you actually need just import zip_ in feedback.py instead of execfile().\n\n", "Yay ArcGIS.\nJust to c...
[ 1, 0 ]
[]
[]
[ "python", "windows" ]
stackoverflow_0000283894_python_windows.txt
Q: Testing Web Services Consumer Here are some tools that I have found to test web services consumers: http://www.soapui.org/ https://wsunit.dev.java.net/ Are there any others? I would prefer testing frameworks that are written in Java or Python. A: I have used soapui by a maven plugin. It can create junit-linke re...
Testing Web Services Consumer
Here are some tools that I have found to test web services consumers: http://www.soapui.org/ https://wsunit.dev.java.net/ Are there any others? I would prefer testing frameworks that are written in Java or Python.
[ "I have used soapui by a maven plugin. It can create junit-linke reports to be run and analysed like unit tests. This can be easily integrated in continious build, also with the free distribution of soapui.\n", "I've used Web Service Studio.\n\nWeb Service Studio is a tool to invoke web methods interactively. Th...
[ 1, 1, 0, 0 ]
[]
[]
[ "integration_testing", "java", "python", "testing", "web_services" ]
stackoverflow_0000273060_integration_testing_java_python_testing_web_services.txt
Q: Is it possible to use wxPython inside IronPython? When my IronPython program gets to the line import wx I get this message: A first chance exception of type 'IronPython.Runtime.Exceptions.PythonImportErrorException' occurred in IronPython.dll Additional information: No module named _core_ although I do have t...
Is it possible to use wxPython inside IronPython?
When my IronPython program gets to the line import wx I get this message: A first chance exception of type 'IronPython.Runtime.Exceptions.PythonImportErrorException' occurred in IronPython.dll Additional information: No module named _core_ although I do have the file wx\_core_.pyd. Also, before attempting the impo...
[ "No, this won't work. Wx bindings (like most other \"python bindings\") are actually compiled against CPython.\nIn this regards they are not just packages on sys.path to be found, as you have tried. They actually depend on CPython itself. This rather dry document explains the process.\nNote: There was a mission by ...
[ 8, 5 ]
[]
[]
[ "ironpython", "python", "wxpython" ]
stackoverflow_0000283447_ironpython_python_wxpython.txt
Q: How can I download python .egg files, when behind a firewall I'm going to try out turbogears however I'm on windows vista. however due to firewall proxy problems, it seems i can't download .egg files which is required for setup turbogears to get installed in my windows environment. I do have a bootable, or I can m...
How can I download python .egg files, when behind a firewall
I'm going to try out turbogears however I'm on windows vista. however due to firewall proxy problems, it seems i can't download .egg files which is required for setup turbogears to get installed in my windows environment. I do have a bootable, or I can make a bootable Linux USB, I can try cygwin but I am not sure where...
[ "Perhaps the problem is not with the firewall per se, but with the fact that you need to use an HTTP proxy. If you do need to use a proxy, try setting the http_proxy environment variable. It might be that your firewall uses NTLM proxy authentication (which Python doesn't support); in this case, try setting up an AP...
[ 4, 3, 2, 1, 0 ]
[]
[]
[ "cygwin", "linux", "python", "turbogears", "windows" ]
stackoverflow_0000282907_cygwin_linux_python_turbogears_windows.txt
Q: XPath search with ElementTree New to xml. Looking for XPath to search a xml file with python ElementTree format <root> <child>One</child> <child>Two</child> <child>Three</child> </root> to do search for child with "Two" and return true/false if it was started off like from elementtree import ElementTree root = ...
XPath search with ElementTree
New to xml. Looking for XPath to search a xml file with python ElementTree format <root> <child>One</child> <child>Two</child> <child>Three</child> </root> to do search for child with "Two" and return true/false if it was started off like from elementtree import ElementTree root = ElementTree.parse(open(PathFile)).g...
[ "I've been playing with ElementTree lately, lets see..\n>>> from xml.etree import ElementTree\n>>> help(ElementTree.ElementPath)\n>>> root = ElementTree.fromstring(\"\"\"\n<root><child>One</child><child>Two</child><child>Three</child></root>\n\"\"\")\n>>> ElementTree.ElementPath.findall(root, \"child\")\n[<Element ...
[ 1, 1 ]
[]
[]
[ "python", "xml", "xpath" ]
stackoverflow_0000238697_python_xml_xpath.txt
Q: Python module to extract probable dates from strings? I'm looking for a Python module that would take an arbitrary block of text, search it for something that looks like a date string, and build a DateTime object out of it. Something like Date::Extract in Perl Thank you in advance. A: The nearest equivalent is ...
Python module to extract probable dates from strings?
I'm looking for a Python module that would take an arbitrary block of text, search it for something that looks like a date string, and build a DateTime object out of it. Something like Date::Extract in Perl Thank you in advance.
[ "The nearest equivalent is probably the dateutil module. Usage is:\n>>> from dateutil.parser import parse\n>>> parse(\"Wed, Nov 12\")\ndatetime.datetime(2008, 11, 12, 0, 0)\n\nUsing the fuzzy parameter should ignore extraneous text. ie\n>>> parse(\"the date was the 1st of December 2006 2:30pm\", fuzzy=True)\ndate...
[ 12, 5 ]
[]
[]
[ "python" ]
stackoverflow_0000285408_python.txt
Q: With what kind of IDE (if any) you build python GUI projects? Is there any IDE (like VS) with drag and drop support for building python GUI, connecting to dbs etc? Eventhough I am an emacs guy, I find it much easier to create GUI with VS. A: The short answer is "no". There is not a swiss-army-knife like IDE tha...
With what kind of IDE (if any) you build python GUI projects?
Is there any IDE (like VS) with drag and drop support for building python GUI, connecting to dbs etc? Eventhough I am an emacs guy, I find it much easier to create GUI with VS.
[ "The short answer is \"no\". There is not a swiss-army-knife like IDE that is both a full-featured Python code-editor and a full-featured WYSIWYG GUI editor. However, there are several stand-alone tools that make creating a GUI easier and there are a myriad of code editors, so if you can handle having two windows...
[ 4, 4, 4, 2, 2, 1, 1, 1, 0 ]
[]
[]
[ "ide", "python", "user_interface" ]
stackoverflow_0000285132_ide_python_user_interface.txt
Q: Using Regex Plus Function in Python to Encode and Substitute I'm trying to substitute something in a string in python and am having some trouble. Here's what I'd like to do. For a given comment in my posting: "here are some great sites that i will do cool things with! https://stackoverflow.com/it's a pig & http://...
Using Regex Plus Function in Python to Encode and Substitute
I'm trying to substitute something in a string in python and am having some trouble. Here's what I'd like to do. For a given comment in my posting: "here are some great sites that i will do cool things with! https://stackoverflow.com/it's a pig & http://google.com" I'd like to use python to make the strings like this:...
[ "I think you want url_pattern.sub(getExpandedURL, text).\n\nre.sub(pattern, repl, string, count=0)\nReturn the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in string by the replacement repl. repl can be either a string or a callable; if a callable, it's passed the match obje...
[ 3 ]
[]
[]
[ "python", "regex" ]
stackoverflow_0000285931_python_regex.txt
Q: Decomposing HTML to link text and target Given an HTML link like <a href="urltxt" class="someclass" close="true">texttxt</a> how can I isolate the url and the text? Updates I'm using Beautiful Soup, and am unable to figure out how to do that. I did soup = BeautifulSoup.BeautifulSoup(urllib.urlopen(url)) links...
Decomposing HTML to link text and target
Given an HTML link like <a href="urltxt" class="someclass" close="true">texttxt</a> how can I isolate the url and the text? Updates I'm using Beautiful Soup, and am unable to figure out how to do that. I did soup = BeautifulSoup.BeautifulSoup(urllib.urlopen(url)) links = soup.findAll('a') for link in links: p...
[ "Use Beautiful Soup. Doing it yourself is harder than it looks, you'll be better off using a tried and tested module.\nEDIT:\nI think you want:\nsoup = BeautifulSoup.BeautifulSoup(urllib.urlopen(url).read())\n\nBy the way, it's a bad idea to try opening the URL there, as if it goes wrong it could get ugly.\nEDIT 2...
[ 8, 6, 4, 3 ]
[]
[]
[ "beautifulsoup", "html", "python", "regex" ]
stackoverflow_0000285938_beautifulsoup_html_python_regex.txt
Q: How to split a web address So I'm using python to do some parsing of web pages and I want to split the full web address into two parts. Say I have the address http://www.stackoverflow.com/questions/ask. I would need the protocol and domain (e.g. http://www.stackoverflow.com) and the path (e.g. /questions/ask). I f...
How to split a web address
So I'm using python to do some parsing of web pages and I want to split the full web address into two parts. Say I have the address http://www.stackoverflow.com/questions/ask. I would need the protocol and domain (e.g. http://www.stackoverflow.com) and the path (e.g. /questions/ask). I figured this might be solved by s...
[ "Dan is right: urlparse is your friend:\n>>> from urlparse import urlparse\n>>>\n>>> parts = urlparse(\"http://www.stackoverflow.com/questions/ask\")\n>>> parts.scheme + \"://\" + parts.netloc\n'http://www.stackoverflow.com'\n>>> parts.path\n'/questions/ask'\n\nNote: In Python 3 it's from urllib.parse import urlpar...
[ 13, 7 ]
[ "import re\nurl = \"http://stackoverflow.com/questions/ask\"\nprotocol, domain = re.match(r\"(http://[^/]*)(.*)\", url).groups()\n\n" ]
[ -1 ]
[ "python", "split", "string", "url" ]
stackoverflow_0000286150_python_split_string_url.txt
Q: Python + Leopard + Fink + Mac Ports + Python.org + Idiot = broken Python - fresh start? I have been enjoying learning the basics of python, but before I started reading things I tried to install various python versions and modules clumsily. Now that I have some ideas of what I want to do and how to do it I'm findi...
Python + Leopard + Fink + Mac Ports + Python.org + Idiot = broken Python - fresh start?
I have been enjoying learning the basics of python, but before I started reading things I tried to install various python versions and modules clumsily. Now that I have some ideas of what I want to do and how to do it I'm finding that various aspects are broken. For instance, 2.6 IDLE won't launch, and when I try to im...
[ "I had this problem so much when I first got my Mac. The best solution I found was to delete everything I'd installed and just go with the pythonmac.org version of Python (2.6). I then installed setuptools from the same site, and then used easy_install to install every other package.\nOh, and I got the GNU C Compil...
[ 4, 1, 1 ]
[]
[]
[ "python", "python_2.6", "python_install" ]
stackoverflow_0000242065_python_python_2.6_python_install.txt
Q: Why would an "command not recognized" error occur only when a window is populated? My record sheet app has a menu option for creating a new, blank record sheet. When I open a sheet window, I can open new windows without a problem, using subprocess.Popen() to do it. However, under Windows (I haven't tested it on ot...
Why would an "command not recognized" error occur only when a window is populated?
My record sheet app has a menu option for creating a new, blank record sheet. When I open a sheet window, I can open new windows without a problem, using subprocess.Popen() to do it. However, under Windows (I haven't tested it on other OSes yet), if I open a new window then use the "open file" dialog to populate the fi...
[ "From the error message, it looks like you need to pass the full path of \"foo.py\" to your Popen call. Normally just having \"foo.py\" will search in your current working directory, but this can be a bit unpredictable on Windows, I have found. Yours seems to be jumping around with the open file dialog.\nSecondly, ...
[ 4, 0 ]
[]
[]
[ "python", "windows" ]
stackoverflow_0000283431_python_windows.txt
Q: Best video manipulation library for Python? I'd like to include some simple video editing functionality for the Python application I'm writing and googling comes up with: pymedia pyglet (using the media module) gst-python Requirements: Small footprint. I'm already using wxPython (just because), which bloats up ...
Best video manipulation library for Python?
I'd like to include some simple video editing functionality for the Python application I'm writing and googling comes up with: pymedia pyglet (using the media module) gst-python Requirements: Small footprint. I'm already using wxPython (just because), which bloats up the final EXE file pretty easily so preferably wh...
[ "I would recommend that you look again at gst-python! It is not coupled with pyGTK. You can use it completely separately, with no dependencies on either the Python bindings or the C libraries of GTK. I've written several command-line utilities that use gst-python and not GTK.\nIt's true that the gst-python docs ...
[ 13, 9, 6, 3 ]
[]
[]
[ "editor", "python", "video" ]
stackoverflow_0000220866_editor_python_video.txt
Q: Accounting for a changing path In relation to another question, how do you account for paths that may change? For example, if a program is calling a file in the same directory as the program, you can simply use the path ".\foo.py" in *nix. However, apparently Windows likes to have the path hard-coded, e.g. "C:\Pyt...
Accounting for a changing path
In relation to another question, how do you account for paths that may change? For example, if a program is calling a file in the same directory as the program, you can simply use the path ".\foo.py" in *nix. However, apparently Windows likes to have the path hard-coded, e.g. "C:\Python_project\foo.py". What happens if...
[ "Simple answer: You work out the absolute path based on the environment.\nWhat you really need is a few pointers. There are various bits of runtime and environment information that you can glean from various places in the standard library (and they certainly help me when I want to deploy an application on windows)....
[ 5, 0, 0 ]
[ "I figured out by using os.getcwd(). I also learned about using os.path.join to automatically determine the correct path format based on the OS. Here's the code:\ndef openNewRecord(self, event): # wxGlade: CharSheet.<event_handler>\n \"\"\"Create a new, blank record sheet.\"\"\"\n path = os.getcwd()\n subp...
[ -1 ]
[ "file", "path", "python" ]
stackoverflow_0000286486_file_path_python.txt
Q: Parsing C++ preprocessor #if statements I have a C/C++ source file with conditional compilation. Before I ship it to customers I want to remove most of the #if statements, so that my customers do not need to worry about passing the right -D options to the compiler. I have this implemented and working in Python, b...
Parsing C++ preprocessor #if statements
I have a C/C++ source file with conditional compilation. Before I ship it to customers I want to remove most of the #if statements, so that my customers do not need to worry about passing the right -D options to the compiler. I have this implemented and working in Python, but it only handles #ifdef and #ifndef stateme...
[ "As KeithB said, you could just let the preprocessor do this for you. \nBut if you're not trying to hide things (ie., there may be stuff in the conditionally compiled code that you don't want or aren't permitted to give to some one else) a much simpler option would be to just put the proper #define directives in a ...
[ 14, 12, 8, 4, 0 ]
[]
[]
[ "c", "c++", "c_preprocessor", "parsing", "python" ]
stackoverflow_0000287379_c_c++_c_preprocessor_parsing_python.txt
Q: Python program start Should I start a Python program with: if__name__ == '__main__': some code... And if so, why? I saw it many times but don't have a clue about it. A: If your program is usable as a library but you also have a main program (e.g. to test the library), that construct lets others import the file ...
Python program start
Should I start a Python program with: if__name__ == '__main__': some code... And if so, why? I saw it many times but don't have a clue about it.
[ "If your program is usable as a library but you also have a main program (e.g. to test the library), that construct lets others import the file as a library and not run your main program. If your program is named foo.py and you do \"import foo\" from another python file, __name__ evaluates to 'foo', but if you run ...
[ 30, 25, 22, 3 ]
[]
[]
[ "python" ]
stackoverflow_0000287204_python.txt
Q: What's the best way to transfer data from python to another application in windows? I'm developing an application with a team in .Net (C++) and provide a COM interface to interact with python and other languages. What we've found is that pushing data through COM turns out to be pretty slow. I've considered several...
What's the best way to transfer data from python to another application in windows?
I'm developing an application with a team in .Net (C++) and provide a COM interface to interact with python and other languages. What we've found is that pushing data through COM turns out to be pretty slow. I've considered several alternatives: dumping data to a file and sending the file path through com Shared Memor...
[ "Staying within the Windows interprocess communication mechanisms, we had positive experience using windows named pipes. \nUsing Windows overlapped IO and the win32pipe module from pywin32.\nYou can learn much about win32 and python in the Python Programming On Win32 book.\nThe sending part simply writes to r'\\\\...
[ 9, 2, 2, 0 ]
[]
[]
[ "com", "data_transfer", "python", "winapi" ]
stackoverflow_0000286614_com_data_transfer_python_winapi.txt
Q: Dictonaries and Lambda inside a class? How can i do something like this: class Foo(): do_stuff = { "A" : lambda x: self.do_A(x), "B" : lambda x: self.do_B(x) } def __init__(self): print "hi" def run(self): muh = ['A', 'B', 'A'] for each in muh: self.do_stuff[e...
Dictonaries and Lambda inside a class?
How can i do something like this: class Foo(): do_stuff = { "A" : lambda x: self.do_A(x), "B" : lambda x: self.do_B(x) } def __init__(self): print "hi" def run(self): muh = ['A', 'B', 'A'] for each in muh: self.do_stuff[each](each) def do_A(self, moo): print "...
[ "do_stuff is not an instance variable in your example. It's more like a static variable. You need to define do_stuff within a method (e.g., the init method) where you have a reference to self in order to make it an instance variable. I hope this example clarifies things for you:\nclass Foo:\n\n def __init__(self):...
[ 7 ]
[]
[]
[ "lambda", "python" ]
stackoverflow_0000287823_lambda_python.txt
Q: What Python tools can I use to interface with a website's API? Let's say I wanted to make a python script interface with a site like Twitter. What would I use to do that? I'm used to using curl/wget from bash, but Python seems to be much nicer to use. What's the equivalent? (This isn't Python run from a webserver,...
What Python tools can I use to interface with a website's API?
Let's say I wanted to make a python script interface with a site like Twitter. What would I use to do that? I'm used to using curl/wget from bash, but Python seems to be much nicer to use. What's the equivalent? (This isn't Python run from a webserver, but run locally via the command line)
[ "For something like Twitter, you'll save yourself a ton of time by not reinventing the wheel. Try a library like python-twitter. This way, you can write your script, or even a full fledged application, that interfaces with Twitter, and you don't have to care about the implementation details.\nIf you want to roll yo...
[ 8, 5, 4, 2, 0 ]
[]
[]
[ "python", "twitter", "web_services" ]
stackoverflow_0000285226_python_twitter_web_services.txt
Q: In Python, how can I efficiently manage references between script files? I have a fair number of Python scripts that contain reusable code that are used and referenced by other Python scripts. However, these scripts tend to be scattered across different directories and I find it to be somewhat tedious to have to i...
In Python, how can I efficiently manage references between script files?
I have a fair number of Python scripts that contain reusable code that are used and referenced by other Python scripts. However, these scripts tend to be scattered across different directories and I find it to be somewhat tedious to have to include (most often multiple) calls to sys.path.append on my top-level scripts....
[ "The simple answer is to put your reusable code in your site-packages directory, which is in your sys.path.\nYou can also extend the search path by adding .pth files somewhere in your path.\nSee https://docs.python.org/2/install/#modifying-python-s-search-path for more details\nOh, and python 2.6/3.0 adds support f...
[ 4, 3, 1, 1, 1, 0 ]
[]
[]
[ "metadata", "python", "scripting" ]
stackoverflow_0000287845_metadata_python_scripting.txt
Q: receiving data over a python socket I'm making a program that retrieves decently large amounts of data through a python socket and then immediately disconnects when the information is finished sending. But I'm not sure how to do this All the examples on the web are of tcp clients where they have while 1: data =...
receiving data over a python socket
I'm making a program that retrieves decently large amounts of data through a python socket and then immediately disconnects when the information is finished sending. But I'm not sure how to do this All the examples on the web are of tcp clients where they have while 1: data = sock.recv(1024) But this creates a look...
[ "You've probably missed a very important part of those examples - the lines that follow the \"recv()\" call:\nwhile 1:\n data = conn.recv(1024)\n if not data: break\n conn.send(data)\nconn.close()\n\n" ]
[ 21 ]
[]
[]
[ "python", "sockets" ]
stackoverflow_0000289035_python_sockets.txt
Q: Why does Excel macro work in Excel but not when called from Python? I have an Excel macro that deletes a sheet, copies another sheet and renames it to the same name of the deleted sheet. This works fine when run from Excel, but when I run it by calling the macro from Python I get the following error message: Run-...
Why does Excel macro work in Excel but not when called from Python?
I have an Excel macro that deletes a sheet, copies another sheet and renames it to the same name of the deleted sheet. This works fine when run from Excel, but when I run it by calling the macro from Python I get the following error message: Run-time error '1004' - Cannot rename a sheet to the same name as another s...
[ "I ran the code inside Excel VBA.\nI am guessing that the following line is failing.\n\nSheets(\"CC\").Delete\n\nAnd that is the reason, you can't give the new sheet same name as existing (non-deleted) sheet. \nPut Application.DisplayAlerts = False before Sheets(\"CC\").Delete and Application.DisplayAlerts = ...
[ 2, 1 ]
[]
[]
[ "excel", "python", "pywin32", "vba" ]
stackoverflow_0000289187_excel_python_pywin32_vba.txt
Q: How do I use my icons when compiling my python program with py2exe? I don't know what commands to enter into the setup.py file when compiling a python program to use my icons. Can anyone help me? Thanks in advance. A: from distutils.core import setup import py2exe setup( windows=[{"script": 'app.py', "i...
How do I use my icons when compiling my python program with py2exe?
I don't know what commands to enter into the setup.py file when compiling a python program to use my icons. Can anyone help me? Thanks in advance.
[ "from distutils.core import setup\nimport py2exe\nsetup(\n windows=[{\"script\": 'app.py', \"icon_resources\": [(1, \"icon.ico\")]}],\n options={\"py2exe\":{\"unbuffered\": True,\n \"optimize\": 2,\n \"bundle_files\" : 1,\n \"dist_di...
[ 6, 4 ]
[]
[]
[ "py2exe", "python" ]
stackoverflow_0000289668_py2exe_python.txt
Q: Using python to build web applications This is a follow-up to two questions I asked a week or so back. The upshot of those was that I was building a prototype of an AI-based application for the web, and I wondered what language(s) to use. The conclusion seemed to be that I should go for something like python and t...
Using python to build web applications
This is a follow-up to two questions I asked a week or so back. The upshot of those was that I was building a prototype of an AI-based application for the web, and I wondered what language(s) to use. The conclusion seemed to be that I should go for something like python and then convert any critical bits into something...
[ "Python is a good choice. \nI would avoid the CGI model though - you'll pay a large penalty for the interpreter launch on each request. Most Python web frameworks support the WSGI standard and can be hooked up to servers in a myriad of ways, but most live in some sort of long-running process that the web server c...
[ 17, 8, 5, 3 ]
[]
[]
[ "cgi", "python" ]
stackoverflow_0000290456_cgi_python.txt
Q: Search directory in SVN for files with specific file extension and copy to another folder? I would like my python script to search through a directory in SVN, locate the files ending with a particular extension (eg. *.exe), and copy these files to a directory that has been created in my C drive. How can I do this?...
Search directory in SVN for files with specific file extension and copy to another folder?
I would like my python script to search through a directory in SVN, locate the files ending with a particular extension (eg. *.exe), and copy these files to a directory that has been created in my C drive. How can I do this? I'm new to Python so a detailed response and/or point in the right direction would be very much...
[ "I think it is easiest to check out (or, better, export) the source tree using the svn command line utility: you can use os.system to invoke it. There are also direct Python-to-svn API bindings, but I would advise against using them if you are new to Python.\nYou can then traverse the checkout folder, e.g. using os...
[ 2 ]
[]
[]
[ "file", "python", "svn" ]
stackoverflow_0000291467_file_python_svn.txt
Q: Best Practices for Building a SSO System I am looking to build a Single-signon system for a couple web apps that used form based authentication. They way that I envision it is that my sso system would handle authentication against active directory pass the verification through to the desired web app when ever the...
Best Practices for Building a SSO System
I am looking to build a Single-signon system for a couple web apps that used form based authentication. They way that I envision it is that my sso system would handle authentication against active directory pass the verification through to the desired web app when ever the used clicked a link through my sso portal. Wh...
[ "When a user accesses an application URL without a session cookie, he is redirected to the SSO system. He then logs into the SSO form, which then redirects him back to your app with a ticket ID that you can look up in the SSO system to get cridentials.\nAlso, take a look at Crowd and CAS.\n", "Check out JA-SIG CA...
[ 1, 0 ]
[]
[]
[ "active_directory", "python", "web_applications", "web_services" ]
stackoverflow_0000291874_active_directory_python_web_applications_web_services.txt
Q: Python exception backtrace tells me where line ends, where does it begin? When A Python exception is thrown by code that spans multiple lines, e.g.: myfoos = [foo("bar", "baz", "quux", i) for i in range(10)] Python will report the line number of the last line, a...
Python exception backtrace tells me where line ends, where does it begin?
When A Python exception is thrown by code that spans multiple lines, e.g.: myfoos = [foo("bar", "baz", "quux", i) for i in range(10)] Python will report the line number of the last line, and will show the code fragment from that line: Traceback (most recent call last...
[ "Finding the beginning of the line will be really hard. You'll have to either parse the Python or maybe dig into the compiled byte code. There are modules in the standard library for parsing Python, but I can tell you from experience that interpreting their output is a black art. And I'm not sure the compiled by...
[ 3, 0 ]
[]
[]
[ "exception", "python" ]
stackoverflow_0000291508_exception_python.txt
Q: Best Python supported server/client protocol? I'm looking for a good server/client protocol supported in Python for making data requests/file transfers between one server and many clients. Security is also an issue - so secure login would be a plus. I've been looking into XML-RPC, but it looks to be a pretty old...
Best Python supported server/client protocol?
I'm looking for a good server/client protocol supported in Python for making data requests/file transfers between one server and many clients. Security is also an issue - so secure login would be a plus. I've been looking into XML-RPC, but it looks to be a pretty old (and possibly unused these days?) protocol.
[ "If you are looking to do file transfers, XMLRPC is likely a bad choice. It will require that you encode all of your data as XML (and load it into memory).\n\"Data requests\" and \"file transfers\" sounds a lot like plain old HTTP to me, but your statement of the problem doesn't make your requirements clear. What...
[ 9, 7, 5, 4, 3, 2, 1, 1, 0, 0 ]
[ "In the RPC field, Json-RPC will bring a big performance improvement over xml-rpc: \nhttp://json-rpc.org/wiki/python-json-rpc\n" ]
[ -1 ]
[ "client", "python" ]
stackoverflow_0000064426_client_python.txt
Q: Google AppEngine App Version Is it possible to fetch the current application version programmatically for use in urls with far future expires header? For example: <link rel="stylesheet" href="app.js?v=1.23" /> Should be automatically updated to: <link rel="stylesheet" href="app.js?v=1.24" /> In order to do so I ...
Google AppEngine App Version
Is it possible to fetch the current application version programmatically for use in urls with far future expires header? For example: <link rel="stylesheet" href="app.js?v=1.23" /> Should be automatically updated to: <link rel="stylesheet" href="app.js?v=1.24" /> In order to do so I need to get the version.
[ "From [http://code.google.com/appengine/docs/python/theenvironment.html][1]\nfrom google.appengine.ext import webapp\nimport os\n\nclass PrintEnvironmentHandler(webapp.RequestHandler):\n def get(self):\n for name in os.environ.keys():\n self.response.out.write(\"%s = %s<br />\\n\" % (name, os.environ[name]...
[ 6 ]
[]
[]
[ "google_app_engine", "python" ]
stackoverflow_0000289174_google_app_engine_python.txt
Q: Python help - Parsing Packet Logs I'm writing a simple program that's going to parse a logfile of a packet dump from wireshark into a more readable form. I'm doing this with python. Currently I'm stuck on this part: for i in range(len(linelist)): if '### SERVER' in linelist[i]: #do server parsing stuff pa...
Python help - Parsing Packet Logs
I'm writing a simple program that's going to parse a logfile of a packet dump from wireshark into a more readable form. I'm doing this with python. Currently I'm stuck on this part: for i in range(len(linelist)): if '### SERVER' in linelist[i]: #do server parsing stuff packet = linelist[i:find("\n\n", i, len(l...
[ "Looking at thefile.readlines() doc:\n\nfile.readlines([sizehint])\nRead until EOF using readline() and return a list containing the lines thus read. If the optional sizehint argument is present, instead of reading up to EOF, whole lines totalling approximately sizehint bytes (possibly after rounding up to an inter...
[ 2, 0, 0, 0 ]
[]
[]
[ "parsing", "python" ]
stackoverflow_0000293444_parsing_python.txt
Q: wxPython, Set value of StaticText() I am making a little GUI frontend for a app at the moment using wxPython. I am using wx.StaticText() to create a place to hold some text, code below: content = wx.StaticText(panel, -1, "Text Here", style=wx.ALIGN_CENTRE) I have a button when clicked retrieves data from MySQL, I...
wxPython, Set value of StaticText()
I am making a little GUI frontend for a app at the moment using wxPython. I am using wx.StaticText() to create a place to hold some text, code below: content = wx.StaticText(panel, -1, "Text Here", style=wx.ALIGN_CENTRE) I have a button when clicked retrieves data from MySQL, I am wanting to change the value of the St...
[ "If you are using a wx.StaticText() you can just:\ndef __init__(self, parent, *args, **kwargs): #frame constructor, etc.\n self.some_text = wx.StaticText(panel, wx.ID_ANY, label=\"Awaiting MySQL Data\", style=wx.ALIGN_CENTER)\n\ndef someFunction(self):\n mysql_data = databasemodel.returnData() #query your dat...
[ 64, 24 ]
[]
[]
[ "python", "wxpython" ]
stackoverflow_0000293344_python_wxpython.txt