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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8,930,460 | 2012-01-19T17:24:00.000 | 0 | 0 | 0 | 0 | python,gtk,pygtk,gtktreeview | 32,256,786 | 3 | false | 0 | 1 | To answer the question in the title: No, you can't add columns to a GtkTreeModel after it's been created. | 2 | 5 | 0 | I have a treeview that is populated from a treemodel.
I would like to add a colum to the treeview. Is it possible to draw the data for that column from a separate treemodel or can I append at runtime a column to the existing treemodel? | Can I add a column to an existing treemodel in gtk? | 0 | 0 | 0 | 1,854 |
8,931,362 | 2012-01-19T18:31:00.000 | 2 | 0 | 1 | 0 | python | 8,931,655 | 4 | false | 0 | 0 | eggs are simply zip files under another name so they are imported using zipimport.zipimporter which (unfortunately) is a module written in C.
I think your options are:
rewrite a modified zipimporter to accept a file like object
instead of a filename
re-implement zipimporter in Python and then
modify to accept a file-l... | 1 | 5 | 0 | Suppose I have a binary string which contains a Python egg, all zipped up. Is there a way to execute and "import" that egg from memory, without ever writing it to disk? | is there a way to import a Python egg from memory, but not the disk? | 0.099668 | 0 | 0 | 503 |
8,933,237 | 2012-01-19T21:03:00.000 | 91 | 0 | 1 | 0 | python,directory | 8,933,302 | 15 | false | 0 | 0 | So close! os.path.isdir returns True if you pass in the name of a directory that currently exists. If it doesn't exist or it's not a directory, then it returns False. | 1 | 1,414 | 0 | How do I check if a directory exists? | How do I check if directory exists in Python? | 1 | 0 | 0 | 1,345,789 |
8,933,888 | 2012-01-19T21:52:00.000 | 3 | 0 | 1 | 0 | python,linux,logging,fedora | 8,933,944 | 1 | true | 0 | 0 | It's a long shot, but you should make sure there aren't any logging calls before the call to basicConfig(). That's a common logging gotcha, though I'm not sure why it will work with 2.7 | 1 | 1 | 0 | I must be doing something wrong: is there a difference between the basicConfig of python 2.6 and 2.7?
Under python 2.6, a basicConfig(level=logging.INFO) will not send info msg to stdout whilst under 2.7 it does.
Could somebody explain what I am doing wrong?? | python logging: difference between 2.6 and 2.7 | 1.2 | 0 | 0 | 906 |
8,935,191 | 2012-01-20T00:08:00.000 | 1 | 0 | 0 | 0 | python,security,amazon-s3 | 8,935,272 | 3 | false | 0 | 0 | Even though version 4 UUIDs are supposed to incorporate random data, I wouldn't want to rely on the fact that the RNG used by Python's uuid.uuid4() being securely random. The Python docs make no mention about the quality of the randomness, so I'd be afraid that you might end up with guessable UUID's.
I'm not a crypto e... | 1 | 1 | 0 | I need to provide individuals with their financial statement, and I am using S3. So far what I am doing is making the file public-read and creating a unique Key, using uuid.uuid4().
Would this be acceptable, or how else could I make this more secure? Sending authentication keys for each individual is not an option. | Sending 'secure' financial statements on S3 | 0.066568 | 1 | 0 | 260 |
8,937,190 | 2012-01-20T05:38:00.000 | 2 | 0 | 0 | 0 | javascript,python,dom,web-scraping | 8,943,959 | 1 | true | 1 | 0 | Figure out the AJAX request URL and request it directly. :-) | 1 | 3 | 0 | I wrote some basic Python code to scrape a remote webpage and grab a few pieces of data. On a different page I'm trying to scrape, the data is hidden from view, and only appears after changing the value of a <select> box.
After de-minifying and digging through the remote website's javascript, I confirmed that it is us... | Trigger Javascript event on remote website with Python | 1.2 | 0 | 1 | 2,574 |
8,937,709 | 2012-01-20T06:46:00.000 | 1 | 0 | 1 | 1 | python,cygwin | 8,938,397 | 2 | true | 0 | 0 | You should use the python interpreter from inside cygwin POSIX environment. | 1 | 2 | 0 | I have .sh script that executes .py script and it doesn't work giving me following error:
C:\Python27\python.exe: can't open file '/cygdrive/c/NewFolder/Kindle/Src_Updater/kindle_update_tool_lite.py': [Errno 2] No such file or directory
How can I combine cygwin style path (/cygdrive/) and windows version of Python with... | How I combine cygwin style path (/cygdrive/) and windows version of Python? | 1.2 | 0 | 0 | 4,533 |
8,938,442 | 2012-01-20T08:15:00.000 | 0 | 0 | 1 | 0 | python,python-imaging-library,screen-grab | 8,938,645 | 1 | false | 0 | 1 | Here's an idea, merge the images as they come in.
After a set period of time or set amount merged, compress the image. Divide the image back into separate ones.
/profit | 1 | 2 | 0 | i am grabbing PIL images with screengrab from the screen, saving them in a queue and writing them into a jpg image sequence.
I use a producer thread to capture and a worker to write the images down to disk.
However i noticed, that this queue gets really large really fast, even though the written output is not really t... | Reducing PIL image size in memory | 0 | 0 | 0 | 775 |
8,938,449 | 2012-01-20T08:15:00.000 | 2 | 0 | 0 | 0 | python,matplotlib | 8,938,840 | 5 | false | 0 | 0 | Its Python, so you can modify the source script directly so the data is dumped before it is plotted | 1 | 25 | 1 | I have a wxPython program which reads from different datasets, performs various types of simple on-the-fly analysis on the data and plots various combinations of the datasets to matplotlib canvas. I would like to have the opportunity to dump currently plotted data to file for more sophisticated analysis later on.
The ... | How to extract data from matplotlib plot | 0.07983 | 0 | 0 | 31,312 |
8,939,727 | 2012-01-20T10:09:00.000 | 1 | 0 | 0 | 0 | python,selenium,webdriver | 8,943,628 | 1 | true | 0 | 0 | My $0.02:
Will it work?
Most likely.
Is it ideal?
Probably not. It sounds similar to what used to be called "dependency hell"...
Most of the time, making something work takes a higher priority than making something ideal.
That being said, make sure to architect it in such a way that it's as clear as possible to the ne... | 1 | 0 | 0 | I have not been able to make drag-and-drop work with Selenium 2, so I'm considering using Selenium 1 instead for drag-and-drop.
Before I dive into Selenium 1, are there known complications of having tests based on both Selenium 1 and Selenium 2 at the same time? | Working with both Selenium 1 and Selenium 2 | 1.2 | 0 | 1 | 111 |
8,939,838 | 2012-01-20T10:18:00.000 | 0 | 0 | 1 | 0 | python,eclipse,whitespace,pydev | 38,349,142 | 3 | false | 0 | 0 | On mars2 and PyDev 5.1.1 this still occurs to me. I have Replace tabs with spaces when typing checked and Assume tab spacing when file contain tabs unchecked. I had to replace all tabs with spaces to remove this warning. | 3 | 6 | 0 | I am using Eclipse Ingigo with Pydev 2.3.0.2011121518, it has been working great, but has suddenly starting doing this weird thing with tabs.
I have got the "Replace tabs with spaces when typing" option set for PyDev --> Editor in Eclipse preferences, and that works fine, when I press tab, I get 4 spaces. However for s... | PyDev adding tabs to block indentation | 0 | 0 | 0 | 6,025 |
8,939,838 | 2012-01-20T10:18:00.000 | 0 | 0 | 1 | 0 | python,eclipse,whitespace,pydev | 67,364,719 | 3 | false | 0 | 0 | I've faced similar issue, for me the error was Mixed Indentation: Spaces found.
Solution: In Eclipse with Pydev, Source menu -> Convert tabs to space-tabs. | 3 | 6 | 0 | I am using Eclipse Ingigo with Pydev 2.3.0.2011121518, it has been working great, but has suddenly starting doing this weird thing with tabs.
I have got the "Replace tabs with spaces when typing" option set for PyDev --> Editor in Eclipse preferences, and that works fine, when I press tab, I get 4 spaces. However for s... | PyDev adding tabs to block indentation | 0 | 0 | 0 | 6,025 |
8,939,838 | 2012-01-20T10:18:00.000 | 8 | 0 | 1 | 0 | python,eclipse,whitespace,pydev | 9,004,046 | 3 | true | 0 | 0 | I have just solved this - I had the option ."Assume tab spacing when file contain tabs" checked in Eclipse Preferences --> PyDev --> Editor. When I unchecked this option the automatic indentation worked properly and it added spaces and not tabs. It seems that in one of my docstrings I had some tabs (possibly copied in ... | 3 | 6 | 0 | I am using Eclipse Ingigo with Pydev 2.3.0.2011121518, it has been working great, but has suddenly starting doing this weird thing with tabs.
I have got the "Replace tabs with spaces when typing" option set for PyDev --> Editor in Eclipse preferences, and that works fine, when I press tab, I get 4 spaces. However for s... | PyDev adding tabs to block indentation | 1.2 | 0 | 0 | 6,025 |
8,941,192 | 2012-01-20T12:05:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine,memcached,djangoappengine | 8,980,637 | 2 | false | 1 | 0 | Cache everything that might be frequent, and let Memcache's LRU policy evict items that aren't accessed frequently enough to warrant remaining in the cache. | 1 | 0 | 0 | I am developing an api on google appengine django nonrel that will serve a lot of requests. I would like to cache repeated requests.
It is estimated that there will be some really frequent queries to the api, and I would like to be able to find out what these queries are on the fly so that I may pre-cache them. Is ther... | python appengine memcache optimization | 0.099668 | 0 | 0 | 259 |
8,942,806 | 2012-01-20T14:22:00.000 | 4 | 0 | 1 | 0 | python,django,database-design,data-structures,django-models | 8,943,294 | 1 | true | 0 | 0 | You have to think about how you want to implement this when determining the best way to store the data:
should users be able to reschedule or remove one of the recurring events
similarly, should changes to recurring events change all events or only future events?
do you care about creating a lot of records in the data... | 1 | 0 | 0 | I am trying to implement a calendar with repeatable events.
Simple example (in human language) is: 'Something happens every working day between 10:00 and 12:00'
What is the most correct way to store this data in the database and to search between them.
The search may be something like "Give me all events on Tuesday 21t... | How to implement calendar with repeatable events? | 1.2 | 0 | 0 | 801 |
8,943,446 | 2012-01-20T15:06:00.000 | 1 | 0 | 0 | 0 | python,windows,user-interface,drag-and-drop | 8,944,479 | 3 | false | 0 | 1 | Theoretically, you can use any library for which a graphical drag-and-drop designer exists. Such tools often generate markup language which the library parses, and sometimes they generate code directly. The latter is language-dependent whilst the former shouldn't be. Either way, you'll find a way of doing it with Pytho... | 1 | 2 | 0 | I'd like to make a simple GUI that offers buttons which I can drag and drop into other Windows applications such that this other applications receives a certain string depending on the button chosen.
What would be the easiest GUI framework for Python that allows this drag and drop? | Simple GUI Windows Drag&Drop | 0.066568 | 0 | 0 | 1,910 |
8,947,143 | 2012-01-20T19:58:00.000 | 0 | 0 | 1 | 0 | python | 8,950,125 | 2 | false | 0 | 0 | delete csv.pycif it exists
delete or rename csv.py | 2 | 1 | 0 | I accidentally created a file in my directory called csv.py
It keeps pulling in the csv.py whenever I try to import the native csv module to open and write to CSV.
How do I restore it so that I can use the native CSV module?
I'm running Python 2.6.6. | Incorrect Module being imported | 0 | 0 | 0 | 88 |
8,947,143 | 2012-01-20T19:58:00.000 | 4 | 0 | 1 | 0 | python | 8,947,168 | 2 | false | 0 | 0 | If you don't need it anymore, you can just remove it together with the .pyc file or rename it to a more appropriate name. | 2 | 1 | 0 | I accidentally created a file in my directory called csv.py
It keeps pulling in the csv.py whenever I try to import the native csv module to open and write to CSV.
How do I restore it so that I can use the native CSV module?
I'm running Python 2.6.6. | Incorrect Module being imported | 0.379949 | 0 | 0 | 88 |
8,953,532 | 2012-01-21T13:59:00.000 | 3 | 0 | 0 | 0 | python,image,image-processing,python-imaging-library,rgb | 9,174,477 | 2 | false | 0 | 0 | The conversion formula, from RGB to grey, is
L = 0.2125 * R + 0.7154 * G + 0.0721 * B
That means that there are multiple colours that can produce a single grey value. To see why this is the case, imagine the formula had equal weights, i.e.
L = 0.333 * R + 0.333 * G + 0.333 * B = 1/3 * (R + G + B)
then L=100 could be p... | 1 | 0 | 0 | I would like to know whether a pixel in a b&w part of a RGB image is characterized by parameters r,g,b, s.t.
r==b==g.
Why?
Thanks a lot!
Regards. | Python PIL - RGB pixel values for b&w pixel | 0.291313 | 0 | 0 | 1,299 |
8,953,991 | 2012-01-21T15:03:00.000 | 2 | 0 | 0 | 0 | python,matrix,numerical-methods | 8,954,018 | 3 | true | 0 | 0 | scipy and numpy is the obvious way to go here.
Note that numpy uses the famous (and well-optimized) BLAS libraries, so it is also very fast. Much faster than any "pure python" will ever be. | 2 | 0 | 1 | I know how to implement least-squares with elementary matrix decomposition and other operations, but how can I do it in Python? (I've never tried to use matrices in Python)
(clarification edit to satisfy the shoot-first-and-ask-questions-later -1'er)
I was looking for help to find out how to use numerical programming ... | python: least-squares estimation? | 1.2 | 0 | 0 | 819 |
8,953,991 | 2012-01-21T15:03:00.000 | 1 | 0 | 0 | 0 | python,matrix,numerical-methods | 8,954,011 | 3 | false | 0 | 0 | Have a look at SciPy. It's got matrix operations. | 2 | 0 | 1 | I know how to implement least-squares with elementary matrix decomposition and other operations, but how can I do it in Python? (I've never tried to use matrices in Python)
(clarification edit to satisfy the shoot-first-and-ask-questions-later -1'er)
I was looking for help to find out how to use numerical programming ... | python: least-squares estimation? | 0.066568 | 0 | 0 | 819 |
8,954,383 | 2012-01-21T15:58:00.000 | 1 | 1 | 0 | 1 | python,git,bash | 8,954,535 | 1 | true | 0 | 0 | Yes, git (and any well-behaved *nix program) will always return 0 for success and non-zero for failure. This is the paradigm on GNU/Linux systems, and since Git was made by the same person who made Linux, you can bet it follows the convention. | 1 | 0 | 0 | I am trying to build a set of git utilities with python. I am using subprocess.Popen to run the git binary. Right now I am just trying to find the best way to determine that there was an error in running a git command.
My question is whether or not git will always return a returncode of 0 on a successful git command ... | Calling Git Binary From Python And Error Codes | 1.2 | 0 | 0 | 220 |
8,955,752 | 2012-01-21T18:58:00.000 | 4 | 1 | 1 | 0 | python,unit-testing,function | 8,955,802 | 1 | true | 0 | 0 | Two separate files of course. The idea is the unit test should be non-intrusive and should sit in the own file, usually clearly put under a test directory and/or named test_*. I have never seen people put it in the same file unless it is the most trivial demo. | 1 | 2 | 0 | I want to ask if I should include the function that I am testing inside the unittest file (such that I will have one file, unittest.py), or I should just import it in the unittest file (I will have two files, unittest.py and function.py). I am seeing both methods when I read in the web, however I find the first testing... | Should I include the function that I am testing inside the unittest file, or should I just import it in the unittest file? | 1.2 | 0 | 0 | 42 |
8,955,778 | 2012-01-21T19:01:00.000 | 4 | 0 | 0 | 1 | python,ld,cython,opensuse | 8,956,663 | 1 | false | 0 | 0 | Use PYTHONPATH instead of LD_LIBRARY_PATH. | 1 | 0 | 0 | Got a problem with my project on OpenSUSE 12.1:
somehow it ignores the path to libs provided in $LD_LIBRARY_PATH.
The structure of calls is as follows:
My python module adds the path to libs to $LD_LIBRARY_PATH,
then imports cython module (interface.so) depending on some other corefuncs.so file.
It worked fine on Ubunt... | Python 2.7 doesn't look for .so libs in $LD_LIBRARY_PATH (OpenSUSE 12.1 x64) | 0.664037 | 0 | 0 | 693 |
8,957,400 | 2012-01-21T22:48:00.000 | 0 | 1 | 1 | 0 | python,complexity-theory,deep-copy | 8,957,592 | 3 | false | 0 | 0 | The complexity of deepcopy() is dependant upon the size (number of elements/children) of the object being copied.
If your algorithm's inputs do not affect the size of the object(s) being copied, then you should consider the call to deeopcopy() to be O(1) for the purposes of determining complexity, since each invocati... | 2 | 4 | 0 | I'm trying to improve the speed of an algorithm and, after looking at which operations are being called, I'm having difficulty pinning down exactly what's slowing things up. I'm wondering if Python's deepcopy() could possibly be the culprit or if I should look a little further into my own code. | What is the runtime complexity of Python's deepcopy()? | 0 | 0 | 0 | 8,858 |
8,957,400 | 2012-01-21T22:48:00.000 | 1 | 1 | 1 | 0 | python,complexity-theory,deep-copy | 8,957,598 | 3 | false | 0 | 0 | What are you using deepcopy for? As the name suggests, deepcopy copies the object, and all subobjects recursively, so it is going to take an amount of time proportional to the size of the object you are copying. (with a bit of overhead to deal with circular references)
There isn't really any way to speed it up, if you ... | 2 | 4 | 0 | I'm trying to improve the speed of an algorithm and, after looking at which operations are being called, I'm having difficulty pinning down exactly what's slowing things up. I'm wondering if Python's deepcopy() could possibly be the culprit or if I should look a little further into my own code. | What is the runtime complexity of Python's deepcopy()? | 0.066568 | 0 | 0 | 8,858 |
8,957,711 | 2012-01-21T23:42:00.000 | 2 | 0 | 0 | 0 | python,django | 8,957,923 | 1 | false | 1 | 0 | Probably, the best place for this is the end of the settings.py ;-) | 1 | 0 | 0 | Is there a way that I can call some functions/modules right after all the settings in Django have been imported? | Django post initialization modules | 0.379949 | 0 | 0 | 74 |
8,963,987 | 2012-01-22T19:31:00.000 | 1 | 0 | 0 | 0 | python,dijkstra,path-finding,a-star | 8,964,029 | 2 | true | 0 | 0 | You could suppose that the zombies can see everything within a particular range (radius or perhaps be more clever) and then have the human look for a spot that he thinks the zombies can't see. Pick the closest spot the zombie can't see and use the A* algorithm to find a path if one exists, else try a different one. Loo... | 2 | 0 | 0 | I'm developing a small game in python. I am using a 2D rectangular grid. I know that for pathfinding I can use A* and the likes, I know how this works, but the problem I have is a bit different.
Let's say we have a computer controlled human and some computer controlled zombies. When the human spots a zombie, it should ... | Get away from an object in a 2D-grid | 1.2 | 0 | 0 | 239 |
8,963,987 | 2012-01-22T19:31:00.000 | 0 | 0 | 0 | 0 | python,dijkstra,path-finding,a-star | 8,964,083 | 2 | false | 0 | 0 | Just off the top of my head, you'll probably be able to do some vector math and have the human run in the normal vector to the zombies.
I don't know how well this will work (or how it will scale to the number of zombies you have), but you could do something like:
For each zombie, compute the distance to the human and... | 2 | 0 | 0 | I'm developing a small game in python. I am using a 2D rectangular grid. I know that for pathfinding I can use A* and the likes, I know how this works, but the problem I have is a bit different.
Let's say we have a computer controlled human and some computer controlled zombies. When the human spots a zombie, it should ... | Get away from an object in a 2D-grid | 0 | 0 | 0 | 239 |
8,964,315 | 2012-01-22T20:15:00.000 | 0 | 0 | 1 | 1 | c++,python,c,windows,io | 8,964,345 | 5 | false | 0 | 0 | You can use pipe.
prgm.exe | anotherprogram.exe
Just remember that the anotherprogram will get the whole output of prgm.exe | 1 | 1 | 0 | In a DOS .exe program (with no access to source code), the DOS screen says: rate = 60. (or some other value).
How do I read the output "60" to use as input to an application I'm making in Python or C/C++,
other than by reading and typing it (I want to run it dozens of times).
This program runs in Windows XP mode. | Read values from a running program | 0 | 0 | 0 | 289 |
8,964,736 | 2012-01-22T21:12:00.000 | 1 | 1 | 1 | 0 | python,numpy,aptitude | 8,966,563 | 4 | false | 0 | 0 | Apt/dpkg have a Debian way of managing multiple installed versions of Python (I believe it is called python-support). Any extra package, like numpy, that you install will automatically be built and available for all the versions of Python supported by that package AND installed by dpkg. Since numpy supports every Pyt... | 2 | 4 | 0 | On a lab machine where I can't just go clobbering things, there appears to be more than one version of python installed.
If I python --version I see 2.7.1.
I've installed numpy via "apt-get install numpy" and it says it is installed, but when I try to import it it isn't found.
When I do a find on the machine for... | Multiple versions of python when installing a package with aptitude | 0.049958 | 0 | 0 | 10,268 |
8,964,736 | 2012-01-22T21:12:00.000 | 0 | 1 | 1 | 0 | python,numpy,aptitude | 8,976,574 | 4 | false | 0 | 0 | Debian allows for multiple Pythons to be installed (the python2.5 and python2.6 packages). A Python library like numpy in the package python-numpy can support multiple of these, but particular libraries installed through the package manager are not necessarily supported on all of these. You can use apt-cache show pyt... | 2 | 4 | 0 | On a lab machine where I can't just go clobbering things, there appears to be more than one version of python installed.
If I python --version I see 2.7.1.
I've installed numpy via "apt-get install numpy" and it says it is installed, but when I try to import it it isn't found.
When I do a find on the machine for... | Multiple versions of python when installing a package with aptitude | 0 | 0 | 0 | 10,268 |
8,965,120 | 2012-01-22T22:01:00.000 | 5 | 0 | 1 | 0 | python,django,python-3.x,python-2.x | 8,965,225 | 5 | false | 1 | 0 | If you already are familiar with Python 3, then there are almost no differences you will have to worry about when coding in Python 2. The most user-visible differences have to do with details of the print statement, which you probably won't be using for Django anyway.
So, just write code, and ask about any specific pro... | 1 | 7 | 0 | I have some knowledge of Python 3 (I'm not a beginner, but I'm not an expert). I'm interested in web development, so I want to use Django. What are the differences between the two versions of Python? How should I switch from 3 to 2.x? | How do I learn Python 2 if I already know Python 3? | 0.197375 | 0 | 0 | 501 |
8,965,123 | 2012-01-22T22:02:00.000 | 3 | 0 | 0 | 0 | python,sparql,mysql-python,dbpedia | 8,965,215 | 1 | false | 0 | 0 | try splitting up the .query() and .convert() into two separate lines. I would guess that .query() is where it's hanging, and I would further guess that you are being rate-limited by DBPedia, but I can't find any information on what their limits might be. | 1 | 1 | 0 | In python, I am firing Sparql queries to get data from dbpedia.
At a point approximately firing 7,000 queries, my script is hangs at line results = sparql.query().convert()
which is already executed atleast 5000 times in the loop
Any idea what could be the issue in it | python script hangs at results = sparql.query().convert() | 0.53705 | 1 | 1 | 157 |
8,965,185 | 2012-01-22T22:10:00.000 | 2 | 0 | 1 | 0 | continuations,pypy,python-stackless,tail-call-optimization,stackless | 12,525,415 | 1 | true | 0 | 0 | the reason is that the new continulets work on the os level stack, which is limited
(however they are much more simple than the old stackless transform in the translation process)
there is a current work in progress for continulet jit that experiments with the stack being gc-managed blocks
if that is successfull, the "... | 1 | 4 | 0 | Default build of PyPy 1.7 with stackless included in, does not offer the ability to run with no recursion depth limit (in straight way).
Why?
Previus builds of PyPy with stackless support continuation style of function call and tail recursion.
I'm not asking about solutions involving coroutines, but the looking for the... | Why PyPy 1.7 desn't implement "stackless" stack? | 1.2 | 0 | 0 | 647 |
8,966,244 | 2012-01-23T01:05:00.000 | 0 | 0 | 0 | 0 | python,regex,negative-lookahead | 8,966,597 | 4 | false | 1 | 0 | I don't think you can do this one with regex alone (especially looking before the keyword match) as it has no sense of comparing distances.
I think you're best off doing something like this:
find all occurences of sales & get substring index, called salesIndex
find all occurences of https?://[-A-Za-z0-9./]+ and get t... | 1 | 4 | 0 | If I'm looking for the keyword "sales" and I want to get the nearest "http://www.somewebsite.com" even if there is multiple links in the file. I want the nearest link not the first link. This means I need to search for the link that comes just before the keyword match.
This doesn't work...
regex = (http|https)://[-A... | Using Regex to Search for HTML links near keywords | 0 | 0 | 1 | 366 |
8,968,884 | 2012-01-23T08:35:00.000 | 0 | 0 | 1 | 0 | python,serialization,pickle | 55,150,034 | 4 | false | 0 | 0 | I find it to be particularly useful with large and complex custom classes. In a particular example I'm thinking of, "Gathering" the information (from a database) to create the class was already half the battle. Then that information stored in the class might be altered at runtime by the user.
You could have another gro... | 1 | 98 | 0 | I understood that Python pickling is a way to 'store' a Python Object in a way that does respect Object programming - different from an output written in txt file or DB.
Do you have more details or references on the following points:
where are pickled objects 'stored'?
why is pickling preserving object representation... | Python serialization - Why pickle? | 0 | 0 | 0 | 53,631 |
8,970,713 | 2012-01-23T11:12:00.000 | 3 | 0 | 0 | 0 | python,http,wsgi,webob | 8,975,702 | 2 | true | 1 | 0 | It would depend on your front-end server. If it has any configuration to block big request even before it goes into your app, use it.
If you want to block this with your code I see two approaches:
Look ate the Content-Length HTTP Header. If it's bigger than you can handle, deny the request right away.
Don't trust the ... | 1 | 5 | 0 | I'm trying to get an understanding of the best way of handling file uploads safely in a wsgi app. It seems a lot of solutions involve using FieldStorage from the cgi module to parse form data. From what I understand about FieldStorage it performs a bit of 'magic' behind the scenes by streaming data into a tempfile.
Wha... | How do you restrict large file uploads in wsgi? | 1.2 | 0 | 0 | 1,729 |
8,971,115 | 2012-01-23T11:47:00.000 | 2 | 1 | 0 | 0 | python,session,authorization,pyramid | 8,973,728 | 1 | true | 1 | 0 | If you've figured out how to do this for authenticated users, it should be obvious how to do it for anonymous users as well. They will have the pyramid.security.Everyone principal, which you can use in your ACLs to assign various permissions.
Route factories will allow you to assign custom ACLs to individual routes. Th... | 1 | 0 | 0 | I'm setting up a pyramid application where access to ressources can be shared across registered users.
I would also like to give access to non-members, using non-trivial links to files or directories.
While I see how to do this for registered members, I'm not sure how to do this with anonymous users. Do I need to crea... | url-enabled access to ressources with pyramid | 1.2 | 0 | 0 | 88 |
8,972,462 | 2012-01-23T13:35:00.000 | 0 | 0 | 0 | 0 | python,python-idle | 8,972,537 | 1 | false | 0 | 1 | Idle runs the python commands you enter in another process, so it's reasonable to expect this "lock up" behavior to be different between the program controlled window and Idle.
What's probably going on, though is that everything is fine, but you have not yet started the event loop in the program you're typing in. The ... | 1 | 0 | 0 | A real newbie question here.
I'm using IDLE 2.7.2 on OSX 10.7.2 and reading Zelle's Python:Programming. I haven't programmed since the 80's, so after going through the command line stuff, I'm excited to dive into Objects. I grab his graphics.py file and copy it into documents (this seems like the default location for I... | Graphics Window Crashing in IDLE | 0 | 0 | 0 | 2,037 |
8,978,653 | 2012-01-23T21:12:00.000 | 0 | 0 | 0 | 1 | python,http,nginx,wsgi,uwsgi | 8,978,823 | 1 | false | 0 | 0 | Two solutions come to mind:
Link client to IP address and/or other headers the client is sending;
Upon first connection create a session ID and change all the links on the page to /link/to/page?sid=%(sessionid)s. It's not very pretty but it works. | 1 | 3 | 0 | I am using the following setup:
client -> Nginx -> uWSGI -> Python app
The connection between the client and Nginx is persistent. I am aware that there is no support for persistent connection between Nginx and uWSGI.
Is there a way to pass the Nginx connection ID to uWSGI so I can differentiate between clients? I am tr... | client connection id passed from nginx to uwsgi | 0 | 0 | 0 | 475 |
8,981,103 | 2012-01-24T01:42:00.000 | 5 | 0 | 0 | 1 | python,google-app-engine,blobstore | 8,981,549 | 4 | false | 1 | 0 | No, there's no way to do this. The blobstore can be aribrarily large, far larger than is practical to download in a single file. | 3 | 2 | 0 | I would like to download all blobs as a single zipped file (or another way) to my computer. Anyway to do that? I use the python SDK. | App Engine Blobstore download all blobs at once | 0.244919 | 0 | 0 | 578 |
8,981,103 | 2012-01-24T01:42:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine,blobstore | 8,993,546 | 4 | false | 1 | 0 | It's probably better to download them one at a time anyway. That way if your job dies part way through you can restart for where it failed rather than starting over again from scratch. | 3 | 2 | 0 | I would like to download all blobs as a single zipped file (or another way) to my computer. Anyway to do that? I use the python SDK. | App Engine Blobstore download all blobs at once | 0.049958 | 0 | 0 | 578 |
8,981,103 | 2012-01-24T01:42:00.000 | -1 | 0 | 0 | 1 | python,google-app-engine,blobstore | 9,376,684 | 4 | false | 1 | 0 | How about copy the blobs to google storage and then use gsutil to download the blobs from there? | 3 | 2 | 0 | I would like to download all blobs as a single zipped file (or another way) to my computer. Anyway to do that? I use the python SDK. | App Engine Blobstore download all blobs at once | -0.049958 | 0 | 0 | 578 |
8,982,704 | 2012-01-24T06:10:00.000 | 1 | 0 | 0 | 0 | python | 8,982,872 | 2 | false | 0 | 0 | Javascript is just a client-side thing. It doesn't matter what you select in the alert box. If you press Cancel, it won't happen but if you press OK, it will POST the form data.
You don't need to emulate a button press of OK. So, what really matters is to sniff the POST data. For that you can use Firebug (in Firefox) o... | 1 | 3 | 0 | I'm trying to test an application where a user enters information into a gui, clicks on save button and then has to click "ok" in an alert/prompt popup window for the request to take place to the web service.
I'm using a python script to automate the requests to the web service.
My question is:
after submitting the use... | Interacting with alert/prompt popup window with python | 0.099668 | 0 | 1 | 2,520 |
8,985,234 | 2012-01-24T10:29:00.000 | 1 | 0 | 1 | 0 | python,ipython | 9,012,249 | 1 | true | 0 | 0 | I don't know of that feature, but you can take advantage of the Out variable (also available as _oh) that is automatically exposed in the ipython console. Basically it's a dictionary in which the keys are the line numbers for which some kind of result was returned and the values are the results themselves. Hence, if yo... | 1 | 4 | 0 | I'm using ipython with qtconsole.
A feature I'm missing from the regular console is to search the console output.
I'd expect to see it under the Edit menu.
Is there a way to do it? | Is there a way to search for text in the ipython qtconsole? | 1.2 | 0 | 0 | 155 |
8,989,328 | 2012-01-24T15:22:00.000 | 0 | 0 | 1 | 1 | python,ctypes | 8,989,530 | 2 | false | 0 | 1 | CPython doesn't contain C++ code and thus there is no requirement with regards to the C++ compiler used to compile a C++ library loaded into a CPython process. However, the C layer and the C++ library must generally be compiled with the same C++ compiler. And if the C++ library or the C layer link against libpython, ... | 2 | 2 | 0 | I'm running into some really weird problems with ctypes. I'm using ctypes to interface to a C++ library that has a C interface. The library has lots of parallel functionality. More often than not, the parallel calls tend to end up with a segfault from the C++ layer, but I've run into them with some serial code too. ... | ctypes - does python need to be compiled with same version as C library? | 0 | 0 | 0 | 337 |
8,989,328 | 2012-01-24T15:22:00.000 | 4 | 0 | 1 | 1 | python,ctypes | 8,989,579 | 2 | true | 0 | 1 | There's no requirement at all that the native library that you call with ctypes has to be built with a matching runtime. In fact there's not even a requirement that the native library even uses a C runtime.
For example you can use ctypes to call code written in other languages, e.g. Delphi. Or you can use ctypes to cal... | 2 | 2 | 0 | I'm running into some really weird problems with ctypes. I'm using ctypes to interface to a C++ library that has a C interface. The library has lots of parallel functionality. More often than not, the parallel calls tend to end up with a segfault from the C++ layer, but I've run into them with some serial code too. ... | ctypes - does python need to be compiled with same version as C library? | 1.2 | 0 | 0 | 337 |
8,989,593 | 2012-01-24T15:39:00.000 | -1 | 0 | 1 | 0 | python,virtualenv,textmate2 | 9,907,386 | 4 | false | 0 | 0 | TM_PYTHON in the TM2 preferences for environment variables determines the Python to the preferred interpreter, but I did not find out yet, how to set the PYTHONPATH for TM2 yet. | 1 | 9 | 0 | I'd like to work in my virtualenv from textmate 2, but i really have no idea on how to indicate text mate the env of python it has to use.
If anyone can help, thank you. | Set virtualenv for python in textmate 2 | -0.049958 | 0 | 0 | 1,749 |
8,990,387 | 2012-01-24T16:27:00.000 | 7 | 0 | 1 | 0 | python,ipython,filehandle | 8,990,557 | 2 | false | 0 | 0 | A few ideas:
use always finally (or a with block) when working with files, so they are properly closed.
you can blindly close the non standard file descriptors using os.close(n) where n is a number greater than 2 (this is unix specific, so you might want to peek /proc/ipython_pid/fd/ to see what descriptors the proces... | 1 | 14 | 0 | Sometimes when using ipython you might hit an exception in a function which has opened a file in write mode. This means that the next time you run the function you get a value error,
ValueError: The file 'filename' is already opened. Please close it before reopening in write mode.
However since the function bugged o... | Close all open files in ipython | 1 | 0 | 0 | 35,624 |
8,992,077 | 2012-01-24T18:31:00.000 | 1 | 1 | 0 | 1 | java,python,c,parsing,command-line | 8,993,917 | 1 | true | 1 | 0 | getopt is also usable in Python and shell. Python has the argparse module, which is much easier to use (particularly for more complex argument parsing), but if you want consistency across all those languages, I don't know of any better option than getopt. If Java doesn't have a getopt implementation, you could possibl... | 1 | 4 | 0 | I am looking for a library to parse command-line parameters that would work identically in Java, C/C++, Python and (preferably) shell. By "identical" I mean (1) have exactly the same rules for parsing of the parameters in all three languages, (2) use the same configuration files or have similar API to specify the para... | Parser for command line parameters in Java/C/C++/Python/shell | 1.2 | 0 | 0 | 393 |
8,999,047 | 2012-01-25T07:16:00.000 | 0 | 0 | 0 | 0 | python,arcmap | 10,212,782 | 2 | false | 0 | 0 | Saving the output in a file geodatabase (which is probably what your default output location is) will create a feature class, which by default adds the shape_length and shape_area columns. Saving the output into a regular folder will create a shapefile, which does not create these fields by default. If your python sc... | 1 | 0 | 0 | I just encounter a little bug, maybe someone can help me.
I'm creating Thiessen Polygons.
I define my shapefile in Input Features, and in Output Feature Class, then I have to possibilities either keep the default file or save my output where I want.
When I save my output in the Default file, and then I open the attrib... | Bug output feature class | 0 | 0 | 0 | 172 |
8,999,444 | 2012-01-25T08:02:00.000 | 1 | 0 | 1 | 0 | python,regex,string | 8,999,513 | 2 | false | 0 | 0 | If you don't want to check character by character, and this is EXACTLY the source you have, you can check line by line, and search for empty ones.
Depending on implementation, I am not sure it would be much more efficient thus. Possibly the opposite. | 1 | 1 | 0 | This is the source text I want to parse:
1
From fairest creatures we desire increase,
That thereby beauty's rose might never die,
But as the riper should by time decease,
His tender heir might bear his memory:
But thou contracted to thine own bright eyes,
Feed... | Parsing from Shakespeare text in Python | 0.099668 | 0 | 0 | 402 |
9,001,046 | 2012-01-25T10:23:00.000 | 1 | 1 | 1 | 0 | php,python,editor,notepad++ | 9,001,202 | 2 | false | 0 | 0 | You could check out the "Run" menu option. It allows you to bind key combinations to applications. | 1 | 1 | 0 | I want If I am editing a php file I should be able to press a key combination or click a menu item that'll launch the php-cli and run my current file? How do I do it in Notepad++.
Also I need this for Python. | How can I integrate PHP/Python Interpreter to Notepad++ | 0.099668 | 0 | 0 | 3,513 |
9,001,219 | 2012-01-25T10:35:00.000 | 2 | 0 | 1 | 0 | c#,com,ironpython | 9,001,555 | 3 | false | 0 | 1 | The as operator is a "safe cast" operator, it converts the variable_2 to type data_type_2. If that conversion fails, it doesn't throw an exception but returns null.
Further, to be able to assign a value of data_type_2 (the result of the 'as' expression) to a variable of data_type_1, that data_type_2 must be derived fro... | 2 | 0 | 0 | I don't know if this is a simple matter of RTFM, but bear with me as it was a while ago I used a statically typed language...
I'm porting some C# code to IronPython, and I just stumbled on this statement below. I'm not at liberty to post the actual code, so I'll write it in pseudo code instead:
data_type_1 variable_1 =... | How can I translate this C# variable declaration to something IronPython can handle? | 0.132549 | 0 | 0 | 138 |
9,001,219 | 2012-01-25T10:35:00.000 | 1 | 0 | 1 | 0 | c#,com,ironpython | 9,004,636 | 3 | false | 0 | 1 | After killing a few hours I figured I might as well do it the simple but perhaps not the prettiest way. I simply downloaded Visual C# 2010 Express (free version) and wrote a minimal Class Library containing one method consisting of only the troublesome statement. I then built the dll, which was promptly imported and us... | 2 | 0 | 0 | I don't know if this is a simple matter of RTFM, but bear with me as it was a while ago I used a statically typed language...
I'm porting some C# code to IronPython, and I just stumbled on this statement below. I'm not at liberty to post the actual code, so I'll write it in pseudo code instead:
data_type_1 variable_1 =... | How can I translate this C# variable declaration to something IronPython can handle? | 0.066568 | 0 | 0 | 138 |
9,001,434 | 2012-01-25T10:49:00.000 | 1 | 0 | 1 | 0 | python,coding-style | 9,001,676 | 2 | false | 1 | 0 | I don't think this is even python related. In general you'll have something like this:
Load settings from file
Use and maybe modify settings in memory.
Write settings to file.
Detecting a settings modification would either introduce a change in 2 (keep a "changed" state) or in 3 (diff with the current persisted setti... | 1 | 1 | 0 | I am kind of beta testing a small python app - whenever the app is closed the settings are saved, even when I made no changes. I was wondering if this is general practice - sounds like settings should be saved only when a change is made but are there reasons (apart from the reduced complexity) pro saving settings alway... | General : always saving settings on close vs saving only when changed | 0.099668 | 0 | 0 | 84 |
9,007,456 | 2012-01-25T17:45:00.000 | 3 | 0 | 1 | 0 | python,http,asynchronous,urllib2,urllib | 13,502,466 | 3 | false | 0 | 0 | As we've been talking already I made such one using PycURL.
The one, and only one, thing I had to do was pycurl_instance.setopt(pycurl_instance.NOSIGNAL, 1) to prevent crashes.
I did use APScheduler to fire requests in the separate threads. Thanks to your advices of changing busy waiting while True: pass to while True:... | 1 | 6 | 0 | In order to download files, I'm creating a urlopen object (urllib2 class) and reading it in chunks.
I would like to connect to the server several times and download the file in six different sessions. Doing that, the download speed should get faster. Many download managers have this feature.
I thought about specifying ... | Parallel fetching of files | 0.197375 | 0 | 1 | 10,489 |
9,007,887 | 2012-01-25T18:12:00.000 | 4 | 1 | 0 | 0 | python,pyramid | 9,010,633 | 3 | false | 0 | 0 | Or you can use request.environ['REMOTE_ADDR'] | 1 | 15 | 0 | I'm using Pyramid framework and I want to access the IP address from which the request originated. I assume it's in the request object (passed to every view function) somewhere, but I can't find documentation which tells me where it is. | Getting the request IP address with Pyramid | 0.26052 | 0 | 0 | 5,593 |
9,008,502 | 2012-01-25T18:55:00.000 | -1 | 0 | 0 | 0 | python,hash,unique,key | 9,008,635 | 3 | false | 1 | 0 | MD5 of datetime.now() (at a time of file upload) will be OK, imho. | 1 | 1 | 0 | I have a listing of millions of files and am uploading them to Amazon's S3. I need to create unique keys for each of the images. I'd rather not use md5 because it requires scanning the entire file, which can be slow. Additionally, there could be duplicate images, which is allowed in our application. Any suggestion for ... | What's a good strategy for generating unique hash keys for a very large collection of images in Python? | -0.066568 | 0 | 0 | 2,116 |
9,008,851 | 2012-01-25T17:33:00.000 | 6 | 0 | 1 | 0 | python,refactoring,developer-tools | 9,008,852 | 4 | false | 0 | 0 | Why can't you do this manually? 500 lines is not that much to deal with. I doubt any tool will be able to split up a class meaningfully in the context of the purpose it serves. I suggest you split it up on your own and redesign/refactor the code while you're at it. | 2 | 1 | 0 | Is there a good aid/tool for helping me split a huge class into parts?
The code does its job well, but having a class over 500 lines is not comfortable. I am sure it could be split up into smaller pieces.
This time I am interested in a tool for python, but I am sure it does not count. | Tool helping split a huge class into two | 1 | 0 | 0 | 130 |
9,008,851 | 2012-01-25T17:33:00.000 | 1 | 0 | 1 | 0 | python,refactoring,developer-tools | 9,008,854 | 4 | false | 0 | 0 | First of all, what is it about the 500 lines of code that makes you "not comfortable"? Why do you think you need to only split the class into two new classes? Perhaps the class is fine as it is (500 isn't huge), or, perhaps the class needs to be split into 3 or 4 different classes.
Without more information, I'd say tha... | 2 | 1 | 0 | Is there a good aid/tool for helping me split a huge class into parts?
The code does its job well, but having a class over 500 lines is not comfortable. I am sure it could be split up into smaller pieces.
This time I am interested in a tool for python, but I am sure it does not count. | Tool helping split a huge class into two | 0.049958 | 0 | 0 | 130 |
9,009,807 | 2012-01-25T20:30:00.000 | 2 | 1 | 1 | 0 | python,md5,hashlib | 9,009,930 | 4 | false | 0 | 0 | The easiest way would be to combine the 3 sums into a single 96-character string and run an MD5 hash on that. | 1 | 3 | 0 | I have (3) md5sums that I need to combine into a single hash. The new hash should be 32-characters, but is case-sensitive and can be any letter or number. What's the best way to do this in Python? | Combine (3) 32-char hex hashes into a single unique 32-char hash? | 0.099668 | 0 | 0 | 1,664 |
9,016,332 | 2012-01-26T09:53:00.000 | 6 | 0 | 1 | 0 | python,generator | 9,016,374 | 2 | false | 0 | 0 | Okay, so as I was typing that last line of the question I think I figured this out.
E += f() is list concatenation, which implies the result of f() must be iterable, and furthermore, that iterator is evaluated as part of of the concatenation, meaning f().next is called
E += [f()] wraps the generator object in a and it... | 1 | 4 | 0 | I have a function (f) with a yield. I have a list (E).
If I try E += f() then f() doesn't return a generator object, but instead runs the function, which throws an exception because some global variables aren't ready.
To forestall any comments, I know E += f() is wrong, but it provides an example for my question. I... | When is a generator not a generator? Why does calling my function with yield not return a generator object sometimes | 1 | 0 | 0 | 1,606 |
9,019,873 | 2012-01-26T14:47:00.000 | 1 | 1 | 0 | 0 | python,zeromq | 9,019,940 | 4 | false | 0 | 0 | You don't. You might close or delete things explicitly in Python when:
Ordering becomes important, such as requiring the connection to be closed before you can proceed.
Your references to the objects will persist for a long time, and the resource will no longer be required after some time. This might happen if you're ... | 2 | 8 | 0 | In C/C++ like languages, closing zeromq socket explicitly is a must, which I understand. But in some higher level languages, such as php and python, which have garbage collection mechanism, do I need to close the sockets explicitly?
In php, there is no ZMQSocket::close() and in python, pyzmq's doc says socket.close() c... | Should I close zeromq socket explicitly in python? | 0.049958 | 0 | 0 | 13,070 |
9,019,873 | 2012-01-26T14:47:00.000 | 3 | 1 | 0 | 0 | python,zeromq | 9,399,409 | 4 | true | 0 | 0 | It is always correct to close any I/O resources when you are done with them. The garbage collector will close them off eventually. It may close it immediately once the last reference goes out of scope. It may close it as your program is exiting. While you wait for it to do so, the resource remains open taking up memory... | 2 | 8 | 0 | In C/C++ like languages, closing zeromq socket explicitly is a must, which I understand. But in some higher level languages, such as php and python, which have garbage collection mechanism, do I need to close the sockets explicitly?
In php, there is no ZMQSocket::close() and in python, pyzmq's doc says socket.close() c... | Should I close zeromq socket explicitly in python? | 1.2 | 0 | 0 | 13,070 |
9,019,949 | 2012-01-26T14:52:00.000 | 1 | 0 | 0 | 0 | python,statistics,matplotlib | 9,020,306 | 2 | false | 0 | 0 | I think what you want is a variance plot. Create a dictionary for distinct x values. Put each distinct value of y in a list associated with each x. Find the stdev (np.std) of the list associated with each x say "s". Plot the s vs. x. | 1 | 2 | 1 | i apologize in advance for not being very precise, as a i dont know the mathematical expression for what i want.
i am using matplotlib to analyze a large dataset. What i have now is a distribution of x,y points. I want to find out the cases in which the x values of my function are the same, but y differs the greatest.... | Finding 'edge cases' in a dataset | 0.099668 | 0 | 0 | 960 |
9,020,589 | 2012-01-26T15:34:00.000 | 0 | 0 | 0 | 0 | python,django,django-templates,setup.py | 9,020,680 | 1 | false | 1 | 0 | Either you chose a name for your project that conflicts with an existing python package and it's merely coincidental, or you somehow managed to build your project as an egg. I'm not sure how you would do that and not realize you had done that, though.
Regardless, check the package to make sure that it is in fact your c... | 1 | 0 | 0 | After I run setup.py to install a project, the project admin works fine but here's the problem.
Except of the project running from my c:\project.
It's runs from another location at C:\Python27\Lib\site-packages\project-0.1-py2.7.egg\project
Why does it clone my project to the site-packages location?
And why does it run... | Django project loads in site-packages | 0 | 0 | 0 | 290 |
9,022,723 | 2012-01-26T17:44:00.000 | 0 | 0 | 1 | 1 | python,macos,installation | 9,024,848 | 2 | false | 0 | 0 | No side effects, you can also use alias python3="/directory/where/python_binary" to get python3 as an shortcut to real python binary. | 2 | 0 | 0 | I have Python 3.2.2 downloaded and have been using IDLE to execute code; however, I was wondering whether it is possible to have Python 3.2.2 run through Terminal as opposed to Python 2.6.1 on which it is currently running.
How would I got about doing so? Would there be any bad side effects? | Install Python 3.2.2 on Mac OS X 10.6.8 | 0 | 0 | 0 | 1,804 |
9,022,723 | 2012-01-26T17:44:00.000 | 0 | 0 | 1 | 1 | python,macos,installation | 9,022,756 | 2 | true | 0 | 0 | Sure, start the terminal and type python3.2. That should get you into a Python 3.2 shell. | 2 | 0 | 0 | I have Python 3.2.2 downloaded and have been using IDLE to execute code; however, I was wondering whether it is possible to have Python 3.2.2 run through Terminal as opposed to Python 2.6.1 on which it is currently running.
How would I got about doing so? Would there be any bad side effects? | Install Python 3.2.2 on Mac OS X 10.6.8 | 1.2 | 0 | 0 | 1,804 |
9,022,943 | 2012-01-26T18:01:00.000 | 12 | 0 | 0 | 1 | python,postgresql,fedora,psycopg2 | 9,023,190 | 1 | true | 0 | 0 | You are probably searching python-devel and postgresql-devel packages. | 1 | 8 | 0 | I'm trying to install psycopg2, using pip, on Fedora.
I get the message:
"pg_config executable not found."
In ubuntu, this problem can be resolved by installing the libpq-dev and python-dev packages. There's no clear analogous solution in Fedora. | psycopg2 on Fedora | 1.2 | 0 | 0 | 5,081 |
9,027,355 | 2012-01-27T00:07:00.000 | 3 | 0 | 1 | 0 | python,merge,numpy | 9,027,774 | 3 | false | 0 | 0 | You can use a dictionary if the values are lists. defaultdict in the collections module is very useful for this. | 1 | 3 | 1 | I have a csv file in which the first column contains an identifier and the second column associated data. The identifier is replicated an arbitrary number of times so the file looks like this.
data1,123
data1,345
data1,432
data2,654
data2,431
data3,947
data3,673
I would like to merge the records to generate a single... | merging records in python or numpy | 0.197375 | 0 | 0 | 267 |
9,027,884 | 2012-01-27T01:25:00.000 | 1 | 1 | 0 | 0 | python,twitter,twitter-oauth,tweepy | 9,056,152 | 3 | true | 0 | 0 | I used the .filter function then filtered for the user I was looking for. | 2 | 0 | 0 | I am looking through the Tweepy API and not quite sure how to find the event to register for when a user either send or receives a new tweet. I looked into the Streaming API but it seems like that is only sampling the Twitter fire house and not really meant for looking at one indvidual user. What I am trying to do is... | How to register an event for when a user has a new tweet? | 1.2 | 0 | 1 | 183 |
9,027,884 | 2012-01-27T01:25:00.000 | 1 | 1 | 0 | 0 | python,twitter,twitter-oauth,tweepy | 9,028,060 | 3 | false | 0 | 0 | I don't think there is any event based pub-sub exposed by twitter. You just have to do the long polling. | 2 | 0 | 0 | I am looking through the Tweepy API and not quite sure how to find the event to register for when a user either send or receives a new tweet. I looked into the Streaming API but it seems like that is only sampling the Twitter fire house and not really meant for looking at one indvidual user. What I am trying to do is... | How to register an event for when a user has a new tweet? | 0.066568 | 0 | 1 | 183 |
9,028,174 | 2012-01-27T02:11:00.000 | 2 | 0 | 1 | 0 | c++,visual-c++,wxpython,wxwidgets,codeblocks | 9,028,282 | 1 | true | 0 | 1 | There's a good chance that Code:Blocks has a default setting for the executable path that includes the path to the libraries. As Windows finds the DLLs using the PATH environment variable this will ensure that your application works inside CodeBlocks.
However in order to run it outside CodeBlocks you'd need to either c... | 1 | 1 | 0 | I have created a program in Codeblocks (wxWidgets Application) I have compiled it and it runs perfectly when executed from the codeblocks interface ....however when i go into the release folder and run the executable it gives me *.dll file errors :/
How do i make the program ? | How to compile a program in wxSmith ( Codeblocks ) with all the libraries? | 1.2 | 0 | 0 | 825 |
9,030,601 | 2012-01-27T08:23:00.000 | 0 | 0 | 1 | 1 | python,floating-point,numbers,int,division | 9,030,620 | 3 | false | 0 | 0 | Special case the last thread -- assign it to get however many bytes are left. | 1 | 2 | 0 | I want to make a multi-threaded downloader (in Python) and I need to tell each thread where to start and how many bytes to download. For that I get the remote file size and divide it, for example, to 2. Now, let's say that the remote file size is 5: when I divide the number to 2, I get 2 as result. Now I can start the ... | Partitioning a file for parallel download | 0 | 0 | 0 | 113 |
9,030,953 | 2012-01-27T09:01:00.000 | 0 | 0 | 0 | 0 | python,scrapy | 9,144,538 | 2 | false | 1 | 0 | 1)you can use custom Csv feed exporter each item key will be treated as a column heading and value as column value.
2) you can write a pipeline that can write data in csv file using python csv lib. | 2 | 0 | 1 | Please help me in creating columns and inserting rows under them in a csv file using python scrapy. I need to write scraped data into 3 columns. So first of all three columns are to be created and then data is to be entered in each row. | How to create columns in a csv file and insert row under them in python scrapy | 0 | 0 | 0 | 506 |
9,030,953 | 2012-01-27T09:01:00.000 | 1 | 0 | 0 | 0 | python,scrapy | 9,032,800 | 2 | false | 1 | 0 | CSV is a Comma Saparated Values format. That basically means that it is a text file with some strings separated by commas and line-downs.
Each line down creates a row and each comma creates a column in that row.
I guess the simplest way to create a CSV file would be to create a Pythonic dict where each key is a column ... | 2 | 0 | 1 | Please help me in creating columns and inserting rows under them in a csv file using python scrapy. I need to write scraped data into 3 columns. So first of all three columns are to be created and then data is to be entered in each row. | How to create columns in a csv file and insert row under them in python scrapy | 0.099668 | 0 | 0 | 506 |
9,034,799 | 2012-01-27T14:31:00.000 | 0 | 0 | 1 | 1 | python,cmd | 9,034,986 | 3 | false | 0 | 0 | You can run it through IDLE, the built-in editor. It may not be much helpful if you have to provide command-line args.
An alternate option may be making the code wait for a keypress using raw_input(), as Insidi0us said.
You can also print the errors to a file.
Another option may be running the command prompt first, the... | 2 | 1 | 0 | I have no idea why python run every script in a new command window.
For example I run: python testfile.py, it is show new window and close immediately, so I can't look the traceback.
Python 2.7 32-bit at the same machine works normally | Python run .py in separate windows (Windows 7, Python 2.6.6 64-bit) | 0 | 0 | 0 | 390 |
9,034,799 | 2012-01-27T14:31:00.000 | 0 | 0 | 1 | 1 | python,cmd | 9,034,871 | 3 | false | 0 | 0 | Did you try adding raw_input() at the end of testfile.py ? | 2 | 1 | 0 | I have no idea why python run every script in a new command window.
For example I run: python testfile.py, it is show new window and close immediately, so I can't look the traceback.
Python 2.7 32-bit at the same machine works normally | Python run .py in separate windows (Windows 7, Python 2.6.6 64-bit) | 0 | 0 | 0 | 390 |
9,035,424 | 2012-01-27T15:09:00.000 | 4 | 0 | 1 | 1 | python,py2exe | 9,036,282 | 3 | false | 0 | 0 | I really doubt that you can do something like that at all.
What you could do is just configure yourself 3 build VMs one for Windows, one for MacOS and one for Linux that have everyhing you need to run your program.
Then use either a combination of py2exe/py2app/pyinstaller to generate a distribution for each of the pl... | 1 | 15 | 0 | py2exe is great, and I use it whenever I want to package up a python program to run on a Windows system.
My question is, is there an equivalent tool that I can use to package up the program on Windows, but that I can then run on Linux? | Cross-platform alternative to py2exe | 0.26052 | 0 | 0 | 29,961 |
9,036,584 | 2012-01-27T16:22:00.000 | 1 | 0 | 1 | 1 | python,pthreads,mpi | 9,053,423 | 1 | true | 0 | 0 | If I understand you correctly, the easiest way would be to intercept the calls to MPI_Init and execute it only once. For C, MPI provides the PMPI Profiling Interface that allows you to override any MPI symbol and provides an additional PMPI symbol. E.g. you define a function MPI_Init and in that function, depending if ... | 1 | 0 | 0 | I understand that MPI_init can only be called more than once per executable instance. Can anyone clarify the limits of this language: ie:
I know multiple python exec on mpiexec can be run.
Is there anything like fork() or threads that can lead to something that qualifies? Is the criterion that they have to happen firs... | Calling MPI_Init more than once | 1.2 | 0 | 0 | 1,657 |
9,036,653 | 2012-01-27T16:26:00.000 | 0 | 0 | 0 | 0 | python,ole,opc | 9,213,366 | 2 | true | 0 | 0 | You can install some tryout opc servers. google opc simulation. The python OpenOPC client is what i try to use.
My problems was that I did not have a plc on my desk. You need a plc on your desk connected to your actual siemens s7 engineering station to have the siemens opc server show the tags in the plc. | 1 | 0 | 0 | I am trying to do some stuff with siemens PLC using OPENOPC using python. I am wondering how I will get OPC server that I can communicate using PYOPC. Is there any open OPC server available or am I not understanding some of the key concepts here? Since I am a newbie, I hope to get some down-to-earth suggestions. | OpenOPC using Python | 1.2 | 0 | 0 | 2,203 |
9,037,346 | 2012-01-27T17:17:00.000 | -1 | 0 | 1 | 1 | python,windows,windows-7 | 49,847,281 | 4 | false | 0 | 0 | Create a file named 'personalisedCommand.cmd' in a path folder with this inside:
@echo off
python absolute/path/to/pythonScript | 1 | 28 | 0 | I want to able to open a command prompt at the folder which contains a python script and just type in the script name without the .py and watch it run.
Following the various tips on google to do this, I do:
Add the python.exe to my path
Add .py to PATHEXT
Try to open the .py file in windows explored. When prompted wi... | Making Python scripts run on Windows without specifying ".py" extension | -0.049958 | 0 | 0 | 19,958 |
9,038,128 | 2012-01-27T18:19:00.000 | 2 | 0 | 1 | 0 | python,multithreading | 9,038,289 | 1 | false | 0 | 1 | Pass a Queue as an argument to the threads, and let them put() a done / result object into that. Then count them. | 1 | 3 | 0 | I use wxpython for GUI. In main thread I fired some threads in background and showed modal dialog in main thread immediately. Now I want this modal dialog to be updated with some info at the moment all background threads finish they job. What's the best way to do this? | Execute action when all threads in except main are finished? (Python) | 0.379949 | 0 | 0 | 173 |
9,038,505 | 2012-01-27T18:52:00.000 | 3 | 0 | 1 | 0 | java,python,jython | 9,047,483 | 2 | true | 1 | 0 | Jython supports loading Java classes as if they were Python modules. It searches the directories in sys.path for .class files.
First, make sure your Java class has already been compiled with javac.
Then, do a sys.path.append(d), where d is the directory containing the package. So if your class says package foo.bar; at ... | 1 | 2 | 0 | I have made a java class that calls other java classes and then prints to a screen. i am trying to build a python interface that calls my java class, runs the one method within it, and terminates. i cannot get access to my method. i have used the line "import directory.directory2.myClass.java (and .jar and .class) i ma... | How to import a java class i created in jython and call a method | 1.2 | 0 | 0 | 5,286 |
9,039,265 | 2012-01-27T19:56:00.000 | 0 | 0 | 1 | 0 | python,naming-conventions | 9,039,313 | 5 | false | 0 | 0 | genFoo()
(...and some extra words ensure this solution has at least 30 characters) | 2 | 41 | 0 | How do you name a function that returns a generator (that is, uses yield foo instead of return foo)?
It's definitely not getFoo() because it does not return a value of Foo.
It's probably not foos() because I'd rather have an easy-to-distinguish prefix.
It's probably not exactly listFoo() because it does not return a l... | Name of a function returning a generator | 0 | 0 | 0 | 10,378 |
9,039,265 | 2012-01-27T19:56:00.000 | 20 | 0 | 1 | 0 | python,naming-conventions | 9,039,331 | 5 | false | 0 | 0 | I think foo or foos are possibilities. Or, to mimic Python2 dicts' iteritems, you could use iterfoo. | 2 | 41 | 0 | How do you name a function that returns a generator (that is, uses yield foo instead of return foo)?
It's definitely not getFoo() because it does not return a value of Foo.
It's probably not foos() because I'd rather have an easy-to-distinguish prefix.
It's probably not exactly listFoo() because it does not return a l... | Name of a function returning a generator | 1 | 0 | 0 | 10,378 |
9,040,618 | 2012-01-27T21:57:00.000 | 4 | 0 | 1 | 0 | python,string,json,unicode | 9,040,643 | 3 | false | 0 | 0 | You should use the json module to load the JSON data into a Python object. It will take care of this for you, and you'll have Unicode strings. Then you can encode them to match your output device, and print them. | 1 | 2 | 0 | I get a Json object from a URL which has values in the form like above:
title:'\u05d9\u05d7\u05e4\u05d9\u05dd'
I need to print these values as readable text however I'm not able to convert them as they are taken as literal strings and not unicode objects.
doing unicode(myStr) does not work
doing a = u'%s' % myStr does ... | convert a String '\u05d9\u05d7\u05e4\u05d9\u05dd' to its unicode character in python | 0.26052 | 0 | 0 | 1,062 |
9,040,793 | 2012-01-27T22:16:00.000 | 1 | 0 | 1 | 1 | python,dll,windows-xp,py2exe,windows-7-x64 | 9,040,859 | 1 | true | 0 | 0 | py2exe tells you:
Your executable(s) also depend on these dlls which are not included,
you may or may not need to distribute them.
Make sure you have the license if you distribute any of them, and
make sure you don't distribute files belonging to the operating system.
WS2_32.dll is part of the operating system. | 1 | 1 | 0 | I am trying to package a python application on my 64 bit windows 7 machine using py2exe.
The final target of this application are 32 bit windows machines.
I am using 32 bit python 2.7 on the 64 bit windows 7 machine. When I package the application , py2exe warns me of several DLLs from the system32 directory that need ... | Packaging python for 32 bit WIndows XP from a 64 bit windows 7 machine using py2exe | 1.2 | 0 | 0 | 968 |
9,041,185 | 2012-01-27T22:57:00.000 | 1 | 1 | 1 | 0 | php,python,binary,binary-data | 9,041,341 | 8 | false | 0 | 0 | rather more of an experience rather than a solid answer:
actually, you don't actually need binary because it's pretty much abstracted in programming nowadays (depending on what you program). binary has more use in the systems design and networking.
some things my colleagues at school do in their majors:
processor inst... | 4 | 6 | 0 | I am trying very hard to develop a much deeper understanding of programming as a whole. I understand the textbook definition of "binary", but what I don't understand is exactly how it applies to my day to day programming?
The concept of "binary numbers" vs .. well... "regular" numbers, is completely lost on me despite... | How do "binary" numbers relate to my everyday programming? | 0.024995 | 0 | 0 | 1,423 |
9,041,185 | 2012-01-27T22:57:00.000 | 0 | 1 | 1 | 0 | php,python,binary,binary-data | 9,041,392 | 8 | false | 0 | 0 | As a web guy, you no doubt understand the importance of unicode. Unicode is represented in hexidecimal format when viewing character sets not supported by your system. Hexidecimal also appears in RGB values, and memory addresses. Hexideciaml is, among many things, a shorthand for writing out long binary characters.
Fin... | 4 | 6 | 0 | I am trying very hard to develop a much deeper understanding of programming as a whole. I understand the textbook definition of "binary", but what I don't understand is exactly how it applies to my day to day programming?
The concept of "binary numbers" vs .. well... "regular" numbers, is completely lost on me despite... | How do "binary" numbers relate to my everyday programming? | 0 | 0 | 0 | 1,423 |
9,041,185 | 2012-01-27T22:57:00.000 | 4 | 1 | 1 | 0 | php,python,binary,binary-data | 9,041,557 | 8 | false | 0 | 0 | Here is a brief history to help your understanding and I will get to your question at the end.
Binary is a little weird because we are so used to using a base 10 number system. This is because humans have 10 fingers, when they ran out they had to use a stick, toe or something else to represent 10 fingers. This it not... | 4 | 6 | 0 | I am trying very hard to develop a much deeper understanding of programming as a whole. I understand the textbook definition of "binary", but what I don't understand is exactly how it applies to my day to day programming?
The concept of "binary numbers" vs .. well... "regular" numbers, is completely lost on me despite... | How do "binary" numbers relate to my everyday programming? | 0.099668 | 0 | 0 | 1,423 |
9,041,185 | 2012-01-27T22:57:00.000 | 2 | 1 | 1 | 0 | php,python,binary,binary-data | 9,041,603 | 8 | false | 0 | 0 | To me, one of the biggest impacts of a binary representation of numbers is the difference between floating point values and our "ordinary" (base-10 or decimal) notion of fractions, decimals, and real numbers.
The vast majority of fractions cannot be exactly represented in binary. Something like 0.4 seems like it's not... | 4 | 6 | 0 | I am trying very hard to develop a much deeper understanding of programming as a whole. I understand the textbook definition of "binary", but what I don't understand is exactly how it applies to my day to day programming?
The concept of "binary numbers" vs .. well... "regular" numbers, is completely lost on me despite... | How do "binary" numbers relate to my everyday programming? | 0.049958 | 0 | 0 | 1,423 |
9,041,236 | 2012-01-27T23:03:00.000 | 1 | 0 | 0 | 0 | python,numpy,scipy,numerical-computing | 9,042,475 | 2 | false | 0 | 0 | It does seem like there should be a better way to do this (and I haven't scoured the documentation), but you could always loop over the elements of the sparse array and assign to the dense array (probably zeroing out the dense array first). If this ends up too slow, that seems like an easy C extension to write.... | 1 | 1 | 1 | Say I have a huge numpy matrix A taking up tens of gigabytes. It takes a non-negligible amount of time to allocate this memory.
Let's say I also have a collection of scipy sparse matrices with the same dimensions as the numpy matrix. Sometimes I want to convert one of these sparse matrices into a dense matrix to perf... | Load sparse scipy matrix into existing numpy dense matrix | 0.099668 | 0 | 0 | 995 |
9,042,086 | 2012-01-28T01:09:00.000 | 0 | 1 | 0 | 0 | python,zip | 9,042,877 | 3 | false | 0 | 0 | A heuristic approach will always involve some false positives and some false negatives.
The eventual size of the zipped file will depend on a number of factors, some of which are not knowable without running the compression process itself.
Zip64 allows you to use many different compression formats, such as bzip2, LZMA,... | 3 | 1 | 0 | I have the following requirements (from the client) for zipping a number of files.
If the zip file created is less than 2**31-1 ~2GB use compression to create it (use zipfile.ZIP_DEFLATED), otherwise do not compress it (use zipfile.ZIP_STORED).
The current solution is to compress the file without zip64 and catching th... | Calculate (approximately) if zip64 extensions are required without relying on exceptions? | 0 | 0 | 0 | 1,620 |
9,042,086 | 2012-01-28T01:09:00.000 | 0 | 1 | 0 | 0 | python,zip | 9,042,227 | 3 | false | 0 | 0 | I can only think of two ways, one simple but requires manual tuning, and the other may not provide enough benefit to justify the complexity.
Define a file size at which you just skip the zip attempt, and tune it to your satisfacton by hand.
Keep a record of the last N filesizes between the smallest failure to zip ever... | 3 | 1 | 0 | I have the following requirements (from the client) for zipping a number of files.
If the zip file created is less than 2**31-1 ~2GB use compression to create it (use zipfile.ZIP_DEFLATED), otherwise do not compress it (use zipfile.ZIP_STORED).
The current solution is to compress the file without zip64 and catching th... | Calculate (approximately) if zip64 extensions are required without relying on exceptions? | 0 | 0 | 0 | 1,620 |
9,042,086 | 2012-01-28T01:09:00.000 | 0 | 1 | 0 | 0 | python,zip | 9,042,092 | 3 | false | 0 | 0 | The only way I know of to estimate the zip file size is to look at the compression ratios for previously compressed files of a similar nature. | 3 | 1 | 0 | I have the following requirements (from the client) for zipping a number of files.
If the zip file created is less than 2**31-1 ~2GB use compression to create it (use zipfile.ZIP_DEFLATED), otherwise do not compress it (use zipfile.ZIP_STORED).
The current solution is to compress the file without zip64 and catching th... | Calculate (approximately) if zip64 extensions are required without relying on exceptions? | 0 | 0 | 0 | 1,620 |
9,045,626 | 2012-01-28T13:32:00.000 | 0 | 1 | 0 | 0 | python,email,imap,mime | 13,953,238 | 2 | true | 0 | 0 | Answering my own question for the sake of completeness and to close this question.
I couldn't find any existing library that answers the requirements. I ended up writing my own code to fetch BODYSTRUCTURE tree, parse it and store it in an internal structure. This gives me the control I need to decide which exact parts ... | 1 | 0 | 0 | I am looking for an existing library or code samples, to extract the relevant parts from a mime message structure in order to perform analysis on the textual content of those parts.
I will explain:
I am writing a library (in Python) that is part of a project that needs to iterate over very large amount of email message... | MIME message structure parsing and analysis | 1.2 | 0 | 1 | 1,090 |
9,045,723 | 2012-01-28T13:49:00.000 | 1 | 0 | 0 | 0 | python,database,widget,rad | 15,711,432 | 2 | false | 1 | 1 | I am also looking for something similar to Kexi. Unfortunately python scripting is not supported in Kexi for windows. I would like to find something better than MS Access, and it does not have to be based on python. So far I have looked at quite a few IDE's but have not found anything where a GUI and database applicati... | 1 | 3 | 0 | First of all, I am sorry if this question doesn't belong to SO since I don't know where else to post it, anyway...
I am looking for a decent python based database development RAD framework with nice data aware widgets and grids. A desktop framework would be much preferable to a web framework (I've developed heavy DB-ce... | Python database widgets/environment like MSAccess | 0.099668 | 1 | 0 | 684 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.