Q_Id int64 337 49.3M | CreationDate stringlengths 23 23 | Users Score int64 -42 1.15k | Other int64 0 1 | Python Basics and Environment int64 0 1 | System Administration and DevOps int64 0 1 | Tags stringlengths 6 105 | A_Id int64 518 72.5M | AnswerCount int64 1 64 | is_accepted bool 2
classes | Web Development int64 0 1 | GUI and Desktop Applications int64 0 1 | Answer stringlengths 6 11.6k | Available Count int64 1 31 | Q_Score int64 0 6.79k | Data Science and Machine Learning int64 0 1 | Question stringlengths 15 29k | Title stringlengths 11 150 | Score float64 -1 1.2 | Database and SQL int64 0 1 | Networking and APIs int64 0 1 | ViewCount int64 8 6.81M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3,440,016 | 2010-08-09T12:35:00.000 | 0 | 0 | 0 | 1 | python,bytecode,distutils | 39,629,278 | 4 | false | 0 | 0 | "the standard commands don't have such an option"?
Do you have the latest version of setuptools installed? And did you write a setup.py file?
If so, this should work: python setup.py bdist_egg --exclude-source-files. | 1 | 8 | 0 | I want to create a bytecode-only distribution from distutils (no really, I do; I know what I'm doing). Using setuptools and the bdist_egg command, you can simply provide the --exclude-source parameter. Unfortunately the standard commands don't have such an option.
Is there an easy way to strip the source files just be... | How to strip source from distutils binary distributions? | 0 | 0 | 0 | 2,952 |
3,441,057 | 2010-08-09T14:33:00.000 | 0 | 0 | 1 | 0 | python,json,couchdb | 3,451,512 | 3 | false | 0 | 0 | CouchDB will accept any valid JSON Object as a document. | 2 | 0 | 0 | I'm a Python programmer with experience using the json module. I've just meet CouchDB and seems very interesting.
I wonder know if JSON data structures can be directly saved as a CouchDB document.
Thanks, | Can a JSON data structure be directly saved as a CouchDB document? | 0 | 0 | 0 | 761 |
3,441,057 | 2010-08-09T14:33:00.000 | 3 | 0 | 1 | 0 | python,json,couchdb | 3,451,530 | 3 | true | 0 | 0 | You only need to provide an unique ID that will be used as part of the resource name (URI) when PUTting it or you use POST and take an auto-generated ID. You can use any JSON, that does not contain _id and _rev, because these fields are reserved for CouchDB itself. | 2 | 0 | 0 | I'm a Python programmer with experience using the json module. I've just meet CouchDB and seems very interesting.
I wonder know if JSON data structures can be directly saved as a CouchDB document.
Thanks, | Can a JSON data structure be directly saved as a CouchDB document? | 1.2 | 0 | 0 | 761 |
3,441,358 | 2010-08-09T15:04:00.000 | 2 | 0 | 1 | 0 | python,types,numbers | 3,441,446 | 15 | false | 0 | 0 | Probably it's better to just do it the other way around: You check if it's a vector. If it is, you do a dot product and in all other cases you attempt scalar multiplication.
Checking for the vector is easy, since it should of your vector class type (or inherited from it). You could also just try first to do a dot-produ... | 3 | 133 | 0 | Given an arbitrary python object, what's the best way to determine whether it is a number? Here is is defined as acts like a number in certain circumstances.
For example, say you are writing a vector class. If given another vector, you want to find the dot product. If given a scalar, you want to scale the whole vector.... | What is the most pythonic way to check if an object is a number? | 0.02666 | 0 | 0 | 38,514 |
3,441,358 | 2010-08-09T15:04:00.000 | 1 | 0 | 1 | 0 | python,types,numbers | 25,140,088 | 15 | false | 0 | 0 | Just to add upon.
Perhaps we can use a combination of isinstance and isdigit as follows to find whether a value is a number (int, float, etc)
if isinstance(num1, int) or isinstance(num1 , float) or num1.isdigit(): | 3 | 133 | 0 | Given an arbitrary python object, what's the best way to determine whether it is a number? Here is is defined as acts like a number in certain circumstances.
For example, say you are writing a vector class. If given another vector, you want to find the dot product. If given a scalar, you want to scale the whole vector.... | What is the most pythonic way to check if an object is a number? | 0.013333 | 0 | 0 | 38,514 |
3,441,358 | 2010-08-09T15:04:00.000 | 17 | 0 | 1 | 0 | python,types,numbers | 3,441,388 | 15 | false | 0 | 0 | This is a good example where exceptions really shine. Just do what you would do with the numeric types and catch the TypeError from everything else.
But obviously, this only checks if a operation works, not whether it makes sense! The only real solution for that is to never mix types and always know exactly what typecl... | 3 | 133 | 0 | Given an arbitrary python object, what's the best way to determine whether it is a number? Here is is defined as acts like a number in certain circumstances.
For example, say you are writing a vector class. If given another vector, you want to find the dot product. If given a scalar, you want to scale the whole vector.... | What is the most pythonic way to check if an object is a number? | 1 | 0 | 0 | 38,514 |
3,441,436 | 2010-08-09T15:12:00.000 | 0 | 0 | 0 | 0 | python,django,django-forms | 3,441,476 | 6 | false | 1 | 0 | create your own view for logging in, with it's own url, don't use the admin's one.
you can store the next page in the session, or pass it as a GET parameter to the login view
(i.e. /login?next=gallery) just don't forget to sanitize and validate that value before redirecting to it. | 3 | 29 | 0 | I'm trying to redirect users to custom url "/gallery/(username)/" after successfully logging in. It currently redirects to the default "/account/profile/" url While I know what I can override the redirect url in my settings.py, my url is dynamic thus it will not work.
Documentation states that I need to use the "next... | The "next" parameter, redirect, django.contrib.auth.login | 0 | 0 | 0 | 42,969 |
3,441,436 | 2010-08-09T15:12:00.000 | 43 | 0 | 0 | 0 | python,django,django-forms | 5,787,355 | 6 | false | 1 | 0 | Django's login view django.contrib.auth.views.login accepts a dictionary named extra_context. The values in the dictionary are directly passed to the template. So you can use that to set the next parameter. Once that is done, you can set a hidden field with name next and value {{ next }} so that it gets rendered in the... | 3 | 29 | 0 | I'm trying to redirect users to custom url "/gallery/(username)/" after successfully logging in. It currently redirects to the default "/account/profile/" url While I know what I can override the redirect url in my settings.py, my url is dynamic thus it will not work.
Documentation states that I need to use the "next... | The "next" parameter, redirect, django.contrib.auth.login | 1 | 0 | 0 | 42,969 |
3,441,436 | 2010-08-09T15:12:00.000 | 2 | 0 | 0 | 0 | python,django,django-forms | 3,442,128 | 6 | false | 1 | 0 | You can use a static redirect to /loggedin/ and then associate the url to a view that makes the correct redirect.
Login takes an extra step but if you want to use django's view it does the job. | 3 | 29 | 0 | I'm trying to redirect users to custom url "/gallery/(username)/" after successfully logging in. It currently redirects to the default "/account/profile/" url While I know what I can override the redirect url in my settings.py, my url is dynamic thus it will not work.
Documentation states that I need to use the "next... | The "next" parameter, redirect, django.contrib.auth.login | 0.066568 | 0 | 0 | 42,969 |
3,441,766 | 2010-08-09T15:50:00.000 | 9 | 1 | 0 | 1 | python,perl,interop | 3,446,205 | 3 | false | 0 | 0 | In the short run the easiest solution is to use Inline::Python. Closely followed by calling a command-line script.
In the long run, using a server to provide RPC functionality or simply calling a command-line script will give you the most future proof solution.
Why?
Becuase that way you aren't tied to Perl or Python a... | 2 | 9 | 0 | I created a module in Python which provides about a dozen functionalities. While it will be mostly used from within Python, there is a good fraction of legacy users which will be calling it from Perl.
What is the best way to make a plug in to this module? My thoughts are:
Provide the functionalities as command line ut... | Calling a Python module from Perl | 1 | 0 | 0 | 9,275 |
3,441,766 | 2010-08-09T15:50:00.000 | 3 | 1 | 0 | 1 | python,perl,interop | 3,441,920 | 3 | false | 0 | 0 | Provide the functionalities as command line utilities and make system calls
Works really nicely. This is the way programs like Python (and Perl) are meant to use used. | 2 | 9 | 0 | I created a module in Python which provides about a dozen functionalities. While it will be mostly used from within Python, there is a good fraction of legacy users which will be calling it from Perl.
What is the best way to make a plug in to this module? My thoughts are:
Provide the functionalities as command line ut... | Calling a Python module from Perl | 0.197375 | 0 | 0 | 9,275 |
3,441,991 | 2010-08-09T16:12:00.000 | 0 | 0 | 0 | 0 | python,wxpython,listctrl | 3,442,559 | 3 | false | 0 | 1 | You can try EVT_LIST_ITEM_RIGHT_CLICK. That should work. Otherwise you'd want to use a flag and check said flag every time the selection event fires to see if it needs to query the database or not. There's also the UltimateListCtrl, a pure python widget, that you can probably hack to do this too. | 1 | 3 | 0 | I'm working on a form using wxPython where I want want listctrl's list of values to change based on the selection of another listctrl. To do this, I'm using methods linked to the controlling object's EVT_LIST_ITEM_SELECTED and EVT_LIST_ITEM_DESELECTED events to call Publisher.sendMessage. The control to be changed ha... | Respond to Listctrl change exactly once | 0 | 0 | 0 | 940 |
3,442,477 | 2010-08-09T17:19:00.000 | 4 | 0 | 1 | 0 | python,google-app-engine | 3,442,523 | 1 | true | 0 | 0 | Yes.
An entity is uniquely identified by its path, which is the kind & name or ID of the entity and all of its ancestors. If two entities have the same name, but different kinds and/or ancestries, they will have distinct paths. | 1 | 1 | 0 | I wonder if 2 objects can have the same key name?
They wouldn't be the same class.
Thanks! | Can 2 objects have the same key name? | 1.2 | 0 | 0 | 157 |
3,443,547 | 2010-08-09T19:39:00.000 | 1 | 0 | 1 | 0 | python | 3,443,624 | 3 | false | 0 | 0 | Isn't Django all about web-based CRUD applications for Python? | 1 | 1 | 0 | i'm looking for a basic CRUD (create-read-update-delete) app
in Python, with some line-by-line display grid to browse through a file's
records and select individual records from there. It probably already
exists but i couldn't find anything yet.
Thanks | GUI for the Linux and Windows platforms - Python CRUD app | 0.066568 | 0 | 0 | 1,876 |
3,443,607 | 2010-08-09T19:46:00.000 | 24 | 0 | 1 | 1 | python,debugging | 3,443,835 | 14 | false | 0 | 0 | Wow! 5 answers already and nobody has suggested the most obvious and simple:
Try to find a reproducible test case that causes the hanging behavior.
Add logging to your code. This can be as basic as print "**010", print "**020", etc. peppered through major areas.
Run code. See where it hangs. Can't understand why? ... | 2 | 80 | 0 | So I'm debugging my python program and have encountered a bug that makes the program hang, as if in an infinite loop. Now, I had a problem with an infinite loop before, but when it hung up I could kill the program and python spat out a helpful exception that told me where the program terminated when I sent it the kill ... | How can I tell where my python script is hanging? | 1 | 0 | 0 | 82,971 |
3,443,607 | 2010-08-09T19:46:00.000 | 2 | 0 | 1 | 1 | python,debugging | 3,443,669 | 14 | false | 0 | 0 | It's easier to prevent these hang-ups than it is to debug them.
First: for loops are very, very hard to get stuck in a situation where the loop won't terminate. Very hard.
Second: while loops are relatively easy to get stuck in a loop.
The first pass is to check every while loop to see if it must be a while loop. O... | 2 | 80 | 0 | So I'm debugging my python program and have encountered a bug that makes the program hang, as if in an infinite loop. Now, I had a problem with an infinite loop before, but when it hung up I could kill the program and python spat out a helpful exception that told me where the program terminated when I sent it the kill ... | How can I tell where my python script is hanging? | 0.028564 | 0 | 0 | 82,971 |
3,444,436 | 2010-08-09T21:41:00.000 | 5 | 0 | 1 | 0 | python,settings,configuration-files,yaml,configparser | 3,444,666 | 3 | false | 0 | 0 | ConfigParser has a really bad API, ConfigObj is supposed to be good but I have never used it, for ini files I usually implement my own parser.
However ini-like formats don't handle different types, sequences or recursive mappings well anyway so I would just use yaml. It's easy to read and edit with an editor, there is ... | 1 | 31 | 0 | Which is better for creating a settings file for Python programs, the built-in module (ConfigParser) or the independent project (ConfigObj), or using the YAML data serialization format? I have heard that ConfigObj is easier to use than ConfigParser, even though it is not a built-in library. I have also read that PyYA... | ConfigObj/ConfigParser vs. using YAML for Python settings file | 0.321513 | 0 | 0 | 15,649 |
3,444,504 | 2010-08-09T21:53:00.000 | 5 | 0 | 1 | 0 | django,python-imaging-library,imagekit,django-imagekit,photologue | 3,444,601 | 1 | true | 1 | 0 | Photologue is a Django application to manage photos. It uses PIL for the image processing.
ImageKit is a Django Application for image processing. It is meant for adding images to existing models.
PIL is the underlying library for both of these (and actually, most if not all image processing scripts in Python). | 1 | 1 | 0 | I'm trying to figure out which image management library to use on django. What is the difference between photologue, image-kit, and pil(python imaging library)? | Image management on Django | 1.2 | 0 | 0 | 462 |
3,444,611 | 2010-08-09T22:17:00.000 | 2 | 0 | 1 | 0 | python | 3,444,653 | 4 | false | 0 | 0 | If you "absolutely must" call it as a method (rather than a function) then the double underscores are needed. But the only motivation I can think for the code you show of is that somebody's gone so OO-happy that they don't understand the key Python principle that you don't directly call special methods (except you may... | 1 | 1 | 0 | why would anyone use double underscores
why not just do len([1,2,3])?
my question is specifically What do the underscores mean? | python: what is this funny notation? [0,1,3].__len__() | 0.099668 | 0 | 0 | 303 |
3,444,804 | 2010-08-09T22:56:00.000 | 1 | 0 | 0 | 0 | python | 3,444,821 | 4 | false | 1 | 0 | I think you can build it however you like, as long as you can make it an asynchronous service so that the users don't have to wait.
Unless, of course, the users don't mind waiting in this context. | 1 | 9 | 0 | I need to build a webservice that is very computationally intensive, and I'm trying to get my bearings on how best to proceed.
I expect users to connect to my service, at which point some computation is done for some amount of time, typically less than 60s. The user knows that they need to wait, so this is not really a... | How to build a computationally intensive webservice? | 0.049958 | 0 | 0 | 1,140 |
3,444,827 | 2010-08-09T22:59:00.000 | 0 | 1 | 1 | 0 | python,unit-testing | 3,444,963 | 5 | false | 0 | 0 | Yes to both:
setUp will be called between each test
test2 will be called twice.
If you would like to call a function inside a test, then omit the test prefix. | 3 | 7 | 0 | Can I call a test method from within the test class in python? For example:
class Test(unittest.TestCase):
def setUp(self):
#do stuff
def test1(self):
self.test2()
def test2(self):
#do stuff
update: I forgot the other half of my question. Will setup or teardown be called only a... | python unittest methods | 0 | 0 | 0 | 3,578 |
3,444,827 | 2010-08-09T22:59:00.000 | 1 | 1 | 1 | 0 | python,unit-testing | 3,444,872 | 5 | false | 0 | 0 | All methods whose name begins with the string 'test' are considered unit tests (i.e. they get run when you call unittest.main()). So you can call methods from within the Test class, but you should name it something that does not start with the string 'test' unless you want it to be also run as a unit test. | 3 | 7 | 0 | Can I call a test method from within the test class in python? For example:
class Test(unittest.TestCase):
def setUp(self):
#do stuff
def test1(self):
self.test2()
def test2(self):
#do stuff
update: I forgot the other half of my question. Will setup or teardown be called only a... | python unittest methods | 0.039979 | 0 | 0 | 3,578 |
3,444,827 | 2010-08-09T22:59:00.000 | 0 | 1 | 1 | 0 | python,unit-testing | 3,444,874 | 5 | false | 0 | 0 | sure, why not -- however that means test2 will be called twice -- once by test1 and then again as its own test, since all functions named test will be called. | 3 | 7 | 0 | Can I call a test method from within the test class in python? For example:
class Test(unittest.TestCase):
def setUp(self):
#do stuff
def test1(self):
self.test2()
def test2(self):
#do stuff
update: I forgot the other half of my question. Will setup or teardown be called only a... | python unittest methods | 0 | 0 | 0 | 3,578 |
3,445,429 | 2010-08-10T01:37:00.000 | 6 | 0 | 1 | 0 | python,debugging,code-snippets | 3,445,509 | 3 | true | 0 | 0 | Not sure how to scout "intentionally" for source code with bugs but you can look into the bug trackers of the main Python projects (and the less widespread ones, too), look for the bugs the reports refer to and debug them. It's a win-win situation. You win the skill to debug and they (hopefully) win a patch for the bug... | 2 | 5 | 0 | This is a strange request but I'm looking for buggy Python code. I want to learn more about bugs and debuggers and I need some buggy code to work with. Unfortunately, all the code I've written is short and bug-free (so far).
Preferably it's not GUI stuff (b/c I'm just starting to learn it) but anything's good.
Thanks ... | Intentionally Buggy Code (Python) | 1.2 | 0 | 0 | 1,741 |
3,445,429 | 2010-08-10T01:37:00.000 | 0 | 0 | 1 | 0 | python,debugging,code-snippets | 3,445,548 | 3 | false | 0 | 0 | Debugging is 70% about finding and figuring out the bug from reports of anomalies before you can do anything about it, and 30% about figuring out how not to take the castle of cards down when fixing it.
If you have it pointed out in the code for you, or are just given code and you're told it's buggy, you're in a worse ... | 2 | 5 | 0 | This is a strange request but I'm looking for buggy Python code. I want to learn more about bugs and debuggers and I need some buggy code to work with. Unfortunately, all the code I've written is short and bug-free (so far).
Preferably it's not GUI stuff (b/c I'm just starting to learn it) but anything's good.
Thanks ... | Intentionally Buggy Code (Python) | 0 | 0 | 0 | 1,741 |
3,445,867 | 2010-08-10T03:43:00.000 | 2 | 0 | 0 | 0 | python,binding,tkinter | 3,445,919 | 1 | false | 0 | 1 | Tkinter, on its own, cannot grab keystrokes that (from the OS's/WM's viewpoint) were directed to other, unrelated windows -- you'll need to instruct your window manager, desktop manager, or "operating system", to direct certain keystrokes differently than it usually does. So, what platform do you need to support for t... | 1 | 1 | 0 | I made a GUI with Tkinter, now how do I make it so when a key command will execute a command even if the Tkinter window is not in focus? Basically I want it so everything is bound to that key command.
Example:
Say I was browsing the internet and the focus was on my browser, I then type Ctrl + U. An event would then r... | Key commands in Tkinter | 0.379949 | 0 | 0 | 515 |
3,446,087 | 2010-08-10T04:41:00.000 | 0 | 0 | 0 | 1 | c++,python,c,linux,snmp | 3,447,496 | 4 | false | 0 | 0 | I am still searching for that easy to use suite of SNMP tools/API myself.
I build OA&M and I've tried NET-SNMP, Windows SNMP and lately agentpp (www.agentpp.com).
Personally, I preferred the agentpp.
Good luck to you. | 2 | 3 | 0 | Well, altough the S of the SNMP stands for Simple, yet, so far I haven't experienced it that way. And now that I am about to deploy my software on around around 180 remote Linux servers and wants to monitor the servers and configure my daemons all from a centralized point.
I simply want you to recommend me the library ... | As a software developer what is your SNMP suite that easy to integrate into your software | 0 | 0 | 0 | 597 |
3,446,087 | 2010-08-10T04:41:00.000 | 0 | 0 | 0 | 1 | c++,python,c,linux,snmp | 3,918,718 | 4 | false | 0 | 0 | The "S" in SNMP is actually for "simple" not because using it is simple, but rather because the protocol (on the wire) is designed to be simple and easy to implement. And it is. Now... actually implementing it and then using it is where the S completely drops away. | 2 | 3 | 0 | Well, altough the S of the SNMP stands for Simple, yet, so far I haven't experienced it that way. And now that I am about to deploy my software on around around 180 remote Linux servers and wants to monitor the servers and configure my daemons all from a centralized point.
I simply want you to recommend me the library ... | As a software developer what is your SNMP suite that easy to integrate into your software | 0 | 0 | 0 | 597 |
3,446,457 | 2010-08-10T06:07:00.000 | 4 | 0 | 1 | 0 | python,file,handles | 3,446,508 | 2 | false | 0 | 0 | Some systems may limit the number of file descriptors that a single process can have open simultaneously. 1024 is a common default, so if you need "thousands" open at once, you might want to err on the side of portability and design your application to use a smaller
pool of open file descriptors. | 2 | 2 | 0 | I'm reading from certain offsets in several hundred and possibly thousands files. Because I need only certain data from certain offsets at that particular time, I must either keep the file handle open for later use OR I can write the parts I need into seperate files.
I figured keeping all these file handles open rather... | Having several file pointers open simultaneaously alright? | 0.379949 | 0 | 0 | 181 |
3,446,457 | 2010-08-10T06:07:00.000 | 3 | 0 | 1 | 0 | python,file,handles | 3,447,418 | 2 | false | 0 | 0 | I recommend that you take a look at Storage.py in BitTorrent. It includes an implementation of a pool of file handles. | 2 | 2 | 0 | I'm reading from certain offsets in several hundred and possibly thousands files. Because I need only certain data from certain offsets at that particular time, I must either keep the file handle open for later use OR I can write the parts I need into seperate files.
I figured keeping all these file handles open rather... | Having several file pointers open simultaneaously alright? | 0.291313 | 0 | 0 | 181 |
3,448,365 | 2010-08-10T11:23:00.000 | -5 | 0 | 0 | 0 | python,image,pdf,reportlab | 4,092,003 | 4 | false | 0 | 0 | Use from reportlab.graphics import renderPDF | 1 | 12 | 1 | I saved some plots from matplotlib into a pdf format because it seems to offer a better quality. How do I include the PDF image into a PDF document using ReportLab? The convenience method Image(filepath) does not work for this format.
Thank you. | PDF image in PDF document using ReportLab (Python) | -1 | 0 | 0 | 7,751 |
3,449,673 | 2010-08-10T13:54:00.000 | 0 | 0 | 0 | 1 | python,web-services,reverse-proxy,cherokee | 3,452,793 | 1 | true | 1 | 0 | You could set a custom 504 error page. | 1 | 0 | 0 | I have a Cherokee installation that I'm using to serve a few web applications - one blog/calendar/etc. and two CPU-intensive web applications (1 stable version and 1 development version). All of them are Django or Pylons webservices served with CherryPy. I'm using the reverse-proxy handler in Cherokee to handle the ma... | Can Cherokee serve a fallback/default page when a reverse proxy is unavailable? | 1.2 | 0 | 0 | 218 |
3,449,968 | 2010-08-10T14:22:00.000 | 1 | 0 | 1 | 0 | python,spell-checking,pyenchant | 3,450,281 | 3 | false | 0 | 0 | Perhaps a better way of doing this would be to compress the document, as this would remove any repeating instances of words, which you actually only need to spell check once. I only suggest this as it would probably perform faster than writing your own unique word finder.
The compressed version should have references ... | 1 | 6 | 0 | Surprisingly I've been unable to find anyone else really doing this, but surely someone has. I'm working on a python project currently that involves spell checking some 16 thousand words. That number of words is only going to grow unfortunately. Right now I'm pulling words from Mongo, iterating through them, and then s... | "Large" scale spell checking in Python | 0.066568 | 0 | 0 | 4,945 |
3,450,525 | 2010-08-10T15:19:00.000 | 0 | 0 | 0 | 0 | python,event-handling,wxpython | 3,451,727 | 3 | false | 0 | 1 | In your init or OnInit method, do some kind of check to see if the program should run the startup process on startup (i.e. check a config file or some such). If yes, call the "scan" method using wx.CallAfter or wx.CallLater or call it after you Show() the frame. | 2 | 0 | 0 | OK, I'm trying to explain what I want to achieve in another way. Here's an example:
Say if it's an anti virus program, and user can choose between two ways to run the program, choice one, automatically start to scan disks for virus when the program starts up, choice two, hit the start button to make the program scan di... | Is there a wxpython event like program_start? | 0 | 0 | 0 | 372 |
3,450,525 | 2010-08-10T15:19:00.000 | 1 | 0 | 0 | 0 | python,event-handling,wxpython | 3,450,557 | 3 | false | 0 | 1 | Why don't you run it just in module code? This way it will be run only once, because code in module is run only once per program instance. | 2 | 0 | 0 | OK, I'm trying to explain what I want to achieve in another way. Here's an example:
Say if it's an anti virus program, and user can choose between two ways to run the program, choice one, automatically start to scan disks for virus when the program starts up, choice two, hit the start button to make the program scan di... | Is there a wxpython event like program_start? | 0.066568 | 0 | 0 | 372 |
3,451,149 | 2010-08-10T16:23:00.000 | 0 | 0 | 1 | 0 | python,performance | 3,451,777 | 3 | false | 0 | 0 | Python 3 does introduce some new language features too. One of my favorite is the new nonlocal keyword, which finally lets you write certain closures nicely, such as:
def getter_setter():
x = 0
def getter():
return x
def setter(val):
nonlocal x
x = val
return (getter, setter) | 3 | 1 | 0 | After reading some benchmarks, I noticed that python 3.1 is slower than python 2.6, especially with I/Os.
So I wonder what could be the good reasons to switch to Python 3.x ? | Why should I use python 3.1 instead of python 2.6? | 0 | 0 | 0 | 583 |
3,451,149 | 2010-08-10T16:23:00.000 | 0 | 0 | 1 | 0 | python,performance | 3,451,561 | 3 | false | 0 | 0 | Go to 3.1. Unless your code is run-once (which at almost never is). 2.6 has no future, and version 3 is the future, unless you are into time travel.
They are working on 3.1 and I can assure you the speeds will soon be up to par, and then exceed 2.6 speeds. | 3 | 1 | 0 | After reading some benchmarks, I noticed that python 3.1 is slower than python 2.6, especially with I/Os.
So I wonder what could be the good reasons to switch to Python 3.x ? | Why should I use python 3.1 instead of python 2.6? | 0 | 0 | 0 | 583 |
3,451,149 | 2010-08-10T16:23:00.000 | 0 | 0 | 1 | 0 | python,performance | 3,451,250 | 3 | false | 0 | 0 | Largely because of the new I/O library. This, however, has been completely rewritten to C in Python 3.2 and 2.7. I think the performance numbers are pretty close right now if you compare it to 3.2.
edit: I confused the version numbers. Nevermind. | 3 | 1 | 0 | After reading some benchmarks, I noticed that python 3.1 is slower than python 2.6, especially with I/Os.
So I wonder what could be the good reasons to switch to Python 3.x ? | Why should I use python 3.1 instead of python 2.6? | 0 | 0 | 0 | 583 |
3,451,708 | 2010-08-10T17:29:00.000 | 3 | 0 | 0 | 0 | python,sqlite,embedded,binary-data | 3,451,733 | 1 | true | 0 | 0 | Use the copy command in your OS. No reason to overthink this. | 1 | 0 | 0 | I have an sqlite database whose data I need to transfer over the network, the server needs to modify the data, and then I need to get the db back and either update my local version or overwrite it with the new db. How should I do this? My coworker at first wanted to scrap the db and just use an .ini file, but this is g... | Sending sqlite db over network | 1.2 | 1 | 0 | 471 |
3,451,983 | 2010-08-10T18:03:00.000 | 0 | 0 | 0 | 0 | python,google-app-engine | 3,467,698 | 1 | true | 1 | 0 | Actually, I made some stupid encoding error when testing yesterday, which made me think the error came from the function.
The problem doesnt come from the keys. It is just an error in my algorithm that won't check for keys of 2 characters if there is no object which the 1st character as keyname. | 1 | 0 | 0 | I'm using unicode strings for non latin characters as key names for my models.
I can create objects without problems, and the appengine admin shows key name correctly (I'm using chinese characters, and the right characters)
However, MyModel.get_by_key_name() returns None if the key_name is made of several characters.
F... | Get_by_key_name doesn't work with unicode key names of several characters | 1.2 | 0 | 0 | 351 |
3,452,022 | 2010-08-10T18:09:00.000 | 10 | 0 | 1 | 0 | python,exception,exception-handling,twisted | 3,452,525 | 1 | true | 0 | 0 | A Failure represents an exception and a traceback (often different from the current stack trace). You should use Failure when you are constructing an asynchronous exception. So, when you're going to fire a Deferred with an error, or when you're going to call a method like IProtocol.connectionLost or ClientFactory.cli... | 1 | 5 | 0 | When should I use a twisted.python.failure.Failure, and when should I use something like twisted.internet.error.ConnectionDone? Or should I do twisted.python.failure.Failure(twisted.internet.error.ConnectionDone), and if so, in what casese should I do that? | twisted: Failure vs. Error | 1.2 | 0 | 0 | 2,191 |
3,452,381 | 2010-08-10T18:54:00.000 | 0 | 0 | 0 | 0 | python,django,content-type,mime-types | 3,452,438 | 4 | false | 1 | 0 | Why we use 2 different naming for (almost the same) thing?
Backwards compatibility, based on your quote from the documentation. | 2 | 115 | 0 | As far as I know, they are absolute equal. However, browsing some django docs, I've
found this piece of code:
HttpResponse.__init__(content='', mimetype=None, status=200, content_type='text/html')
which surprise me the two getting along each other. The official docs was able to solve the issue in a pratical manner:
co... | What's the difference of ContentType and MimeType | 0 | 0 | 0 | 40,506 |
3,452,381 | 2010-08-10T18:54:00.000 | 63 | 0 | 0 | 0 | python,django,content-type,mime-types | 17,949,292 | 4 | false | 1 | 0 | I've always viewed contentType to be a superset of mimeType. The only difference being the optional character set encoding. If the contentType does not include an optional character set encoding then it is identical to a mimeType. Otherwise, the mimeType is the data prior to the character set encoding sequence.
E.G.... | 2 | 115 | 0 | As far as I know, they are absolute equal. However, browsing some django docs, I've
found this piece of code:
HttpResponse.__init__(content='', mimetype=None, status=200, content_type='text/html')
which surprise me the two getting along each other. The official docs was able to solve the issue in a pratical manner:
co... | What's the difference of ContentType and MimeType | 1 | 0 | 0 | 40,506 |
3,452,388 | 2010-08-10T18:55:00.000 | 1 | 1 | 0 | 0 | python,cgi,cgi-bin | 3,452,427 | 1 | true | 0 | 0 | Being as how it's nominally just a URL, there aren't any impacts on speed per-se. However, it is standard practice, just like it's standard practice to make the entry page to a website index.html, but it's not required by any stretch (as evidenced by default.aspx, home.php, etc)
I would change it as a security through ... | 1 | 0 | 0 | I'm considering moving from PHP to Python (for personal projects), and I really don't like seeing /cgi-bin/ in my URL.
I got the Python to execute outside of cgi-bin, but I just wanted to make sure there were no possible security issues that could pop up, and that there were no major impacts on the speed.
So are there ... | Running CGI outside of cgi-bin. Good idea? | 1.2 | 0 | 0 | 313 |
3,452,729 | 2010-08-10T19:35:00.000 | 6 | 1 | 1 | 0 | python,ruby,perl,comparison | 3,454,618 | 3 | false | 0 | 0 | I'm learning Python (and it's my first programming language so don't be too intense with your reasons) and I wanted to know how it stacks up to other scripting languages, like Perl and Ruby. What is Python better in comparison to other scripting languages, and what is it worse for?
IMO.
I have tried Python 2.x for so... | 1 | 1 | 0 | I'm learning Python (and it's my first programming language so don't be too intense with your reasons) and I wanted to know how it stacks up to other scripting languages, like Perl and Ruby. What is Python better in comparison to other scripting languages, and what is it worse for? | How does Python stack up to other scripting languages? | 1 | 0 | 0 | 1,331 |
3,452,788 | 2010-08-10T19:43:00.000 | 0 | 0 | 1 | 0 | python,config,configparser | 3,453,265 | 1 | true | 0 | 0 | No. The builtin ConfigParser stores sections as _sections, which is a dict. Since this is python you could access that variable to do an easy copy.
(config._sections[new_name] = config._sections[old_name]; config._sections.pop(old_name)
But ConfigParser may change at some later date and this would break your implemen... | 1 | 1 | 0 | Is there an easy way to rename a section in a config file using ConfigParser in python? I'd prefer not to have to delete the section and recreate it, but that is my only answer right now. | Rename config.ini section using ConfigParser in python | 1.2 | 0 | 0 | 867 |
3,452,986 | 2010-08-10T20:09:00.000 | 1 | 0 | 0 | 0 | python,wxpython,progress-bar | 3,453,038 | 1 | true | 0 | 1 | The wx.ProgressDialog isn't customizable its just a wrapper around the native ProgressDialog, the the easiest solution would be to roll your own by extending the wx.Dialog class and using a wx.Gauge | 1 | 0 | 0 | Is it possible to customize ProgressDialog in wxPython?
For instance, I would like to make the progressbar slimmer, and the window size wider.
SetSize() method doesn't appear to have any effect. | How to customize wx.ProgressDialog? | 1.2 | 0 | 0 | 352 |
3,453,085 | 2010-08-10T20:21:00.000 | 6 | 0 | 1 | 0 | python,syntax,slice | 3,453,105 | 11 | false | 0 | 0 | The third parameter is the step. So [::3] would return every 3rd element of the list/string. | 3 | 362 | 0 | I know that I can use something like string[3:4] to get a substring in Python, but what does the 3 mean in somesequence[::3]? | What is :: (double colon) in Python when subscripting sequences? | 1 | 0 | 0 | 293,448 |
3,453,085 | 2010-08-10T20:21:00.000 | 4 | 0 | 1 | 0 | python,syntax,slice | 9,916,132 | 11 | false | 0 | 0 | Python uses the :: to separate the End, the Start, and the Step value. | 3 | 362 | 0 | I know that I can use something like string[3:4] to get a substring in Python, but what does the 3 mean in somesequence[::3]? | What is :: (double colon) in Python when subscripting sequences? | 0.072599 | 0 | 0 | 293,448 |
3,453,085 | 2010-08-10T20:21:00.000 | 221 | 0 | 1 | 0 | python,syntax,slice | 3,453,102 | 11 | false | 0 | 0 | Python sequence slice addresses can be written as a[start:end:step] and any of start, stop or end can be dropped. a[::3] is every third element of the sequence. | 3 | 362 | 0 | I know that I can use something like string[3:4] to get a substring in Python, but what does the 3 mean in somesequence[::3]? | What is :: (double colon) in Python when subscripting sequences? | 1 | 0 | 0 | 293,448 |
3,453,180 | 2010-08-10T20:33:00.000 | 2 | 0 | 1 | 0 | python,sqlalchemy | 3,453,224 | 2 | true | 0 | 0 | no. It'll work just fine. | 1 | 12 | 0 | I want to override __cmp__, __eq__, and __hash__ so I can do set operations on a SQLAlchemy Declarative Base model. Will this cause any conflicts with the Declarative Base Implementation? | Overriding __cmp__, __eq__, and __hash__ for SQLAlchemy Declarative Base | 1.2 | 0 | 0 | 2,615 |
3,453,188 | 2010-08-10T20:34:00.000 | 2 | 0 | 0 | 0 | python,ssh,matplotlib | 56,920,446 | 10 | false | 0 | 0 | export MPLBACKEND="agg" this worked for me.
obviously you can set it via code as well. | 1 | 75 | 0 | I have a python code doing some calculation on a remote machine, named A. I connect on A via ssh from a machine named B.
Is there a way to display the figure on machine B? | Matplotlib: display plot on a remote machine | 0.039979 | 0 | 0 | 100,815 |
3,454,647 | 2010-08-11T01:17:00.000 | 0 | 1 | 0 | 1 | c#,python,c,dll,import | 3,454,709 | 4 | false | 0 | 0 | I've done some work with ctypes, and loading dlls in windows, but I don't think DLL have any sort of introspection. This really isn't a big deal, because all of the function calls in DLLs are static. If your trying to use a undocumented DLL, you would not only need to know the names of the functions, but also the par... | 1 | 4 | 0 | is this possible to view contents and Functions of a DLL file...
few times ago i was playing with OlyDBG then i found there is option for viewing contents of dll...
so suggest me any good tool or soft for this...
and suppose i have a DLL named "Python27.dll"...
now i need to view the content of this DLL so what do i... | Viewing Contents Of a DLL File | 0 | 0 | 0 | 3,117 |
3,456,088 | 2010-08-11T07:10:00.000 | 9 | 0 | 1 | 0 | python | 3,456,122 | 5 | true | 0 | 0 | It depends what you're going to do with it.
Unicode handling has vastly improved in Python 3. So if you intend to use this for building web pages or some such, Python 3 might be the obvious choice.
On the other hand, many libraries and frameworks still only support Python 2. For example, the numerical processing librar... | 4 | 3 | 0 | What's the ideal Python version for a beginner to start learning Python? I need to recommend some newbies a programming language to learn and I chose Python. I'm still not sure which version. | Python 3.X or Python 2.X | 1.2 | 0 | 0 | 316 |
3,456,088 | 2010-08-11T07:10:00.000 | 0 | 0 | 1 | 0 | python | 3,456,113 | 5 | false | 0 | 0 | I would suggest Python 2.6; I know it's old, but it's not only the current standard, and there is way more documentation and libraries available for it. | 4 | 3 | 0 | What's the ideal Python version for a beginner to start learning Python? I need to recommend some newbies a programming language to learn and I chose Python. I'm still not sure which version. | Python 3.X or Python 2.X | 0 | 0 | 0 | 316 |
3,456,088 | 2010-08-11T07:10:00.000 | 0 | 0 | 1 | 0 | python | 3,459,116 | 5 | false | 0 | 0 | I'll throw my experience into the works:
Right now you should be using 2.6. Switch to 2.7 when 2.7.1 comes out. Switch to 3.1/2 when all the libraries you want are fully supported and stable there. | 4 | 3 | 0 | What's the ideal Python version for a beginner to start learning Python? I need to recommend some newbies a programming language to learn and I chose Python. I'm still not sure which version. | Python 3.X or Python 2.X | 0 | 0 | 0 | 316 |
3,456,088 | 2010-08-11T07:10:00.000 | 1 | 0 | 1 | 0 | python | 3,456,110 | 5 | false | 0 | 0 | My vote is for 3.1
My reasoning is simple and selfish. The more new python programmers that only use 3.1 there are, the more likely it is that one of them is going to decide that they need some library from 2.6 and port it to 3.1 (learning 2.6 in the process I might add).
After this happens, I can start using 3.1: it... | 4 | 3 | 0 | What's the ideal Python version for a beginner to start learning Python? I need to recommend some newbies a programming language to learn and I chose Python. I'm still not sure which version. | Python 3.X or Python 2.X | 0.039979 | 0 | 0 | 316 |
3,456,648 | 2010-08-11T08:32:00.000 | 0 | 0 | 1 | 0 | python,class,object,arguments | 23,485,777 | 3 | false | 0 | 0 | If I understand your question, this will help you
Assume we have
class BankAccount:
'''After Constructor, we have another method '''
def transfer(self,amount,object): #object is variable passed for referencing an object
BankAccount.credit(self,amount)
object.debit(amount)
call method
bank1=BankAcc... | 1 | 3 | 0 | I have a module including definitions for two different classes in Python. How do I use objects of one class as an argument of the other? Say, I have class definitions for Driver and Car, and tuen want to have a Driver object as an argument for a Car object. | Python: object as an argument of another object | 0 | 0 | 0 | 23,405 |
3,458,249 | 2010-08-11T12:36:00.000 | 0 | 1 | 1 | 0 | python | 3,458,457 | 3 | false | 0 | 0 | Assuming general network conditions, as long you have sufficient system resources Python's regular threading module will allow you to simulate concurrent workload at an higher rate than any a real workload. | 2 | 3 | 0 | I have a web service that is required to handle significant concurrent utilization and volume and I need to test it. Since the service is fairly specialized, it does not lend itself well to a typical testing framework. The test would need to simulate multiple clients concurrently posting to a URL, parsing the resulting... | Concurrency Testing For A Web Service Using Python | 0 | 0 | 0 | 1,336 |
3,458,249 | 2010-08-11T12:36:00.000 | 3 | 1 | 1 | 0 | python | 3,458,598 | 3 | false | 0 | 0 | The Global Interpreter Lock prevents threads simultaneously executing Python code. This doesn't change when Python is compiled to bytecode, because the bytecode is still run by the Python interpreter, which will enforce the GIL. threading works by switching threads every sys.getcheckinterval() bytecodes.
This doesn't a... | 2 | 3 | 0 | I have a web service that is required to handle significant concurrent utilization and volume and I need to test it. Since the service is fairly specialized, it does not lend itself well to a typical testing framework. The test would need to simulate multiple clients concurrently posting to a URL, parsing the resulting... | Concurrency Testing For A Web Service Using Python | 0.197375 | 0 | 0 | 1,336 |
3,461,549 | 2010-08-11T18:21:00.000 | 79 | 0 | 1 | 0 | javascript,python,twisted,node.js | 3,461,640 | 2 | true | 1 | 0 | Twisted is more mature -- it's been around for a long, long time, and has so many bells and whistles as to make your head spin (implementations of the fanciest protocols, integration of the reactor with a large variety of other event loops, and so forth).
Node.js is said to be faster (I have not measured it myself) and... | 1 | 65 | 0 | Assuming a team of developers are equally comfortable with writing Javascript on the server side as they are with Python & Twisted, when is Node.js going to be more appropriate than Twisted (and vice versa)? | What are the use cases of Node.js vs Twisted? | 1.2 | 0 | 0 | 20,135 |
3,462,951 | 2010-08-11T21:21:00.000 | 0 | 0 | 0 | 0 | python,django | 3,463,019 | 2 | false | 1 | 0 | Not all sequences of bytes are valid for ex. UTF-8, maybe you should check this? | 1 | 0 | 0 | The file is uploaded through a Django form. The contents of the file need to be saved into a models.TextField(), for editors to review it before publication.
I am already checking UploadedFile.content_type. I have considered using a regular input field, but as the text is going to be quite long, it would be unwieldy fo... | In Python, how do I check that a file is a text file? | 0 | 0 | 0 | 114 |
3,464,996 | 2010-08-12T05:36:00.000 | 1 | 0 | 0 | 0 | python,dial-up,isdn | 3,465,106 | 1 | false | 0 | 0 | You should have system hardware and software that handles establishing ISDN links, that's not something you should be trying to reimplement yourself.
You need to consult the documentation for that hardware and software, and the documentation for the client software, to determine how that connection can be made availabl... | 1 | 0 | 0 | I have a requirement to create a Python application that accepts dial up connections over ISDN from client software and relays messages from this connection to a website application running on a LAMP webserver.
Do we have some modules or support for this kind of implementation in python?
Please suggest.
Thanks in advan... | ISDN dial up connection with python | 0.197375 | 0 | 1 | 974 |
3,465,231 | 2010-08-12T06:32:00.000 | 0 | 0 | 0 | 0 | python,excel-2003 | 3,466,751 | 1 | true | 0 | 0 | If you do not have sufficient file permissions you will not be able to access the file. In that case you will have to execute your Python program as an user with sufficient permissions.
If on the other hand the file is locked using other means specific to Excel then I am not sure what exactly is the solution. You might... | 1 | 0 | 0 | I'm trying to copy an excel sheet with python, but I keep getting "access denied" error message. The file is closed and is not shared. It has macros though.
Is their anyway I can copy the file forcefully with python?
thanks. | Copying a file with access locks, forcefully with python | 1.2 | 1 | 0 | 94 |
3,465,295 | 2010-08-12T06:41:00.000 | 4 | 1 | 0 | 1 | python,command,packaging,distutils | 3,466,094 | 2 | true | 0 | 0 | I wouldn't have any check at all. Document that your library requires this command, and if the user tries to use whatever part of your library needs it, an exception will be raised by whatever runs the command. It should still be possible to import your library and use it, even if only a subset of functionality is offe... | 1 | 3 | 0 | I'm looking for the most elegant way to notify users of my library that they need a specific unix command to ensure that it will works...
When is the bet time for my lib to raise an error:
Installation ?
When my app call the command ?
At the import of my lib ?
both?
And also how should you detect that the command is ... | How to depends of a system command with python/distutils? | 1.2 | 0 | 0 | 629 |
3,468,028 | 2010-08-12T13:18:00.000 | 1 | 0 | 0 | 0 | php,python,ruby,web-scraping | 3,469,962 | 4 | false | 1 | 0 | Short answer is no.
The problem is that HTML is a large family of formats - and only the more recent variants are consistent (and XML based). If you're going to use PHP then I would recommend using the DOM parser as this can handle a lot of html which does not qualify as well-formed XML.
Reading between the lines of yo... | 1 | 7 | 0 | I have used 3 languages for Web Scraping - Ruby, PHP and Python and honestly none of them seems to perfect for the task.
Ruby has an excellent mechanize and XML parsing library but the spreadsheet support is very poor.
PHP has excellent spreadsheet and HTML parsing library but it does not have an equivalent of WWW:Me... | Is there any language which is just "perfect" for web scraping? | 0.049958 | 0 | 1 | 2,443 |
3,468,101 | 2010-08-12T13:25:00.000 | 0 | 1 | 1 | 0 | java,javascript,python,programming-languages,classloader | 3,469,617 | 8 | false | 0 | 0 | In Python, you should use the traceback or inspect modules. These will modules will shield you from the implementation details of the interpreter, which can differ even today (e.g. IronPython, Jython) and may change even more in the future. The way these modules do it under the standard Python interpreter today, howeve... | 1 | 12 | 0 | I would like to write a code internal to my method that print which method/class has invoked it.
(My assumption is that I can't change anything but my method..)
How about other programming languages?
EDIT: Thanks guys, how about JavaScript? python? C++? | Java or any other language: Which method/class invoked mine? | 0 | 0 | 0 | 754 |
3,468,227 | 2010-08-12T13:37:00.000 | 2 | 1 | 0 | 0 | php,asp.net,python,frameworks,benchmarking | 3,468,630 | 4 | true | 1 | 0 | What I have done is to write many unit tests so you can test the layers.
For example, write a SOAP web service in PHP, Python and C#.
Write a REST web service in the same languages (same web services, just two ways to get to them). This one should be able to return JSON and XML as a minimum.
Write unit tests in C# an... | 2 | 1 | 0 | I'd like to compare the performance of different languages and/or different frameworks within the same language. This is aimed at server-side languages used for web development. I know an apples to apples comparison is not possible, but I'd like it to be as unbiased as possible. Here are some ideas :
Simple "Hello Wor... | How can I benchmark different languages / frameworks? | 1.2 | 0 | 0 | 463 |
3,468,227 | 2010-08-12T13:37:00.000 | 0 | 1 | 0 | 0 | php,asp.net,python,frameworks,benchmarking | 3,468,464 | 4 | false | 1 | 0 | You will spend a lot of time and come to realization that it was all wasted.
After you complete your tests you will learn that loops of 1000000 empty iterations are far from the real life and come to apache benchmark.
Then you come no know of opcode cachers which will ruin all your previous results.
Then you will learn... | 2 | 1 | 0 | I'd like to compare the performance of different languages and/or different frameworks within the same language. This is aimed at server-side languages used for web development. I know an apples to apples comparison is not possible, but I'd like it to be as unbiased as possible. Here are some ideas :
Simple "Hello Wor... | How can I benchmark different languages / frameworks? | 0 | 0 | 0 | 463 |
3,468,243 | 2010-08-12T13:40:00.000 | 9 | 1 | 0 | 0 | python,opcode,opcode-cache | 3,468,276 | 3 | false | 1 | 0 | It's automatic in Python -- a compiled .pyc file will appear magically. | 2 | 2 | 0 | I'm currently using PHP. I plan to start using Django for some of my next project.
But I don't have any experience with Python. After some searching, I still can't find a Python opcode cacher.
(There are lots of opcode cacher for PHP: APC, eAccelerator, Xcache, ...) | Python doesn't have opcode cacher? | 1 | 0 | 0 | 2,395 |
3,468,243 | 2010-08-12T13:40:00.000 | 2 | 1 | 0 | 0 | python,opcode,opcode-cache | 3,468,296 | 3 | false | 1 | 0 | Python doesn't need one the same way PHP needs it. Python doesn't throw the bytecode away after execution, it keeps it around (as .pyc files). | 2 | 2 | 0 | I'm currently using PHP. I plan to start using Django for some of my next project.
But I don't have any experience with Python. After some searching, I still can't find a Python opcode cacher.
(There are lots of opcode cacher for PHP: APC, eAccelerator, Xcache, ...) | Python doesn't have opcode cacher? | 0.132549 | 0 | 0 | 2,395 |
3,468,248 | 2010-08-12T13:40:00.000 | 0 | 1 | 0 | 0 | python,sql,caching,urlopen | 3,468,315 | 5 | false | 0 | 0 | How often do the price(s) change? If they're pretty constant (say once a day, or every hour or so), just go ahead and write a cron script (or equivalent) that retrieves the values and stores it in a database or text file or whatever it is you need.
I don't know if you can check the timestamp data from the Amazon API - ... | 1 | 3 | 0 | Hey all, I have a site that looks up info for the end user, is written in Python, and requires several urlopen commands. As a result it takes a bit for a page to load. I was wondering if there was a way to make it faster? Is there an easy Python way to cache or a way to make the urlopen scripts fun last?
The urlopens ... | Caching options in Python or speeding up urlopen | 0 | 0 | 1 | 805 |
3,468,500 | 2010-08-12T14:02:00.000 | 1 | 1 | 0 | 0 | php,javascript,python,image-processing | 17,615,110 | 7 | false | 0 | 0 | A shorter solution for true color image would be to scale it down to 1x1 pixel size and sample the color at that pixel:
$scaled = imagescale($img, 1, 1, IMG_BICUBIC);
$meanColor = imagecolorat($img, 0, 0);
...but I haven't tested this myself. | 1 | 49 | 0 | I have a jpg image.
I need to know "overall average" the color of the image. At first glance there can use the histogram of the image (channel RGB).
At work I use mostly JavaScript and PHP (a little Python) therefore welcomed the decision in these languages. Maybe ther are library for working with images that address s... | Detect "overall average" color of the picture | 0.028564 | 0 | 0 | 37,896 |
3,469,551 | 2010-08-12T15:52:00.000 | 1 | 0 | 1 | 0 | python,django,virtualenv,pip | 3,470,317 | 1 | true | 1 | 0 | it seems that the pip process quit prematurely due to a package in requirements that could not be found. this left things in limbo, stuck in the temp-like "build" folder before having a chance to complete the process which gets them into the proper "site-packages" location. | 1 | 4 | 0 | i am setting up a virtualenv for django deployment. i want an isolated env without access to the global site-packages. i used the option --no-site-packages, then installed a local pip instance for that env.
after using pip and a requirements.txt file i noticed that most packages were installed in a "build" folder tha... | virtualenv, sys.path and site-packages | 1.2 | 0 | 0 | 1,443 |
3,470,989 | 2010-08-12T18:54:00.000 | 12 | 1 | 0 | 0 | python,django,email-headers | 3,471,052 | 2 | true | 1 | 0 | Ok, I see I was browsing tragically old code. I should be able to call django.core.mail.message.make_msgid() and populate the header myself before calling send. | 1 | 7 | 0 | I want to save the MessageID of a sent email, so I can later use it in a References: header to facilitate threading.
I see in root/django/trunk/django/core/mail.py (line ~55) where the MessageID is created.
I'm trying to think of the best way to collect this value, other than just copy/pasting into a new backend module... | What's the easiest/cleanest way to get the MessageID of a sent email? | 1.2 | 0 | 0 | 2,548 |
3,472,349 | 2010-08-12T21:52:00.000 | 0 | 0 | 1 | 1 | python,installation,diskimage | 3,472,387 | 4 | false | 0 | 0 | Looks like all the other versions only have a 32 bit port? So a "new feature" of 2.7 is a 64 bit port. If you aren't running a 64 bit OS and don't need programs that can use > 4 GB of ram, you can stick with the 32 bit. | 3 | 3 | 0 | Python 2.7 has two different disk image installers for Mac OS X. My questions are:
What are the differences between the two Python 2.7 disk image installers?
Python 2.7 32-bit Mac OS X Installer Disk Image for Mac OS X 10.3 through 10.6
Python 2.7 PPC/i386/x86-64 Mac OS X Installer Disk Image for Mac OS X 10.5 or la... | What are the differences between the two Python 2.7 Mac OS X disk image installers? | 0 | 0 | 0 | 2,127 |
3,472,349 | 2010-08-12T21:52:00.000 | 0 | 0 | 1 | 1 | python,installation,diskimage | 3,472,470 | 4 | false | 0 | 0 | 1) You almost certainly want "Python 2.7 PPC/i386/x86-64 Mac OS X Installer Disk Image". It's also a close analogue of the 2.6.x version that comes with 10.6 by default.
2) Unless you know you need 32-bit versions for some reason, default to 64-bit for everything on Snow Leopard. It's what will most closely match the r... | 3 | 3 | 0 | Python 2.7 has two different disk image installers for Mac OS X. My questions are:
What are the differences between the two Python 2.7 disk image installers?
Python 2.7 32-bit Mac OS X Installer Disk Image for Mac OS X 10.3 through 10.6
Python 2.7 PPC/i386/x86-64 Mac OS X Installer Disk Image for Mac OS X 10.5 or la... | What are the differences between the two Python 2.7 Mac OS X disk image installers? | 0 | 0 | 0 | 2,127 |
3,472,349 | 2010-08-12T21:52:00.000 | 3 | 0 | 1 | 1 | python,installation,diskimage | 3,472,625 | 4 | true | 0 | 0 | As others have pointed out, the second (64-bit) installer variant is new on python.org starting with 2.7 and future releases of 2.7 and 3.2 will have both 32-bit-only and a 32-/64-bit variants. The newer variant is an attempt to add out-of-the-box support from python.org for Intel 64-bit (x86_64) processes which is th... | 3 | 3 | 0 | Python 2.7 has two different disk image installers for Mac OS X. My questions are:
What are the differences between the two Python 2.7 disk image installers?
Python 2.7 32-bit Mac OS X Installer Disk Image for Mac OS X 10.3 through 10.6
Python 2.7 PPC/i386/x86-64 Mac OS X Installer Disk Image for Mac OS X 10.5 or la... | What are the differences between the two Python 2.7 Mac OS X disk image installers? | 1.2 | 0 | 0 | 2,127 |
3,472,493 | 2010-08-12T22:23:00.000 | 4 | 0 | 0 | 0 | java,python,gwt,pyjamas | 4,886,045 | 2 | false | 1 | 0 | I've managed to deploy a couple of medium sized webapps using pyjamas and believe me, it was very smooth sailing. It's a slimmed-down version of GWT too so it is easier to learn. Most of the UI widgets are 100 lines ish! Also the pythonic use of OO is pretty exemplary. | 2 | 6 | 0 | I love both, python and Java and I have this first 'serious' web application project that I would like to carry out.
I find it hard to choose between pyjamas + django and GWT + Hibernate.
In fact, from my beginner point of view, it seems like the python world is more suitable for a quickly-developed and fun web applic... | About pyjamas maturity vs GWT maturity (with short dead lines) for a web application | 0.379949 | 0 | 0 | 1,811 |
3,472,493 | 2010-08-12T22:23:00.000 | 7 | 0 | 0 | 0 | java,python,gwt,pyjamas | 3,473,114 | 2 | true | 1 | 0 | In fact, from my beginner point of
view, it seems like the python world
is more suitable for a
quickly-developed and fun web
application. And, on the other hand,
the java world is useful for
performance-oriented, scalable
solutions and for 'serious' projects
with big money involved...
Naah. For exampl... | 2 | 6 | 0 | I love both, python and Java and I have this first 'serious' web application project that I would like to carry out.
I find it hard to choose between pyjamas + django and GWT + Hibernate.
In fact, from my beginner point of view, it seems like the python world is more suitable for a quickly-developed and fun web applic... | About pyjamas maturity vs GWT maturity (with short dead lines) for a web application | 1.2 | 0 | 0 | 1,811 |
3,472,515 | 2010-08-12T22:26:00.000 | 0 | 0 | 0 | 0 | python,http,concurrency,urllib2 | 3,472,568 | 9 | false | 0 | 0 | How about using pycurl?
You can apt-get it by
$ sudo apt-get python-pycurl | 1 | 15 | 0 | As the title suggests, I'm working on a site written in python and it makes several calls to the urllib2 module to read websites. I then parse them with BeautifulSoup.
As I have to read 5-10 sites, the page takes a while to load.
I'm just wondering if there's a way to read the sites all at once? Or anytricks to make ... | Python urllib2.urlopen() is slow, need a better way to read several urls | 0 | 0 | 1 | 32,925 |
3,472,634 | 2010-08-12T22:50:00.000 | 8 | 0 | 1 | 0 | java,python | 3,472,642 | 7 | false | 1 | 0 | Head First Java is a great book for any new Java programmer. It has lots of pictures, fun quips and puzzles to solve. Definitely worth the buy. | 3 | 10 | 0 | My 12 year old brother has recently expressed an interest in learning to program. I of course think this is a great idea, why not start him early? I'm wondering what you guys think with regards a book? I was thinking I should start him off on Java but I'm unsure what book would be best? Any suggestions with regards a b... | Good learner book for a 12 year old? | 1 | 0 | 0 | 2,051 |
3,472,634 | 2010-08-12T22:50:00.000 | 2 | 0 | 1 | 0 | java,python | 3,472,998 | 7 | false | 1 | 0 | If your brother plays any PC games, you might check to see if any of them are moddable. Many games these days come with scripted campaign editors or have python scripts underlying them that you can modify. They are a great way to get involved with the basic concepts behind programming, as your brother can get pretty ... | 3 | 10 | 0 | My 12 year old brother has recently expressed an interest in learning to program. I of course think this is a great idea, why not start him early? I'm wondering what you guys think with regards a book? I was thinking I should start him off on Java but I'm unsure what book would be best? Any suggestions with regards a b... | Good learner book for a 12 year old? | 0.057081 | 0 | 0 | 2,051 |
3,472,634 | 2010-08-12T22:50:00.000 | 0 | 0 | 1 | 0 | java,python | 3,472,658 | 7 | false | 1 | 0 | I too can recommend the Head First series.
You could try "Head First Programming". It uses some python though. | 3 | 10 | 0 | My 12 year old brother has recently expressed an interest in learning to program. I of course think this is a great idea, why not start him early? I'm wondering what you guys think with regards a book? I was thinking I should start him off on Java but I'm unsure what book would be best? Any suggestions with regards a b... | Good learner book for a 12 year old? | 0 | 0 | 0 | 2,051 |
3,472,862 | 2010-08-12T23:40:00.000 | 4 | 0 | 1 | 1 | python,windows,popen | 3,472,949 | 2 | true | 0 | 0 | Instead ofD:\Program Files\Steam\steamapps\terabytest\sourcesdk\bin\orangebox\bin\vbsp.exe, useD:/Program Files/Steam/steamapps/terabytest/sourcesdk/bin/orangebox/bin/vbsp.exe
This eliminates any complications with backslashes inside quotes. | 2 | 2 | 0 | I'm trying to run console commands via subprocess.Popen, and whenever I run it I get the windows "File not found" error, even when running the echo command.
I am also using Popen inside a thread made with the thread module. Is that the problem? | Popen gives "File not found" Error (windows/python) | 1.2 | 0 | 0 | 4,657 |
3,472,862 | 2010-08-12T23:40:00.000 | 3 | 0 | 1 | 1 | python,windows,popen | 3,472,903 | 2 | false | 0 | 0 | echo is not an executable, it's an internal command inside cmd.exe. If you want to use Popen with internal commands, add a keyword parameter shell=True | 2 | 2 | 0 | I'm trying to run console commands via subprocess.Popen, and whenever I run it I get the windows "File not found" error, even when running the echo command.
I am also using Popen inside a thread made with the thread module. Is that the problem? | Popen gives "File not found" Error (windows/python) | 0.291313 | 0 | 0 | 4,657 |
3,476,152 | 2010-08-13T10:55:00.000 | 5 | 0 | 0 | 0 | python,google-app-engine | 3,476,378 | 1 | true | 1 | 0 | save() is a (deprecated) alias for put(). They work exactly equivalently - in fact, they're the same function! | 1 | 0 | 0 | What is the difference between Mymodel.save() and Mymodel.put() in appengine with python?
I know that save is used in django but does is work with appengine models too? | Difference between save() and put()? | 1.2 | 0 | 0 | 205 |
3,476,183 | 2010-08-13T11:02:00.000 | 2 | 0 | 1 | 0 | python,events,windows-7,event-handling | 3,477,229 | 1 | true | 0 | 0 | Ok, I got pyHook working after installing the 32bit version of python 2.7 and compiling pyHook from the source with MinGW. Thanks for the pointers everyone. | 1 | 3 | 0 | Is there any way to monitor keyboard events in windows 7 with python without the python program having focus? I would like to run the python script as a background process that monitors certain keyboard events and does certain things on various keyboard input combinations. | monitor keyboard events with python in windows 7 | 1.2 | 0 | 0 | 1,581 |
3,476,387 | 2010-08-13T11:35:00.000 | 3 | 0 | 1 | 0 | c++,python,constructor,overloading | 3,476,486 | 4 | false | 0 | 1 | Usually, you're fine with any combination of
slightly altered design
default arguments (def __init__(self, x = 0.0, y = 0.0, z = 0.0))
use of polymorphism (in a duck-typed language, you don't need an overload for SomeThing vs SomeSlightlyDifferentThing if neither inherits from the other one, as long as their interface... | 1 | 1 | 0 | suppose a C++ class has several constructors which are overloaded according the number and type and sequences of their respective parameters, for example, constructor(int x, int y) and constructor(float x, float y, float z), I think these two are overloaded methods, which one to use depends on the parameters, right? So... | C++ methods overload in python | 0.148885 | 0 | 0 | 251 |
3,476,509 | 2010-08-13T11:51:00.000 | 1 | 0 | 1 | 0 | python,module,import | 3,477,426 | 4 | false | 0 | 0 | let me add that i consider not only from math import * a case of namespace pollution, but also from math import cos. this is because when you do this on top of module foo, and you then look at the namespace of that module with import foo; print( dir( foo ) ), you will have an item cos in that list. usually, this is not... | 1 | 7 | 0 | I use the math module a lot lately. I don't want to write math.sqrt(x) and math.sin(x) all the time. I would like to shorten it and write sqrt(x) and sin(x).
How? | How to avoid writing the name of the module all the time when importing a module in python? | 0.049958 | 0 | 0 | 3,120 |
3,477,283 | 2010-08-13T13:34:00.000 | 17 | 0 | 1 | 0 | python,int,long-integer,max | 3,477,336 | 4 | false | 0 | 0 | sys.maxint is not the largest integer supported by python. It's the largest integer supported by python's regular integer type. | 1 | 211 | 0 | I think the maximum integer in python is available by calling sys.maxint.
What is the maximum float or long in Python? | What is the maximum float in Python? | 1 | 0 | 0 | 281,654 |
3,477,502 | 2010-08-13T13:56:00.000 | 9 | 0 | 1 | 0 | python | 3,477,530 | 3 | false | 0 | 0 | While a custom solution will teach you about Python, for production code using the csv module is the best idea. Comma-separated data can become more complex than initially appears. | 1 | 18 | 0 | I am reading in a string of integers such as "3 ,2 ,6 " and want them in the list [3,2,6] as integers. This is easy to hack about, but what is the "pythonic" way of doing it? | "pythonic" method to parse a string of comma-separated integers into a list of integers? | 1 | 0 | 0 | 26,335 |
3,478,001 | 2010-08-13T14:48:00.000 | 0 | 0 | 1 | 0 | python,vbscript,exchange-server | 3,550,966 | 1 | true | 0 | 0 | Going to just install powershell on the machine and use that. | 1 | 0 | 0 | Is there a way to create a recovery group in exchange 2003 with python?
Maybe CDOEXM or VBScript? But I have been unsuccessful in finding any sample code.
Any ideas? | Recovery Group with Exchange 2003 and Python | 1.2 | 0 | 0 | 64 |
3,478,780 | 2010-08-13T16:18:00.000 | 3 | 0 | 0 | 0 | python,orm,code-generation | 3,481,115 | 3 | false | 0 | 0 | You do not need to produce a source code representation of your classes to be able to expand them.
The only trick is that you need the ORM to generate the classes BEFORE importing the module that defines the derived classes.
Even better, don't use derivation, but use __getattr__ and __setattr__ to implement transparent... | 1 | 2 | 0 | is there a python ORM (object relational mapper) that has a tool for automatically creating python classes (as code so I can expand them) from a given database schema?
I'm frequently faced with small tasks involving different databases (like importing/exporting from various sources etc.) and I thought python together w... | Python ORM that automatically creates classes from DB schema | 0.197375 | 1 | 0 | 1,411 |
3,479,569 | 2010-08-13T18:09:00.000 | 3 | 1 | 0 | 0 | python,alignment,blast | 5,816,012 | 2 | false | 0 | 0 | In fact a complete implementation of the BLAST algorithm is a quite hard. It has a lot of steps and optimizations. What could you do is: take a look of the BLAST Book from O'Reilly, for a very good explanation, take a look of the NCBI Blast code base, that it is big and hard to understand at the first glace, or, I suge... | 1 | 7 | 0 | Is anyone aware of a pure python implementation of BLAST alignment? I am trying to study this algorithm... | Python implementation of BLAST alignment algorithm? | 0.291313 | 0 | 0 | 3,698 |
3,479,728 | 2010-08-13T18:35:00.000 | 3 | 0 | 0 | 1 | python,security,bash,scripting,embedding | 3,479,760 | 7 | false | 0 | 0 | It always better and better style to use Python functions to do this kind of stuff. With Python it's not that hard to write a script in an OS-independent way instead of using bash. | 3 | 8 | 0 | I was wondering whether or not it is considered a good style to call bash commands within a Python script using os.system(). I was also wondering whether or not it is safe to do so as well.
I know how to implement some of the functionality I need in Bash and in Python, but it is much simpler and more intuitive to imple... | Is it good style to call bash commands within a Python script using os.system("bash code")? | 0.085505 | 0 | 0 | 3,091 |
3,479,728 | 2010-08-13T18:35:00.000 | 1 | 0 | 0 | 1 | python,security,bash,scripting,embedding | 3,479,763 | 7 | false | 0 | 0 | It's not idea, since it makes your script a lot less portable. A native python script can run on any unix or windows machine that has the proper python libraries installed. When you add shell commands into the mix, you break that, and suddenly are locked down to a much narrower subset.
Sometimes you don't have a choi... | 3 | 8 | 0 | I was wondering whether or not it is considered a good style to call bash commands within a Python script using os.system(). I was also wondering whether or not it is safe to do so as well.
I know how to implement some of the functionality I need in Bash and in Python, but it is much simpler and more intuitive to imple... | Is it good style to call bash commands within a Python script using os.system("bash code")? | 0.028564 | 0 | 0 | 3,091 |
3,479,728 | 2010-08-13T18:35:00.000 | 1 | 0 | 0 | 1 | python,security,bash,scripting,embedding | 3,479,838 | 7 | false | 0 | 0 | The quoting issues alone suggest that a pure Python solution is preferable. | 3 | 8 | 0 | I was wondering whether or not it is considered a good style to call bash commands within a Python script using os.system(). I was also wondering whether or not it is safe to do so as well.
I know how to implement some of the functionality I need in Bash and in Python, but it is much simpler and more intuitive to imple... | Is it good style to call bash commands within a Python script using os.system("bash code")? | 0.028564 | 0 | 0 | 3,091 |
3,480,371 | 2010-08-13T20:14:00.000 | 0 | 0 | 1 | 0 | python,printing,window | 3,480,555 | 2 | false | 0 | 0 | If you mean the prompt window that opens when you run a Python script on MS Windows, try specifying the executable pythonw instead of python, on the first line of your script. | 1 | 1 | 0 | In my python app, I print some stuff during a cycle.
After the cycle, I want to close the stdout/stderr window that the prints produced using python code. | How to close stdout/stderr window in python? | 0 | 0 | 0 | 3,603 |
3,480,524 | 2010-08-13T20:41:00.000 | 6 | 0 | 0 | 1 | python,google-app-engine,twisted | 3,480,585 | 1 | true | 1 | 0 | Certainly. App Engine will scale your application up as the load increases automatically and will be spread over many machines. The web api they have is pretty nice too. You don't have to worry about deferreds either because it scales by bringing more instances up instead of making things asynchronous.
BTW: I have web ... | 1 | 1 | 0 | So far I have been using Twisted to simultaneously serve a lot of mobile clients (Android, iPhone) with their HTTP requests exchanging JSON messages.
For my next project I'd like to try out Google App Engine, but I'm wondering if it is capable of doing the same or if I should rather go with a custom built solution agai... | Twisted vs Google App Engine in serving mobile clients | 1.2 | 0 | 0 | 617 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.