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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,725,362 | 2010-04-27T21:44:00.000 | 6 | 0 | 0 | 0 | python,wxpython,wxwidgets | 2,725,392 | 2 | true | 0 | 1 | I've never seen wx.EVT_COMMAND_TEXT_ENTER. I have used wx.EVT_TEXT_ENTER though... | 1 | 8 | 0 | I have a (single line) TextCtrl. The user types data into this. When they press enter, the contents of the box need to be extracted so they can be processed. I can't figure out how to catch enter being pressed.
According to the docs, with the style wx.TE_PROCESS_ENTER set on my TextCtrl, it should generate a wx.EVT_COM... | Get text when enter is pressed in a text box in wxPython | 1.2 | 0 | 0 | 7,028 |
2,725,735 | 2010-04-27T22:56:00.000 | 0 | 0 | 0 | 0 | python,pdf,graphics | 2,725,787 | 6 | false | 0 | 1 | Creating PDFs is always a pain, it doesn't make sense if you do not aim to lose sanity.
With that said, you are aiming to do two completely different things: when you draw to screen you draw into a raster bitmap, while PDFs are mostly dynamic, like HTML. (unlike HTML they are more prone to be the same over different pl... | 2 | 3 | 0 | I'm looking for an easy-to-use graphics lib for python that can output to screen as well as pdf. So, I would use code to draw some stuff (simple prims like ovals, rectangles, lines and points) to screen and then when things look good, have it output to pdf. | Recommendations for a simple 2D graphics python library that can output to screen and pdf? | 0 | 0 | 0 | 9,999 |
2,725,735 | 2010-04-27T22:56:00.000 | 3 | 0 | 0 | 0 | python,pdf,graphics | 2,725,883 | 6 | false | 0 | 1 | If you use Tkinter, you can draw on a Canvas widget, then use its .postscript method to save the contents as a PostScript file, which you can convert to PDF using ps2pdf.
postscript(self, cnf={}, **kw)
Print the contents of the canvas to a postscript
file. Valid options: colormap, colormode, file, fontmap,
heigh... | 2 | 3 | 0 | I'm looking for an easy-to-use graphics lib for python that can output to screen as well as pdf. So, I would use code to draw some stuff (simple prims like ovals, rectangles, lines and points) to screen and then when things look good, have it output to pdf. | Recommendations for a simple 2D graphics python library that can output to screen and pdf? | 0.099668 | 0 | 0 | 9,999 |
2,725,754 | 2010-04-27T23:00:00.000 | 52 | 0 | 1 | 1 | python,windows,scheduled-tasks | 5,314,695 | 3 | false | 0 | 0 | You can use the GUI from the control panel (called "scheduled tasks") to add a task, most of it should be self-explanatory, but there are two things to watch out for:
Make sure you fill in C:\python27\python.exe as the program path, and the path to your script as the argument.
If you choose Run whether user is logged ... | 1 | 46 | 0 | I have a python script which I would like to run at regular intervals. I am running windows 7. What is the best way to accomplish this? Easiest way? | Schedule Python Script - Windows 7 | 1 | 0 | 0 | 76,799 |
2,726,176 | 2010-04-28T00:55:00.000 | 0 | 1 | 0 | 0 | c++,python,c,linux,unix | 2,726,201 | 5 | false | 0 | 0 | The answer is conditionally "yes".
If your languages/environment has interactive keyboard support that offers Key-Down and Key-Up events, then you catch both events and time the difference between them.
This would be trivially easy in JavaScript on a web page, which would also be the easiest way to show off your work t... | 2 | 4 | 0 | I am working on a project in which I have to develop bio-passwords based on user's keystroke style.
Suppose a user types a password for 20 times, his keystrokes are recorded, like
holdtime : time for which a particular key is pressed.
digraph time : time it takes to press a different key.
suppose a user types a pass... | Can I get the amount of time for which a key is pressed on a keyboard | 0 | 0 | 0 | 3,012 |
2,726,176 | 2010-04-28T00:55:00.000 | 0 | 1 | 0 | 0 | c++,python,c,linux,unix | 2,726,199 | 5 | false | 0 | 0 | If you read from the terminal in conical mode, you can read each keystroke as it's pressed. You won't see keydown keyup events, like you could if you trapped X events, but it's probably easier, especially if you're just running in a console or terminal. | 2 | 4 | 0 | I am working on a project in which I have to develop bio-passwords based on user's keystroke style.
Suppose a user types a password for 20 times, his keystrokes are recorded, like
holdtime : time for which a particular key is pressed.
digraph time : time it takes to press a different key.
suppose a user types a pass... | Can I get the amount of time for which a key is pressed on a keyboard | 0 | 0 | 0 | 3,012 |
2,727,438 | 2010-04-28T07:11:00.000 | 1 | 0 | 1 | 1 | python,macos,installation,configure | 2,727,510 | 3 | false | 0 | 0 | In general, installing Python (or anything directly from the source) when it is already available on your system or when there are package managers that will install it for you, is not a very good idea. I strongly advise you against installing Python manually... Mac OS X 10.6 Snow Leopard comes with Python 2.6 out of t... | 2 | 0 | 0 | I'm trying to install Python from source on my Mac. (OS X 10.6.2, Python-2.6.5.tar.bz2) I've done this before and it was easy, but for some reason, this time after ./configure, and make, the sudo make install puts things some things in my home directory instead of in /usr/local/... where I expect. The .py files are ... | How do I stop Python install on Mac OS X from putting things in my home directory? | 0.066568 | 0 | 0 | 819 |
2,727,438 | 2010-04-28T07:11:00.000 | 2 | 0 | 1 | 1 | python,macos,installation,configure | 2,727,917 | 3 | true | 0 | 0 | Doh. I've answered my own question. Recently I created a ~/.pydistutils.cfg file, for some stupid reason. I forgot to delete that file. It's contents were:
[install]
install_lib = ~/Library/Python/$py_version_short/site-packages
install_scripts = ~/bin
make install calls setup.py, and this file was overriding the n... | 2 | 0 | 0 | I'm trying to install Python from source on my Mac. (OS X 10.6.2, Python-2.6.5.tar.bz2) I've done this before and it was easy, but for some reason, this time after ./configure, and make, the sudo make install puts things some things in my home directory instead of in /usr/local/... where I expect. The .py files are ... | How do I stop Python install on Mac OS X from putting things in my home directory? | 1.2 | 0 | 0 | 819 |
2,728,289 | 2010-04-28T09:40:00.000 | 0 | 0 | 0 | 1 | python | 2,728,373 | 3 | false | 0 | 0 | I think any modern Linux OS has Python installed, so you can just ditribute the .py file if it has no weird dependencies. | 2 | 1 | 0 | i'm newbie for python programming, i'm having a .py file, now what shall i do so i can create an application from .py file and it can be istall and run in any linux pc, i try to packaging it but its just create .tar file where i need python to run it, is it any to do so,
thanks | how to create application(exe) from python script for linux | 0 | 0 | 0 | 557 |
2,728,289 | 2010-04-28T09:40:00.000 | 2 | 0 | 0 | 1 | python | 2,728,622 | 3 | false | 0 | 0 | Make sure that the main python file has #! /usr/bin/env python as the first line, then make sure it has execute permission set (should be as easy as chmod +x file_name.py). | 2 | 1 | 0 | i'm newbie for python programming, i'm having a .py file, now what shall i do so i can create an application from .py file and it can be istall and run in any linux pc, i try to packaging it but its just create .tar file where i need python to run it, is it any to do so,
thanks | how to create application(exe) from python script for linux | 0.132549 | 0 | 0 | 557 |
2,730,752 | 2010-04-28T15:14:00.000 | 1 | 0 | 0 | 0 | python,python-3.x | 2,734,917 | 4 | false | 0 | 0 | I believe lxml has been ported to Python 3 | 2 | 11 | 0 | I want to use the htmllib module but it's been removed from Python 3.0. Does anyone know what's the replacement for this module? | Replacement for htmllib module in Python 3.0 | 0.049958 | 0 | 1 | 5,120 |
2,730,752 | 2010-04-28T15:14:00.000 | 1 | 0 | 0 | 0 | python,python-3.x | 2,732,223 | 4 | false | 0 | 0 | I heard Beautiful soup is getting a port to 3.0. | 2 | 11 | 0 | I want to use the htmllib module but it's been removed from Python 3.0. Does anyone know what's the replacement for this module? | Replacement for htmllib module in Python 3.0 | 0.049958 | 0 | 1 | 5,120 |
2,730,969 | 2010-04-28T15:37:00.000 | 1 | 0 | 1 | 0 | python,geometry,intersection,points | 2,731,060 | 6 | false | 0 | 0 | You may also want to look into the various clipping algorithms used in graphics development. I have used clipping algorithms to solve alot of problems similar to what you are asking here. | 4 | 6 | 0 | In Python, how would one find all integer points common to two circles?
For example, imagine a Venn diagram-like intersection of two (equally sized) circles, with center-points (x1,y1) and (x2,y2) and radii r1=r2. Additionally, we already know the two points of intersection of the circles are (xi1,yi1) and (xi2,yi2).
H... | Finding all points common to two circles | 0.033321 | 0 | 0 | 4,391 |
2,730,969 | 2010-04-28T15:37:00.000 | 1 | 0 | 1 | 0 | python,geometry,intersection,points | 2,731,095 | 6 | false | 0 | 0 | If the locations and radii of your circles can vary with a granularity less than your grid, then you'll be checking a bunch of points anyway.
You can minimize the number of points you check by defining the search area appropriately. It has a width equal to the distance between the points of intersection, and a height ... | 4 | 6 | 0 | In Python, how would one find all integer points common to two circles?
For example, imagine a Venn diagram-like intersection of two (equally sized) circles, with center-points (x1,y1) and (x2,y2) and radii r1=r2. Additionally, we already know the two points of intersection of the circles are (xi1,yi1) and (xi2,yi2).
H... | Finding all points common to two circles | 0.033321 | 0 | 0 | 4,391 |
2,730,969 | 2010-04-28T15:37:00.000 | 1 | 0 | 1 | 0 | python,geometry,intersection,points | 32,522,118 | 6 | false | 0 | 0 | You're almost there.
Iterating over the points in the box should be fairly good, but you can do better if for the second coordinate you iterate directly between the limits.
Say you iterate along the x axis first, then for the y axis, instead of iterating between bounding box coords figure out where each circle intersec... | 4 | 6 | 0 | In Python, how would one find all integer points common to two circles?
For example, imagine a Venn diagram-like intersection of two (equally sized) circles, with center-points (x1,y1) and (x2,y2) and radii r1=r2. Additionally, we already know the two points of intersection of the circles are (xi1,yi1) and (xi2,yi2).
H... | Finding all points common to two circles | 0.033321 | 0 | 0 | 4,391 |
2,730,969 | 2010-04-28T15:37:00.000 | 0 | 0 | 1 | 0 | python,geometry,intersection,points | 2,731,015 | 6 | false | 0 | 0 | So you want to find the lattice points that are inside both circles?
The method you suggested of drawing a box and iterating through all the points in the box seems the simplest to me. It will probably be efficient, as long as the number of points in the box is comparable to the number of points in the intersection.
A... | 4 | 6 | 0 | In Python, how would one find all integer points common to two circles?
For example, imagine a Venn diagram-like intersection of two (equally sized) circles, with center-points (x1,y1) and (x2,y2) and radii r1=r2. Additionally, we already know the two points of intersection of the circles are (xi1,yi1) and (xi2,yi2).
H... | Finding all points common to two circles | 0 | 0 | 0 | 4,391 |
2,731,022 | 2010-04-28T15:46:00.000 | 24 | 0 | 1 | 0 | python,comments,interpreter,interpreted-language | 2,731,049 | 11 | false | 0 | 0 | Comments are usually stripped out in or before the parsing stage, and parsing is very fast, so effectively comments will not slow down the initialization time. | 6 | 75 | 0 | I am asking this because I use Python, but it could apply to other interpreted languages as well (Ruby, PHP, JavaScript).
Am I slowing down the interpreter whenever I leave a comment in my code? According to my limited understanding of an interpreter, it reads program expressions in as strings and then converts those s... | Do comments slow down an interpreted language? | 1 | 0 | 0 | 15,646 |
2,731,022 | 2010-04-28T15:46:00.000 | 100 | 0 | 1 | 0 | python,comments,interpreter,interpreted-language | 2,731,094 | 11 | true | 0 | 0 | For the case of Python, source files are compiled before being executed (the .pyc files), and the comments are stripped in the process. So comments could slow down the compilation time if you have gazillions of them, but they won't impact the execution time. | 6 | 75 | 0 | I am asking this because I use Python, but it could apply to other interpreted languages as well (Ruby, PHP, JavaScript).
Am I slowing down the interpreter whenever I leave a comment in my code? According to my limited understanding of an interpreter, it reads program expressions in as strings and then converts those s... | Do comments slow down an interpreted language? | 1.2 | 0 | 0 | 15,646 |
2,731,022 | 2010-04-28T15:46:00.000 | 0 | 0 | 1 | 0 | python,comments,interpreter,interpreted-language | 2,732,070 | 11 | false | 0 | 0 | As the other answers have already stated, a modern interpreted language like Python first parses and compiles the source into bytecode, and the parser simply ignores the comments. This clearly means that any loss of speed would only occur at startup when the source is actually parsed.
Because the parser ignores commen... | 6 | 75 | 0 | I am asking this because I use Python, but it could apply to other interpreted languages as well (Ruby, PHP, JavaScript).
Am I slowing down the interpreter whenever I leave a comment in my code? According to my limited understanding of an interpreter, it reads program expressions in as strings and then converts those s... | Do comments slow down an interpreted language? | 0 | 0 | 0 | 15,646 |
2,731,022 | 2010-04-28T15:46:00.000 | 3 | 0 | 1 | 0 | python,comments,interpreter,interpreted-language | 2,731,492 | 11 | false | 0 | 0 | My limited understanding of an
interpreter is that it reads program
expressions in as strings and converts
those strings into code.
Most interpreters read the text (code) in the file and produce an Abstract Syntax Tree data structure, since it can be easily read by the next stage of compilation.
That structure contai... | 6 | 75 | 0 | I am asking this because I use Python, but it could apply to other interpreted languages as well (Ruby, PHP, JavaScript).
Am I slowing down the interpreter whenever I leave a comment in my code? According to my limited understanding of an interpreter, it reads program expressions in as strings and then converts those s... | Do comments slow down an interpreted language? | 0.054491 | 0 | 0 | 15,646 |
2,731,022 | 2010-04-28T15:46:00.000 | 5 | 0 | 1 | 0 | python,comments,interpreter,interpreted-language | 2,731,178 | 11 | false | 0 | 0 | It depends on how the interpreter is implemented. Most reasonably modern interpreters do at least a bit of pre-processing on the source code before any actual execution, and that will include stripping out the comments so they make no difference from that point onward.
At one time, when memory was severely constrained ... | 6 | 75 | 0 | I am asking this because I use Python, but it could apply to other interpreted languages as well (Ruby, PHP, JavaScript).
Am I slowing down the interpreter whenever I leave a comment in my code? According to my limited understanding of an interpreter, it reads program expressions in as strings and then converts those s... | Do comments slow down an interpreted language? | 0.090659 | 0 | 0 | 15,646 |
2,731,022 | 2010-04-28T15:46:00.000 | 2 | 0 | 1 | 0 | python,comments,interpreter,interpreted-language | 2,731,087 | 11 | false | 0 | 0 | Having comments will slow down the startup time, as the scripts will get parsed into an executable form. However, in most cases comments don't slow down runtime.
Additionally in python, you can compile the .py files into .pyc, which won't contain the comments (I should hope) - this means that you won't get a startup hi... | 6 | 75 | 0 | I am asking this because I use Python, but it could apply to other interpreted languages as well (Ruby, PHP, JavaScript).
Am I slowing down the interpreter whenever I leave a comment in my code? According to my limited understanding of an interpreter, it reads program expressions in as strings and then converts those s... | Do comments slow down an interpreted language? | 0.036348 | 0 | 0 | 15,646 |
2,731,545 | 2010-04-28T16:58:00.000 | 0 | 0 | 1 | 1 | python,installation,setuptools | 2,734,263 | 5 | false | 0 | 0 | Since setuptools doesn't seem to give an easy solution to this, I've decided to give up on this idea until I release my app with py2exe/InnoSetup. | 1 | 6 | 0 | I'm making a Python package that gets installed with a setup.py file using setuptools.
The package includes a GUI, and when it's installed on a Windows machine, I want the installation to make a folder in "Programs" in the start menu, and make a shortcut there to a pyw script that will start the GUI. (The pyw think wor... | Having my Python package install shortcuts in Start menu | 0 | 0 | 0 | 2,198 |
2,731,871 | 2010-04-28T17:44:00.000 | 1 | 0 | 0 | 0 | python,mysql,logging,web-applications | 2,731,905 | 2 | false | 1 | 0 | You can encode the expiration time as part of your session id.
Then when you validate the session id, you can also check if it has expired, and if so force the user to log-in again.
You can also clean your database periodically, removing expired sessions. | 1 | 1 | 0 | I have a web application in python wherein the user submits their email and password. These values are compared to values stored in a mysql database. If successful, the script generates a session id, stores it next to the email in the database and sets a cookie with the session id, with allows the user to interact with... | Automatic logout in python web app | 0.099668 | 0 | 0 | 646 |
2,732,407 | 2010-04-28T19:06:00.000 | 1 | 1 | 0 | 0 | python,mysql,email,reminders | 2,733,383 | 3 | false | 0 | 0 | A cronjob every minute or so would do it. If you're considering this, you might like to mind two things:
1 - How many e-mails are expected to be sent per minute? If it takes you 1 second to send an e-mail and you have 100 e-mails per minute, you won't finish your queue.
2 - What will happen if one job starts before th... | 2 | 1 | 0 | I have written up a python script that allows a user to input a message, his email and the time and they would like the email sent. This is all stored in a mysql database.
However, how do I get the script to execute on the said time and date? will it require a cron job? I mean say at 2:15 on april 20th, the script wil... | Timed email reminder in python | 0.066568 | 0 | 0 | 2,308 |
2,732,407 | 2010-04-28T19:06:00.000 | 2 | 1 | 0 | 0 | python,mysql,email,reminders | 2,732,645 | 3 | true | 0 | 0 | If you cannot have a continuously running script, something must trigger it, so that would have to rely on your OS internals. In a unix environment a cron job, as you self state, would do the trick.
Set cron to run the script, and make the script wait for a given time and then continue running and sending until the nex... | 2 | 1 | 0 | I have written up a python script that allows a user to input a message, his email and the time and they would like the email sent. This is all stored in a mysql database.
However, how do I get the script to execute on the said time and date? will it require a cron job? I mean say at 2:15 on april 20th, the script wil... | Timed email reminder in python | 1.2 | 0 | 0 | 2,308 |
2,733,629 | 2010-04-28T22:46:00.000 | 8 | 1 | 1 | 0 | python,comparison,egg | 2,734,885 | 2 | false | 0 | 0 | Using eggs does cause a long sys.path, which has to be searched and when it's really long that search can take a while. Only when you get a hundred entries or so is this going to be a problem (but installing a hundred eggs via easy_install is certainly possible). | 2 | 7 | 0 | Are there any disadvantages about using eggs through easy-install compared to the "traditional" packages/modules/libs? | Disadvantage of Python eggs? | 1 | 0 | 0 | 688 |
2,733,629 | 2010-04-28T22:46:00.000 | 8 | 1 | 1 | 0 | python,comparison,egg | 2,733,647 | 2 | true | 0 | 0 | One (potential) disadvantage is that eggs are zipped by default unless zip_safe=False is set in their setup() function in setup.py. If an egg is zipped, you can't get at the files in it (without unzipping it, obviously). If the module itself uses non-source files (such as templates) it will probably specify zip_safe=Fa... | 2 | 7 | 0 | Are there any disadvantages about using eggs through easy-install compared to the "traditional" packages/modules/libs? | Disadvantage of Python eggs? | 1.2 | 0 | 0 | 688 |
2,733,971 | 2010-04-29T00:07:00.000 | 1 | 0 | 1 | 0 | java,python,android,android-scripting | 2,734,044 | 2 | false | 0 | 0 | Android does not ship with a Python interpreter, nor does it ship with gcc or other compilers. You will need to get an ARM binary from somewhere or cross-compile one yourself. (BTW, I'm assuming ARM, but substitute in whatever architecture you happen to be running). | 1 | 7 | 0 | I want to install a python package from source on android. Is this possible? I tried in the console to run the py install files, but distutils (.core, ccompiler) isn't being found. Is it possible to still install them? | installing python packages on android | 0.099668 | 0 | 0 | 2,648 |
2,735,828 | 2010-04-29T08:34:00.000 | 8 | 0 | 0 | 1 | python,django,macos,terminal,pdb | 2,745,035 | 3 | true | 1 | 0 | OK - this works for me I created a ~/.pdbrc and added
import os
os.system("stty sane")
Now each time pdb is run it sets the line settings back to sane.
If I fall out to the terminal then I still have to do it manually - but it solves having to quit runserver and reset all the time. | 2 | 9 | 0 | When debugging my django apps I use pdb for interactive debugging with pdb.set_trace().
However, when I amend a file the local django webserver restarts and then I cant see what I type in the terminal, until I type reset.
Is there anyway for this to happen automatically? It can be real annoying, having to cancel the ru... | Is there anyway to get pdb and Mac Terminal to play nicely? | 1.2 | 0 | 0 | 1,601 |
2,735,828 | 2010-04-29T08:34:00.000 | 1 | 0 | 0 | 1 | python,django,macos,terminal,pdb | 2,743,003 | 3 | false | 1 | 0 | The best I've found is doing a reset inside pdb like so:
import os; os.system("reset"); | 2 | 9 | 0 | When debugging my django apps I use pdb for interactive debugging with pdb.set_trace().
However, when I amend a file the local django webserver restarts and then I cant see what I type in the terminal, until I type reset.
Is there anyway for this to happen automatically? It can be real annoying, having to cancel the ru... | Is there anyway to get pdb and Mac Terminal to play nicely? | 0.066568 | 0 | 0 | 1,601 |
2,735,968 | 2010-04-29T09:00:00.000 | 1 | 0 | 0 | 1 | python,eclipse,debugging,google-app-engine,pydev | 2,735,992 | 1 | true | 1 | 0 | In fact setting a breakpoint in eclipse is very easy. You have two options:
In the grey area next to your line numbers, doubleclick or right mouseclick -> toggle breakpoint. | 1 | 3 | 0 | I've got 10+ years in C/C++, and it appears Visual Studio has spoilt me during that time. In Visual Studio, debbuging issimple: I just add a breakpoint to a line of code, and as soon as that code is executed, my breakpoint triggers, at which point I can view a callstack, local/member variables, etc.
I'm trying to achi... | How to get debugging of an App Engine application working? | 1.2 | 0 | 0 | 865 |
2,736,144 | 2010-04-29T09:28:00.000 | 212 | 0 | 1 | 0 | python,string | 15,010,678 | 4 | true | 0 | 0 | os.path.join(path, '') will add the trailing slash if it's not already there.
You can do os.path.join(path, '', '') or os.path.join(path_with_a_trailing_slash, '') and you will still only get one trailing slash. | 1 | 128 | 0 | How can I add a trailing slash (/ for *nix, \ for win32) to a directory string, if the tailing slash is not already there? Thanks! | Python, add trailing slash to directory string, os independently | 1.2 | 0 | 0 | 77,371 |
2,738,290 | 2010-04-29T14:49:00.000 | 0 | 0 | 0 | 1 | python,sungridengine | 3,821,879 | 1 | true | 0 | 0 | created a sleep timer which checks every second for access..
after some time (~15s), access is granted and file is usable! | 1 | 0 | 0 | i have a python script, that submits an job to the SGE (Sun Grid Engine).
When the job is done i want to access the output file, generated from the SGE job.
i see with "ls" in the directory that the file is already existing and the job is done, but python needs about 20-30 seconds to get access to that file...
is there... | access a file in python that is created from SunGridEngine | 1.2 | 0 | 0 | 52 |
2,738,809 | 2010-04-29T15:59:00.000 | 5 | 0 | 1 | 1 | python,fork | 52,476,456 | 2 | false | 0 | 0 | The answer here may not answer the question. The problem is due to fork(). From the example, you seemed want to share data between two Python scripts. Let me explain my view.
As of Python 3.8, there is no true Unix's fork() implementation in Windows platform. For the example above to work, a child process must inherit... | 1 | 4 | 0 | This code works well in Mac/Linux, but not in Windows.
import mmap
import os
map = mmap.mmap(-1, 13)
map.write("Hello world!")
pid = os.fork()
if pid == 0: # In a child process
print 'child'
map.seek(0)
print map.readline()
map.close()
else:
print 'parent'
What's the equivalent function of os... | What's the equivalence of os.fork() on Windows with Python? | 0.462117 | 0 | 0 | 18,954 |
2,738,904 | 2010-04-29T16:13:00.000 | 10 | 0 | 1 | 0 | python,memory-management,docstring | 2,738,970 | 2 | true | 0 | 0 | "I understand that in Python a string is simply an expression and a string by itself would be garbage collected immediately upon return of control to a code's caller" indicates a misunderstanding, I think. A docstring is evaluated once (not on every function call) and stays alive at least as long as the function does.
... | 1 | 2 | 0 | I understand that in Python a string is simply an expression and a string by itself would be garbage collected immediately upon return of control to a code's caller, but...
Large class/method doc strings in
your code: do they waste memory
by building the string objects up?
Module level doc strings: are they
stored inf... | Python - do big doc strings waste memory? | 1.2 | 0 | 0 | 799 |
2,738,959 | 2010-04-29T16:20:00.000 | 1 | 0 | 1 | 0 | python,multithreading,multiprocessing,gil | 2,739,022 | 3 | false | 0 | 0 | locks are only ever nessecary if you have multiple agents writing to a source. If they are just accessing, locks are not needed (and as you said defeat the purpose of multiprocessing).
Are you sure that would crash the system? On a web server using CGI, each request spawns a new process, so it's not unusual to see thou... | 1 | 1 | 0 | I want to use Python's multiprocessing to do concurrent processing without using locks (locks to me are the opposite of multiprocessing) because I want to build up multiple reports from different resources at the exact same time during a web request (normally takes about 3 seconds but with multiprocessing I can do it i... | Python - question regarding the concurrent use of `multiprocess` | 0.066568 | 0 | 0 | 758 |
2,739,051 | 2010-04-29T16:33:00.000 | 0 | 0 | 1 | 0 | python,list,sorting | 2,739,102 | 14 | false | 0 | 0 | Without sorting the list the only way to really do it is to iterate through the whole list and save the highest two numbers. I think you'd be better off sorting the list. | 3 | 41 | 0 | How can retrieve the two highest item from a list containing 100,000 integers without having to sort the entire list first? | Retrieve the two highest item from a list containing 100,000 integers | 0 | 0 | 0 | 41,376 |
2,739,051 | 2010-04-29T16:33:00.000 | 6 | 0 | 1 | 0 | python,list,sorting | 2,739,090 | 14 | false | 0 | 0 | You iterate over the list, maintaining variables that contain the value of the highest and the second highest item encountered thus far. Each new item that is encountered will replace whichever of the two the new item is higher than (if any). | 3 | 41 | 0 | How can retrieve the two highest item from a list containing 100,000 integers without having to sort the entire list first? | Retrieve the two highest item from a list containing 100,000 integers | 1 | 0 | 0 | 41,376 |
2,739,051 | 2010-04-29T16:33:00.000 | 0 | 0 | 1 | 0 | python,list,sorting | 2,739,097 | 14 | false | 0 | 0 | Iterating through the entire list is the only way to do it without sorting. | 3 | 41 | 0 | How can retrieve the two highest item from a list containing 100,000 integers without having to sort the entire list first? | Retrieve the two highest item from a list containing 100,000 integers | 0 | 0 | 0 | 41,376 |
2,741,496 | 2010-04-29T23:53:00.000 | 11 | 0 | 1 | 1 | python,macos,configuration,python-sip | 6,278,976 | 5 | false | 0 | 0 | /Library/Python/2.6/site-packages/ is indeed the right place (assuming it's Mac OS 10.6 "Snow Leopard" - you didn't mention which).
As @diatoid mentioned, check your system path (and make sure you're actually using Python 2.6 by running python -V). | 3 | 29 | 0 | I'm fighting with installation SIP for Python on Mac OS X. Finally after compilation and installation when I run console form folder of SIP (locally) I can import sipconfig, but when I`m in other folder I cant - there is no module called sipconfig.
My question is - Where is folder to which I have to copy modules if I w... | Location of global libraries for Python on Mac? | 1 | 0 | 0 | 107,907 |
2,741,496 | 2010-04-29T23:53:00.000 | 11 | 0 | 1 | 1 | python,macos,configuration,python-sip | 45,022,496 | 5 | false | 0 | 0 | For Python 3.5, It's /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages | 3 | 29 | 0 | I'm fighting with installation SIP for Python on Mac OS X. Finally after compilation and installation when I run console form folder of SIP (locally) I can import sipconfig, but when I`m in other folder I cant - there is no module called sipconfig.
My question is - Where is folder to which I have to copy modules if I w... | Location of global libraries for Python on Mac? | 1 | 0 | 0 | 107,907 |
2,741,496 | 2010-04-29T23:53:00.000 | -1 | 0 | 1 | 1 | python,macos,configuration,python-sip | 65,916,097 | 5 | false | 0 | 0 | You can designate an additional locations when python starts up by setting the environmental variable PYTHONPATH.
If you add to ~/.bashrc or ~/.zscrc (depending on your default shell) something like:
PYTHONPATH=/Library/MyPyhonPackages:/Another/Location;
export PYTHONPATH
Then those locations will be added to "sys.path... | 3 | 29 | 0 | I'm fighting with installation SIP for Python on Mac OS X. Finally after compilation and installation when I run console form folder of SIP (locally) I can import sipconfig, but when I`m in other folder I cant - there is no module called sipconfig.
My question is - Where is folder to which I have to copy modules if I w... | Location of global libraries for Python on Mac? | -0.039979 | 0 | 0 | 107,907 |
2,741,507 | 2010-04-29T23:55:00.000 | 2 | 0 | 0 | 1 | python,linux,deployment,pylons | 2,743,196 | 8 | false | 1 | 0 | Have a look at Buildout for reproducible deployments. | 2 | 20 | 0 | We have several Python 2.6 applications running on Linux. Some of them are Pylons web applications, others are simply long-running processes that we run from the command line using nohup. We're also using virtualenv, both in development and in production. What is the best way to deploy these applications to a productio... | A simple Python deployment problem - a whole world of pain | 0.049958 | 0 | 0 | 5,069 |
2,741,507 | 2010-04-29T23:55:00.000 | 0 | 0 | 0 | 1 | python,linux,deployment,pylons | 2,805,604 | 8 | false | 1 | 0 | I would use rsync to synchronize outwards from your production "prime" server to the others, and from your "beta test" platform, to your production "prime" server.
rsync has the benefit of copying only those files which changed, and copying only parts of files that changed partially, and verifying the integrity and ide... | 2 | 20 | 0 | We have several Python 2.6 applications running on Linux. Some of them are Pylons web applications, others are simply long-running processes that we run from the command line using nohup. We're also using virtualenv, both in development and in production. What is the best way to deploy these applications to a productio... | A simple Python deployment problem - a whole world of pain | 0 | 0 | 0 | 5,069 |
2,741,893 | 2010-04-30T02:05:00.000 | 4 | 0 | 0 | 0 | python,templates,pylons,mako | 2,742,016 | 2 | true | 1 | 0 | Not sure if this is the Pylons way of doing things but ${request.url} seems to work for me. | 1 | 1 | 0 | I need to know the full url for the current page from within a Mako template file in Pylons.
The url will be using in an iframe contained within the page so it needs to be known when the page is being generated rather than after the page hits the server or from the environment. (Not sure if I am communicating that last... | Url for the current page from a Mako template in Pylons | 1.2 | 0 | 0 | 2,612 |
2,742,329 | 2010-04-30T04:39:00.000 | 2 | 0 | 1 | 0 | python,datetime | 2,742,347 | 5 | false | 0 | 0 | The classes in the datetime module will help.
You just need to check whether it's after the 15th of the month. If it is, find the 1st of the next month. If it isn't, find the 15th of the current month. | 1 | 3 | 0 | I'm trying to write a little budget program in python. This is my first program I'm writing to learn python. The first step is to calculate how many days until either the 1st or 15th (paydays) depending on today's date. Can someone help me out a little? | Calculating time until 1st or 15th of the month in python | 0.07983 | 0 | 0 | 1,693 |
2,742,980 | 2010-04-30T07:37:00.000 | 18 | 0 | 1 | 1 | python,virtualenv,yolk | 2,744,571 | 2 | true | 0 | 0 | Activating a virtualenv works by changing your shell PATH so the virtualenv's bin/ directory is first. This is all it does. This means that when you run "python" it runs the virtualenv's copy of the Python binary instead of your global system python.
If you have yolk installed globally, however, the only "yolk" binary ... | 2 | 11 | 0 | yolk -l gives me information that I've got 114 packages installed on my Ubuntu 10.04. After creating new virtualenv directory using
virtualenv virt_env/virt1 --no-site-packages --clear
I switched to that, my prompt changed and then yolk -l gives me again the same 114 packages.
What is going on there? | virtualenv yolk problem | 1.2 | 0 | 0 | 2,679 |
2,742,980 | 2010-04-30T07:37:00.000 | 0 | 0 | 1 | 1 | python,virtualenv,yolk | 3,081,902 | 2 | false | 0 | 0 | If the problem isnt relating to your path (I suppose it is) delete your lib and scripts folder in your project directory to clear out the virtualenv settings. Recreate the virtual env using the command line you posted. Activate the virtualenv and then install yolk. | 2 | 11 | 0 | yolk -l gives me information that I've got 114 packages installed on my Ubuntu 10.04. After creating new virtualenv directory using
virtualenv virt_env/virt1 --no-site-packages --clear
I switched to that, my prompt changed and then yolk -l gives me again the same 114 packages.
What is going on there? | virtualenv yolk problem | 0 | 0 | 0 | 2,679 |
2,744,530 | 2010-04-30T12:41:00.000 | 3 | 0 | 1 | 0 | python,matplotlib,parallel-processing,gil | 2,744,657 | 4 | false | 0 | 0 | I think you'll need to put the graph into a proper Windowing system, rather than relying on the built-in show code.
Maybe sticking the .show() in another thread would be sufficient?
The GIL is irrelevant - you've got a blocking show() call, so you need to handle that first. | 3 | 2 | 1 | my problem is the GIL of course. While I'm analysing data it would be nice to present some plots in between (so it's not too boring waiting for results)
But the GIL prevents this (and this is bringing me to the point of asking myself if Python was such a good idea in the first place).
I can only display the plot, wait ... | Python: Plot some data (matplotlib) without GIL | 0.148885 | 0 | 0 | 737 |
2,744,530 | 2010-04-30T12:41:00.000 | 3 | 0 | 1 | 0 | python,matplotlib,parallel-processing,gil | 2,744,604 | 4 | false | 0 | 0 | This has nothing to do with the GIL, just modify your analysis code to make it update the graph from time to time (for example every N iterations).
Only then if you see that drawing the graph slows the analysis code too much, put the graph update code in a subprocess with multiprocessing. | 3 | 2 | 1 | my problem is the GIL of course. While I'm analysing data it would be nice to present some plots in between (so it's not too boring waiting for results)
But the GIL prevents this (and this is bringing me to the point of asking myself if Python was such a good idea in the first place).
I can only display the plot, wait ... | Python: Plot some data (matplotlib) without GIL | 0.148885 | 0 | 0 | 737 |
2,744,530 | 2010-04-30T12:41:00.000 | 2 | 0 | 1 | 0 | python,matplotlib,parallel-processing,gil | 2,744,906 | 4 | false | 0 | 0 | It seems like the draw() method can circumvent the need for show().
The only reason left for .show() in the script is to let it do the blocking part so that the images don't disapear when the script reaches its end. | 3 | 2 | 1 | my problem is the GIL of course. While I'm analysing data it would be nice to present some plots in between (so it's not too boring waiting for results)
But the GIL prevents this (and this is bringing me to the point of asking myself if Python was such a good idea in the first place).
I can only display the plot, wait ... | Python: Plot some data (matplotlib) without GIL | 0.099668 | 0 | 0 | 737 |
2,744,632 | 2010-04-30T13:00:00.000 | 0 | 0 | 0 | 0 | python,django,sqlite,pysqlite | 64,263,492 | 6 | false | 1 | 0 | Incompatible Django version. Check Django version for solving this error first. I was running on Django==3.0.8 and it was producing an error. Than I ran virtualenv where I have Django==3.1.2 and the error was removed. | 1 | 6 | 0 | I have a django project that uses a sqlite database that can be written to by an external tool. The text is supposed to be UTF-8, but in some cases there will be errors in the encoding. The text is from an external source, so I cannot control the encoding. Yes, I know that I could write a "wrapping layer" between the e... | Change text_factory in Django/sqlite | 0 | 1 | 0 | 4,701 |
2,746,542 | 2010-04-30T17:48:00.000 | 8 | 0 | 1 | 0 | python,module,portable-python | 2,748,807 | 2 | true | 0 | 0 | What does import sys; print sys.path say? It should be the list of directories and zipfiles where Python (portable or otherwise) looks for modules to import. Just copy your modules into one of those directories or zipfiles, or sys.path.append('/whatever/dir') if you have your modules in /whatever/dir and want to keep... | 1 | 6 | 0 | I am running PortablePython_1.1_py2.6.1 on a USB stick. My code relies on some modules that are not preinstalled. Does anyone know whether it is possible to add new modules to a portable python installation? Simply copying in folders into site-lib does not seem to work. | Importing modules on portable python | 1.2 | 0 | 0 | 18,489 |
2,747,017 | 2010-04-30T19:13:00.000 | 0 | 0 | 1 | 0 | python,visual-studio,visual-studio-2010 | 2,747,130 | 4 | false | 0 | 0 | You can create custom project that will execute a bat file when building. I remember that I used this method to generate a Inoosetup installer so that you should work to run the py2exe script.
I have no idea for the rest of the features. The syntax highlighting and the auto-complete should be much more challenging. I w... | 3 | 2 | 0 | I would like to know how to use Visual Studio with CPython (the official python.org python interpreter, not IronPython).
In particular, I am interested in getting "build" and "run" commands in Visual Studio working. Other features such as color highlighting and auto-complete, I am less concerned about.
Also, can the "b... | Running CPython Applications With Visual Studio? | 0 | 0 | 0 | 437 |
2,747,017 | 2010-04-30T19:13:00.000 | 1 | 0 | 1 | 0 | python,visual-studio,visual-studio-2010 | 2,747,733 | 4 | false | 0 | 0 | Are you trying to build CPython itself? Doesn't it come with project files suitable for use with Visual Studio? (I seem to remember that it did.)
If you mean that you want to use CPython but not build it, then just type c:\pythonxx\python.exe into the debugging executable and in the arguments put your script's full p... | 3 | 2 | 0 | I would like to know how to use Visual Studio with CPython (the official python.org python interpreter, not IronPython).
In particular, I am interested in getting "build" and "run" commands in Visual Studio working. Other features such as color highlighting and auto-complete, I am less concerned about.
Also, can the "b... | Running CPython Applications With Visual Studio? | 0.049958 | 0 | 0 | 437 |
2,747,017 | 2010-04-30T19:13:00.000 | 1 | 0 | 1 | 0 | python,visual-studio,visual-studio-2010 | 2,747,097 | 4 | false | 0 | 0 | Eclipse and PyDev already provide an excellent development environment for Python. Is there any reason you cannot use them? | 3 | 2 | 0 | I would like to know how to use Visual Studio with CPython (the official python.org python interpreter, not IronPython).
In particular, I am interested in getting "build" and "run" commands in Visual Studio working. Other features such as color highlighting and auto-complete, I am less concerned about.
Also, can the "b... | Running CPython Applications With Visual Studio? | 0.049958 | 0 | 0 | 437 |
2,747,860 | 2010-04-30T21:36:00.000 | 5 | 0 | 1 | 0 | python,packaging,py2exe,setuptools,distutils | 2,748,218 | 4 | true | 0 | 0 | I ended up solving it by giving py2exe the option skip_archive=True. This caused it to put the Python files not in library.zip but simply as plain files. Then I used data_files to put the data files right inside the Python packages. | 1 | 3 | 0 | I have a Python app which includes non-Python data files in some of its subpackages. I've been using the include_package_data option in my setup.py to include all these files automatically when making distributions. It works well.
Now I'm starting to use py2exe. I expected it to see that I have include_package_data=Tru... | Having py2exe include my data files (like include_package_data) | 1.2 | 0 | 0 | 15,797 |
2,748,084 | 2010-04-30T22:37:00.000 | 4 | 0 | 0 | 1 | python,mud | 2,748,104 | 7 | false | 0 | 0 | MUDs actions are usually performed on 'ticks' rather than immediately - this allows for limited affect of latency and for monster's commands to be inserted in the queue and processed fairly.
Personally, I don't like this approach, but pretty much 99% of MUDs use it. You need to design a robust command queue & event que... | 5 | 4 | 0 | I'm trying my hand at building a MUD (multiplayer interactive-fiction game)
I'm in the design/conceptualizing phase and I've run into a problem that I can't come up with a solution for. I'm hoping some more experienced programmers will have some advice.
Here's the problem as best I can explain it. When the player dec... | MUD (game) design concept question about timed events | 0.113791 | 0 | 0 | 1,814 |
2,748,084 | 2010-04-30T22:37:00.000 | 3 | 0 | 0 | 1 | python,mud | 2,749,799 | 7 | false | 0 | 0 | AI's are clients.
They're "part of the server" only in the most distant view. They're actually outside the main game engine. They're specialized clients with no human being.
An AI client has the same interface with the server that a human's client would. | 5 | 4 | 0 | I'm trying my hand at building a MUD (multiplayer interactive-fiction game)
I'm in the design/conceptualizing phase and I've run into a problem that I can't come up with a solution for. I'm hoping some more experienced programmers will have some advice.
Here's the problem as best I can explain it. When the player dec... | MUD (game) design concept question about timed events | 0.085505 | 0 | 0 | 1,814 |
2,748,084 | 2010-04-30T22:37:00.000 | 2 | 0 | 0 | 1 | python,mud | 4,190,774 | 7 | false | 0 | 0 | You could use threads to handle specific types of Mobs, and put all the instances into an array of some sort. Then, the thread simply goes through the list repeatedly applying logic. DelayTimeStart and Delay could be attributes of the parent Mob class, and when the thread goes through the loop, it can put off process... | 5 | 4 | 0 | I'm trying my hand at building a MUD (multiplayer interactive-fiction game)
I'm in the design/conceptualizing phase and I've run into a problem that I can't come up with a solution for. I'm hoping some more experienced programmers will have some advice.
Here's the problem as best I can explain it. When the player dec... | MUD (game) design concept question about timed events | 0.057081 | 0 | 0 | 1,814 |
2,748,084 | 2010-04-30T22:37:00.000 | 0 | 0 | 0 | 1 | python,mud | 4,879,667 | 7 | false | 0 | 0 | A basic approach would be to have a data structure representing the evil monster's instance of its spell, with a cooldown timer on it. When the power is used, the cooldown is set (presumably to a number of seconds defined by the master definition of the spell); an attempt to use it again will fail just like with the p... | 5 | 4 | 0 | I'm trying my hand at building a MUD (multiplayer interactive-fiction game)
I'm in the design/conceptualizing phase and I've run into a problem that I can't come up with a solution for. I'm hoping some more experienced programmers will have some advice.
Here's the problem as best I can explain it. When the player dec... | MUD (game) design concept question about timed events | 0 | 0 | 0 | 1,814 |
2,748,084 | 2010-04-30T22:37:00.000 | 0 | 0 | 0 | 1 | python,mud | 21,559,958 | 7 | false | 0 | 0 | I'll provide you an answer from an LPMud/LDMud point of view.
Every player in the MUD is an instance of player.c. Player.c inherits from living.c. Things that are living have a heartbeat. The heartbeat function is processed once every 2 seconds for every living object on the mud (or anything that has a heartbeat() f... | 5 | 4 | 0 | I'm trying my hand at building a MUD (multiplayer interactive-fiction game)
I'm in the design/conceptualizing phase and I've run into a problem that I can't come up with a solution for. I'm hoping some more experienced programmers will have some advice.
Here's the problem as best I can explain it. When the player dec... | MUD (game) design concept question about timed events | 0 | 0 | 0 | 1,814 |
2,748,946 | 2010-05-01T04:57:00.000 | 2 | 0 | 0 | 0 | python,database,postgresql,sqlalchemy,database-schema | 2,768,187 | 4 | true | 0 | 0 | The solution is rather administrative then technical :)
The general rule is easy, there should only be tree-like dependencies in the project:
- There should always be a single master source of schema, stored together with the project source code in the version control
- Everything affected by the change in the master s... | 1 | 9 | 0 | I'm curious about how others have approached the problem of maintaining and synchronizing database changes across many (10+) developers without a DBA? What I mean, basically, is that if someone wants to make a change to the database, what are some strategies to doing that? (i.e. I've created a 'Car' model and now I wan... | What are some strategies for maintaining a common database schema with a team of developers and no DBA? | 1.2 | 1 | 0 | 930 |
2,750,341 | 2010-05-01T14:43:00.000 | 2 | 1 | 0 | 0 | python,rest,web.py | 2,750,368 | 4 | false | 1 | 0 | Instead of calling it /post/52/edit, what if you called it /post/52/editor?
Now it is a resource. Dilemma averted. | 2 | 4 | 0 | I'm almost afraid to post this question, there has to be an obvious answer I've overlooked, but here I go:
Context: I am creating a blog for educational purposes (want to learn python and web.py). I've decided that my blog have posts, so I've created a Post class. I've also decided that posts can be created, read, upda... | Is www.example.com/post/21/edit a RESTful URI? I think I know the answer, but have another question | 0.099668 | 0 | 1 | 267 |
2,750,341 | 2010-05-01T14:43:00.000 | 4 | 1 | 0 | 0 | python,rest,web.py | 2,750,379 | 4 | false | 1 | 0 | Another RESTful approach is to use the query string for modifiers: /post/52?edit=1
Also, don't get too hung up on the purity of the REST model. If your app doesn't fit neatly into the model, break the rules. | 2 | 4 | 0 | I'm almost afraid to post this question, there has to be an obvious answer I've overlooked, but here I go:
Context: I am creating a blog for educational purposes (want to learn python and web.py). I've decided that my blog have posts, so I've created a Post class. I've also decided that posts can be created, read, upda... | Is www.example.com/post/21/edit a RESTful URI? I think I know the answer, but have another question | 0.197375 | 0 | 1 | 267 |
2,750,911 | 2010-05-01T17:32:00.000 | 1 | 1 | 0 | 1 | python,unit-testing,google-app-engine | 4,059,206 | 4 | false | 1 | 0 | Since, gae is based on webhooks it can be easy to set your own testing framework for all relevant urls in your app.yaml. You can test it on sample dataset on development server ( start devel server with --datastore_path option ) and assert writes to database or webhook responses. | 1 | 17 | 0 | I'd like to write some Python unit tests for my Google App Engine. How can I set that up? Does someone happen to have some sample code which shows how to write a simple test? | Google App Engine Python Unit Tests | 0.049958 | 0 | 0 | 5,767 |
2,751,250 | 2010-05-01T19:10:00.000 | 3 | 0 | 1 | 0 | python | 2,751,264 | 5 | true | 0 | 0 | A lot of 3rd party Python modules still require Python 2.x (numpy, scipy for example). If you will use any of those, or if you don't yet know what modules you need and want to keep your options open then stick with Python 2.x for now.
If you know that all the modules you need work with Python 3.x then go with that. | 4 | 3 | 0 | I'm starting a new Python web project. With most frameworks, everyone rushes to the latest version, however, it seems that this is not as true for Python 3.x.
Which version of Python should brand new projects use? | Which version of Python should be used? | 1.2 | 0 | 0 | 317 |
2,751,250 | 2010-05-01T19:10:00.000 | 1 | 0 | 1 | 0 | python | 2,751,924 | 5 | false | 0 | 0 | I'd recommend Python 2.6 because it has some features of Python 3.x, but it still retains the same functionality found in Python 2.5. While some might argue that Python 3.x is better (quite possibly because of the immense amount of reorganisation and the fact that all strings are Unicode by default), most Python code ... | 4 | 3 | 0 | I'm starting a new Python web project. With most frameworks, everyone rushes to the latest version, however, it seems that this is not as true for Python 3.x.
Which version of Python should brand new projects use? | Which version of Python should be used? | 0.039979 | 0 | 0 | 317 |
2,751,250 | 2010-05-01T19:10:00.000 | 2 | 0 | 1 | 0 | python | 2,751,863 | 5 | false | 0 | 0 | for a web project, chose the python version that is supported by your hosting provider.
if you are lucky to have a dedicated server, then chose whatever version is best supported by the framework you chose. python 3 is still not supported by the major web framework, so python 2.6 seems the best choice.
if your project... | 4 | 3 | 0 | I'm starting a new Python web project. With most frameworks, everyone rushes to the latest version, however, it seems that this is not as true for Python 3.x.
Which version of Python should brand new projects use? | Which version of Python should be used? | 0.07983 | 0 | 0 | 317 |
2,751,250 | 2010-05-01T19:10:00.000 | 0 | 0 | 1 | 0 | python | 2,751,260 | 5 | false | 0 | 0 | I use 2.5 for Google App Engine projects and 2.6 for my Django projects. | 4 | 3 | 0 | I'm starting a new Python web project. With most frameworks, everyone rushes to the latest version, however, it seems that this is not as true for Python 3.x.
Which version of Python should brand new projects use? | Which version of Python should be used? | 0 | 0 | 0 | 317 |
2,751,548 | 2010-05-01T21:11:00.000 | 2 | 0 | 0 | 1 | python,ruby,linux,design-patterns,mvvm | 2,751,881 | 5 | false | 1 | 0 | Given how you explain your application in a comment, while fully endorsing Qt, I would also recommend you consider the many advantages that could come your way from making your application a web app.
Since you say it's a client-server app, it needs (at least) local network connectivity at least, so the first objection ... | 3 | 0 | 0 | I am investigating a switch from windows to linux and i struggle to find samples of design patterns applied in this world.
The application is a classic client server with detailed forms for each business entity.
It will be taking user input, do some validation checks, a few calculations, and save them to database.
It w... | Validity of GUI design patterns under linux | 0.07983 | 0 | 0 | 894 |
2,751,548 | 2010-05-01T21:11:00.000 | 1 | 0 | 0 | 1 | python,ruby,linux,design-patterns,mvvm | 2,751,596 | 5 | false | 1 | 0 | The two main UI toolkits in Linux these days are Qt and GTK+. Qt is widely used by the KDE desktop, while GTK+ is widely used by Gnome. But a Qt app will run in Gnome and vise-versa. Both toolkits have bindings to a massive amount of languages. | 3 | 0 | 0 | I am investigating a switch from windows to linux and i struggle to find samples of design patterns applied in this world.
The application is a classic client server with detailed forms for each business entity.
It will be taking user input, do some validation checks, a few calculations, and save them to database.
It w... | Validity of GUI design patterns under linux | 0.039979 | 0 | 0 | 894 |
2,751,548 | 2010-05-01T21:11:00.000 | 0 | 0 | 0 | 1 | python,ruby,linux,design-patterns,mvvm | 2,753,393 | 5 | false | 1 | 0 | Design (or architectural) patterns have nothing to do with the target programming language or operating system. Ook at you problem, if you can see you requirements which will be fulfilled by some solution provided by a pattern and the consequences will be good, jsut use the pattern. If you aks MVC, MVP, MVVM etc. look ... | 3 | 0 | 0 | I am investigating a switch from windows to linux and i struggle to find samples of design patterns applied in this world.
The application is a classic client server with detailed forms for each business entity.
It will be taking user input, do some validation checks, a few calculations, and save them to database.
It w... | Validity of GUI design patterns under linux | 0 | 0 | 0 | 894 |
2,751,957 | 2010-05-01T23:44:00.000 | 2 | 0 | 0 | 0 | python,mysql,apache,sqlalchemy,fastcgi | 2,751,989 | 2 | true | 0 | 0 | Looks like SQLalchemy is pushing or echoing the query to your output (where fast-cgi) is instead looking for headers, then body. Maybe setting sqlalchemy.echo to False can help. | 1 | 0 | 0 | I'm writing an Fast-CGI application that makes use of sqlAlchemy & MySQL for persistent data storage. I have no problem connecting to the DB and setting up ORM (so that tables get mapped to classes); I can even add data to tables (in memory).
But, as soon as I query the DB (and push any changes from memory to storag... | Python fCGI + sqlAlchemy = malformed header from script. Bad header=FROM tags : index.py | 1.2 | 1 | 0 | 921 |
2,752,008 | 2010-05-02T00:10:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine | 2,752,566 | 1 | false | 1 | 0 | When this has happened to me it's because I've been using a TextField, which cannot be queried (but confusingly just gets ignored). Try switching to StringField. | 1 | 2 | 0 | EDIT: Figured it out. For whatever reason the field in the index was called strWord instead of wordStr. I didn't notice because of the similarities. The file was auto generated, so I must have called the field that in a previous development version.
I've got an app with around half a million 'records', each of which on... | Appengine (python) returns empty for valid queries | 0 | 0 | 0 | 161 |
2,752,022 | 2010-05-02T00:27:00.000 | 4 | 0 | 1 | 0 | python,string,email,data-mining,fuzzy-search | 2,752,090 | 2 | true | 0 | 0 | I would first turn each string of characters into a set or multiset of words (ignoring punctuation and differences in lower/upper case). (If that's not powerful enough, in a second pass I could try pairs or even triples of adjacent words, known as bigrams and trigrams). The key measure of similarity between strings t... | 1 | 3 | 0 | I'm downloading a long list of my email subject lines , with the intent of finding email lists that I was a member of years ago, and would want to purge them from my Gmail account (which is getting pretty slow.)
I'm specifically thinking of newsletters that often come from the same address, and repeat the product/servi... | Algorithm detect repeating/similiar strings in a corpus of data -- say email subjects, in Python | 1.2 | 0 | 0 | 768 |
2,752,047 | 2010-05-02T00:35:00.000 | 0 | 0 | 0 | 0 | python,database,openfire | 2,766,455 | 1 | false | 0 | 0 | Openfire uses a SQL database. So talking to the database from python is probably the easiest way.
You could also try to connect/authenticate via XMPP - there's probably an xmpp library for python somewhere. | 1 | 0 | 0 | How would one go about authenticating against a single db using Python and openfire? Is there a simple module that will do this? | I need to authenticate against one db with python and openfire. How do I do this? | 0 | 1 | 0 | 94 |
2,752,055 | 2010-05-02T00:38:00.000 | 1 | 0 | 1 | 0 | python | 2,752,070 | 5 | false | 0 | 0 | 1) Yes, if you grasped the material in your intro to C++ class you should be able to pick up the basics of Python without too much trouble
2) It can be. There's Py2Exe which can include the necessary python files to run standalone. Otherwise Python will need to be installed. | 2 | 1 | 0 | I'm thinking about rewriting an MS Access db I wrote years ago into a stand-alone Python app.
Other than a college class called "Intro to C++" (console only, with OOP concepts) and the Access db itself, I have no experience, so I need to ask if the basis for my decision to go with Python is correct. Is it true that:
1... | Python questions from beginner | 0.039979 | 0 | 0 | 386 |
2,752,055 | 2010-05-02T00:38:00.000 | 2 | 0 | 1 | 0 | python | 2,752,156 | 5 | false | 0 | 0 | Python is like the game Go, the rules are easy, but it's hard to master. You'll get started easily, but if you wind up using it as an interpreted version of VB, or C, you'll be missing much of the point.
More to the point, if your Access application is UI-centric, Python is not necessarily the natural platform to port... | 2 | 1 | 0 | I'm thinking about rewriting an MS Access db I wrote years ago into a stand-alone Python app.
Other than a college class called "Intro to C++" (console only, with OOP concepts) and the Access db itself, I have no experience, so I need to ask if the basis for my decision to go with Python is correct. Is it true that:
1... | Python questions from beginner | 0.07983 | 0 | 0 | 386 |
2,752,915 | 2010-05-02T08:56:00.000 | 2 | 0 | 0 | 1 | python,linux,bash,unix,scripting | 2,752,934 | 2 | false | 0 | 0 | Use incron to create the symlink, then find -L in cron to break it. | 1 | 2 | 0 | i have a large number of files/folders coming in each day that are being sorted automatically to a wide variety of folders. I'm looking for a way to automatically find these files/folders and create symlinks to them all within an "incoming" folder. Searching for file age should be sufficient for finding the files, howe... | symlink files newer than X age, then later remove symlink once file ages? | 0.197375 | 0 | 0 | 465 |
2,753,966 | 2010-05-02T15:39:00.000 | 0 | 1 | 0 | 0 | python,permissions,distutils,setup.py | 7,931,034 | 3 | false | 0 | 0 | I find that the module is installed without o+rx permissions using disutils
I don’t remember right now if distutils copies the files with their rights as is or if it just copies the contents.
(in spite of setting umask ahead of running setup.py)
I’m not sure how umask and file copying from Python should interact; do... | 1 | 1 | 0 | I am configuring a distutils-based setup.py for a python module that is to be installed on a heterogeneous set of resources. Due to the heterogeneity, the location where the module is installed is not the same on each host however disutils picks the host-specific location.
I find that the module is installed without o... | setting permissions of python module (python setup install) | 0 | 0 | 0 | 1,654 |
2,755,069 | 2010-05-02T21:27:00.000 | 2 | 0 | 0 | 1 | python,ajax,google-app-engine,tinymce,text-editor | 2,758,807 | 2 | false | 1 | 0 | It sounds to me like you want to use the Google Docs editor like a widget within your application. To the best of my knowledge you can't do this. | 1 | 1 | 0 | What is the best way to create a custom document editor in GAE? I'm making a website meant for a School Robotics Club (With support for any other organization - DRY).
We currently use Google services for online collaboration, I'm wondering if there is a way to tap into Google Docs and allow users to edit a Google Docum... | Google App Engine - Document Editor Creation/Tap Into Google Docs? | 0.197375 | 0 | 0 | 655 |
2,755,403 | 2010-05-02T23:17:00.000 | -4 | 0 | 1 | 0 | python,function,recursion | 2,755,421 | 6 | false | 0 | 0 | This sounds like homework. So this is probably cheating:
a+b is the same as a.__add__(b), and
a-b is the same as a.__sub__(b).
So you can easily add or subtract two numbers without using +/-. No need for any recursion. | 1 | 0 | 0 | I need to write a recursive function that can add two numbers (x, y), assuming y is not negative. I need to do it using two functions which return x-1 and x+1, and I can't use + or - anywhere in the code. I have no idea how to start, any hints? | Using recursion to sum two numbers (python) | -1 | 0 | 0 | 6,761 |
2,756,311 | 2010-05-03T05:41:00.000 | 4 | 1 | 0 | 0 | python,api,mailman | 3,154,975 | 3 | false | 1 | 0 | probably too late, but the list_members LISTNAME command (executed from a shell) will give you all the members of a list.
list_admins LISTNAME will give you the owners
What do you mean by membership type? list_members does have an option to filter on digest vs non-digest members. I don't think there's a way to get the ... | 1 | 2 | 0 | I am trying to migrate a legacy mailing list to a new web forum software and was wondering if mailman has an export option or an API to get all lists, owners, members and membership types. | Does Mailman have an API or an export lists, users and owners option? | 0.26052 | 0 | 1 | 2,988 |
2,757,991 | 2010-05-03T12:33:00.000 | 2 | 0 | 0 | 1 | python,operating-system | 2,758,136 | 1 | false | 0 | 0 | The ability to change the FSUID is limited to either root or non-root processes with the CAP_SETFCAP capability. These days it's usually considered bad practice to run a webserver with root permissions so, most likely, you'll need to set the capability on the file server (see man capabilities for details). Please note ... | 1 | 0 | 0 | I'm trying to use setfsuid() with python 2.5.4 and RHEL 5.4.
Since it's not included in the os module, I wrapped it in a C module of my own and installed it as a python extension module using distutils.
However when I try to use it I don't get the expected result.
setfsuid() returns value indicating success (changing f... | setfsuid() and python 2.5.4 | 0.379949 | 0 | 0 | 454 |
2,758,868 | 2010-05-03T14:48:00.000 | 1 | 0 | 1 | 0 | python,ruby,shred | 2,761,186 | 2 | false | 0 | 0 | Since this is a learning exercise and not a professional attempt to secure data. How about this:
1. Discover the length of the file.
2. Write 0's to the same length of the file.
3. Save the file.
4. Delete the file.
Then make another program that tries to recover the file.
But yes, if looking to make something professi... | 1 | 4 | 0 | In the effort to learn python and/or ruby, I was wondering how a file shredder would be implemented? I would like it to take in a file as an argument and then employ an algorithm to make that file unrecoverable. Would possibly add the support for multiple files or even whole directories later. | Writing a file shredder in python or ruby? | 0.099668 | 0 | 0 | 2,151 |
2,758,921 | 2010-05-03T14:54:00.000 | 2 | 0 | 1 | 0 | python,regex | 2,759,044 | 7 | false | 0 | 0 | I'd rather just call ord on every character in the string, 1 by 1. If ord([char]) >= 128 the character is not an ascii character and should be replaced. | 1 | 7 | 0 | I need to change some characters that are not ASCII to '_'.
For example,
Tannh‰user -> Tannh_user
If I use regular expression with Python, how can I do this?
Is there better way to do this not using RE? | Regular expression that finds and replaces non-ascii characters with Python | 0.057081 | 0 | 0 | 17,450 |
2,759,067 | 2010-05-03T15:17:00.000 | 4 | 0 | 1 | 0 | python,file-io,file-rename | 2,759,105 | 15 | false | 0 | 0 | It seems that your problem is more in determining the new file name rather than the rename itself (for which you could use the os.rename method).
It is not clear from your question what the pattern is that you want to be renaming. There is nothing wrong with string manipulation. A regular expression may be what you nee... | 1 | 412 | 0 | I'm trying to rename some files in a directory using Python.
Say I have a file called CHEESE_CHEESE_TYPE.*** and want to remove CHEESE_ so my resulting filename would be CHEESE_TYPE
I'm trying to use the os.path.split but it's not working properly. I have also considered using string manipulations, but have not been su... | Rename multiple files in a directory in Python | 0.053283 | 0 | 0 | 623,079 |
2,759,323 | 2010-05-03T15:56:00.000 | 18 | 0 | 1 | 0 | python,path | 2,759,329 | 8 | false | 0 | 0 | glob.glob or os.listdir will do it. | 1 | 237 | 0 | Can’t be hard, but I’m having a mental block. | How can I list the contents of a directory in Python? | 1 | 0 | 0 | 237,951 |
2,759,623 | 2010-05-03T16:41:00.000 | 1 | 0 | 1 | 0 | python,installation,dependencies,multiple-versions | 2,759,708 | 8 | false | 0 | 0 | What I usually do is trying to (progressively) keep up with the Python versions as they come along (and once all of the external dependencies have correct versions available).
Most of the time the Python code itself can be transferred as-is with only minor needed modifications.
My biggest Python project @ work (15.000+... | 4 | 10 | 0 | short version: how can I get rid of the multiple-versions-of-python nightmare ?
long version: over the years, I've used several versions of python, and what is worse, several extensions to python (e.g. pygame, pylab, wxPython...). Each time it was on a different setup, with different OSes, sometimes different architect... | How to maintain long-lived python projects w.r.t. dependencies and python versions? | 0.024995 | 0 | 0 | 737 |
2,759,623 | 2010-05-03T16:41:00.000 | 4 | 0 | 1 | 0 | python,installation,dependencies,multiple-versions | 2,759,813 | 8 | true | 0 | 0 | Some tips:
on Mac OS X, use only the python installation in /Library/Frameworks/Python.framework.
whenever you use numpy/scipy/matplotlib, install the enthought python distribution
use virtualenv and virtualenvwrapper to keep those "system" installations pristine; ideally use one virtual environment per project, so ea... | 4 | 10 | 0 | short version: how can I get rid of the multiple-versions-of-python nightmare ?
long version: over the years, I've used several versions of python, and what is worse, several extensions to python (e.g. pygame, pylab, wxPython...). Each time it was on a different setup, with different OSes, sometimes different architect... | How to maintain long-lived python projects w.r.t. dependencies and python versions? | 1.2 | 0 | 0 | 737 |
2,759,623 | 2010-05-03T16:41:00.000 | 1 | 0 | 1 | 0 | python,installation,dependencies,multiple-versions | 2,844,226 | 8 | false | 0 | 0 | install the python versions you need, better if from sources
when you write a script, include the full python version into it (such as #!/usr/local/bin/python2.6)
I can't see what could go wrong.
If something does, it's probably macports fault anyway, not yours (one of the reasons I don't use macports anymore).
I know... | 4 | 10 | 0 | short version: how can I get rid of the multiple-versions-of-python nightmare ?
long version: over the years, I've used several versions of python, and what is worse, several extensions to python (e.g. pygame, pylab, wxPython...). Each time it was on a different setup, with different OSes, sometimes different architect... | How to maintain long-lived python projects w.r.t. dependencies and python versions? | 0.024995 | 0 | 0 | 737 |
2,759,623 | 2010-05-03T16:41:00.000 | 0 | 0 | 1 | 0 | python,installation,dependencies,multiple-versions | 2,853,892 | 8 | false | 0 | 0 | At least under Linux, multiple pythons can co-exist fairly happily. I use Python 2.6 on a CentOS system that needs Python 2.4 to be the default for various system things. I simply compiled and installed python 2.6 into a separate directory tree (and added the appropriate bin directory to my path) which was fairly painl... | 4 | 10 | 0 | short version: how can I get rid of the multiple-versions-of-python nightmare ?
long version: over the years, I've used several versions of python, and what is worse, several extensions to python (e.g. pygame, pylab, wxPython...). Each time it was on a different setup, with different OSes, sometimes different architect... | How to maintain long-lived python projects w.r.t. dependencies and python versions? | 0 | 0 | 0 | 737 |
2,759,738 | 2010-05-03T17:00:00.000 | 0 | 1 | 0 | 0 | c++,python,graphics,video,video-processing | 2,760,860 | 1 | true | 0 | 1 | I'm not sure I understand the question correctly but a video file is a sequence of pictures that you can extract (for instance with the opencv library C++ interface) and then you can use it wherever you want. You can play the video on the sides of an opengl 3D cube (available in all opengl tutorials) and other 3D eleme... | 1 | 0 | 0 | Imagine I have a video playing.. Can I have some sort of motion graphics being played 'over' that video.. Like say the moving graphics is on an upper layer than the video, which would be the lower layer..
I am comfortable in a C++ and Python, so a solution that uses these two will be highly appreciated..
Thank you in ... | Navigation graphics overlayed over video | 1.2 | 0 | 0 | 169 |
2,760,652 | 2010-05-03T19:29:00.000 | 16 | 0 | 1 | 1 | python,subprocess | 12,956,839 | 9 | false | 0 | 0 | If you delete the subprocess object, using del to force garbage collection, that will cause the subprocess object to be deleted and then the defunct processes will go away without terminating your interpreter. You can try this out in the python command line interface first. | 4 | 53 | 0 | When I kick off a python script from within another python script using the subprocess module, a zombie process is created when the subprocess "completes". I am unable to kill this subprocess unless I kill my parent python process.
Is there a way to kill the subprocess without killing the parent? I know I can do this ... | how to kill (or avoid) zombie processes with subprocess module | 1 | 0 | 0 | 62,258 |
2,760,652 | 2010-05-03T19:29:00.000 | 5 | 0 | 1 | 1 | python,subprocess | 6,236,440 | 9 | false | 0 | 0 | The python runtime takes responsibility for getting rid of zombie process once their process objects have been garbage collected. If you see the zombie lying around it means you have kept a process object and not called wait, poll or terminate on it. | 4 | 53 | 0 | When I kick off a python script from within another python script using the subprocess module, a zombie process is created when the subprocess "completes". I am unable to kill this subprocess unless I kill my parent python process.
Is there a way to kill the subprocess without killing the parent? I know I can do this ... | how to kill (or avoid) zombie processes with subprocess module | 0.110656 | 0 | 0 | 62,258 |
2,760,652 | 2010-05-03T19:29:00.000 | 0 | 0 | 1 | 1 | python,subprocess | 40,458,489 | 9 | false | 0 | 0 | Recently, I came across this zombie problem due to my python script. The actual problem was mainly due to killing of the subprocess and the parent process doesn't know that the child is dead. So what I did was, just adding popen.communicate() after the kill signal of child process so that the parent process comes to kn... | 4 | 53 | 0 | When I kick off a python script from within another python script using the subprocess module, a zombie process is created when the subprocess "completes". I am unable to kill this subprocess unless I kill my parent python process.
Is there a way to kill the subprocess without killing the parent? I know I can do this ... | how to kill (or avoid) zombie processes with subprocess module | 0 | 0 | 0 | 62,258 |
2,760,652 | 2010-05-03T19:29:00.000 | 1 | 0 | 1 | 1 | python,subprocess | 64,438,478 | 9 | false | 0 | 0 | Like this:
s = Popen(args)
s.terminate()
time.sleep(0.5)
s.poll()
it works
zombie processes will disappear | 4 | 53 | 0 | When I kick off a python script from within another python script using the subprocess module, a zombie process is created when the subprocess "completes". I am unable to kill this subprocess unless I kill my parent python process.
Is there a way to kill the subprocess without killing the parent? I know I can do this ... | how to kill (or avoid) zombie processes with subprocess module | 0.022219 | 0 | 0 | 62,258 |
2,761,145 | 2010-05-03T20:57:00.000 | 0 | 1 | 1 | 0 | python | 2,761,222 | 3 | false | 0 | 0 | It depends on your definition of "method".
In some sense, no, classes aren't necessary for creating methods in Python, because there are no methods anyway in Python. There are only procedures (which, for some strange reason, are called functions in Python). You can create a procedure anywhere you like. A method is just... | 1 | 3 | 0 | Are classes necessary for creating methods (defs) in Python? | Are classes necessary for creating methods (defs) in Python? | 0 | 0 | 0 | 380 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.