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,431,236 | 2010-03-12T07:56:00.000 | 2 | 1 | 1 | 1 | python,py2exe,upx | 2,433,251 | 1 | false | 0 | 0 | I have experienced significant increases in start up time when UPX compressed executables are run on systems with certain virus scanners. I was only compressing single executables, but I expect that each compressed dll would add to the start time.
Is it really necessary to use UPX? I can't imagine the space savings t... | 1 | 2 | 0 | Are there any downsides to UPX-ing my 32-bit Python 2.6.4 development environment EXE/PYD/DLL files?
The reason I'm asking is that I frequently use a custom PY2EXE script that UPX's copies of these files on every build.
Yes, I could get fancy and try to cache UPXed files, but I think a simpler, safer, and higher perfor... | Any downsides to UPX-ing my 32-bit Python 2.6.4 development environment EXE/PYD/DLL files? | 0.379949 | 0 | 0 | 637 |
2,431,844 | 2010-03-12T10:02:00.000 | 1 | 0 | 0 | 0 | python,qt,pyqt,signals,qtablewidget | 2,432,210 | 3 | false | 0 | 1 | It seems, that this is the only signal in QTableWidget at least for 4.6. You could post a feature request, but I don't know if it is accepted and you might wait for long time ;-)
Maybe you could try to write a subclass of QTableWidget and emit own signals, when cell is changed internally.
Anyway, disconnecting for the ... | 2 | 4 | 0 | i am using PyQt but my question is a general Qt one:
I have a QTableWidget that is set up by the function updateTable. It writes the data from DATASET to the table when it is called. Unfortunately this causes my QTableWidget to emit the signal cellChanged() for every cell.
The signal cellChanged() is connected to a fun... | QTableWidget signal cellChanged(): distinguish between user input and change by routines | 0.066568 | 0 | 0 | 5,819 |
2,431,844 | 2010-03-12T10:02:00.000 | 1 | 0 | 0 | 0 | python,qt,pyqt,signals,qtablewidget | 2,449,334 | 3 | false | 0 | 1 | I would recommend changing from a QTableWidget to a QTableView with an appropriate model. From the sounds of it, you have a database or other data object holding and arranging the data anyway, so it would hopefully be fairly easy to do. This would then allow you to distinguish between edits (setData is called on your... | 2 | 4 | 0 | i am using PyQt but my question is a general Qt one:
I have a QTableWidget that is set up by the function updateTable. It writes the data from DATASET to the table when it is called. Unfortunately this causes my QTableWidget to emit the signal cellChanged() for every cell.
The signal cellChanged() is connected to a fun... | QTableWidget signal cellChanged(): distinguish between user input and change by routines | 0.066568 | 0 | 0 | 5,819 |
2,432,468 | 2010-03-12T11:55:00.000 | 1 | 0 | 0 | 0 | python,gtk,pygtk,glade | 2,432,881 | 1 | true | 0 | 1 | You could be a bit clearer, it's not obvious what you do with your GtkEntry after creating it. The easiest thing would be to just add it to a Python list, so you can iterate over all created GtkEntry widgets later.
Or, you could "tag" the widgets with something to make them identifiable, and iterate over the containing... | 1 | 0 | 0 | On a click of a button named "Add Textbox" it calls a function which creates a single textbox using (gtk.Entry) function. So each time i click that button it creates a textbox. I have a submit button which should fetches all the values of the text boxes(say 10 textboxes) generated with the name of "entry". It works for... | Getting values from Multiple Text Entry using Pygtk and Python | 1.2 | 0 | 0 | 1,035 |
2,432,792 | 2010-03-12T12:54:00.000 | 5 | 1 | 0 | 0 | c++,python,c,performance,opencv | 2,433,626 | 2 | true | 0 | 0 | You've answered your own question pretty well. Most of the expensive computations should be within the OpenCV library, and thus independent of the language you use.
If you're really concerned about efficiency, you could profile your code and confirm that this is indeed the case. If need be, your custom processing func... | 2 | 1 | 1 | I'm doing some prototyping with OpenCV for a hobby project involving processing of real time camera data. I wonder if it is worth the effort to reimplement this in C or C++ when I have it all figured out or if no significant performance boost can be expected. The program basically chains OpenCV functions, so the main p... | OpenCV performance in different languages | 1.2 | 0 | 0 | 1,352 |
2,432,792 | 2010-03-12T12:54:00.000 | 0 | 1 | 0 | 0 | c++,python,c,performance,opencv | 2,470,491 | 2 | false | 0 | 0 | OpenCV used to utilize IPP, which is very fast. However, OpenCV 2.0 does not. You might customize your OpenCV using IPP, for example color conversion routines. | 2 | 1 | 1 | I'm doing some prototyping with OpenCV for a hobby project involving processing of real time camera data. I wonder if it is worth the effort to reimplement this in C or C++ when I have it all figured out or if no significant performance boost can be expected. The program basically chains OpenCV functions, so the main p... | OpenCV performance in different languages | 0 | 0 | 0 | 1,352 |
2,433,293 | 2010-03-12T14:21:00.000 | 1 | 0 | 0 | 0 | python,telnet | 2,433,355 | 2 | true | 0 | 0 | Put tn.read_until("123", 2) in a loop. | 1 | 0 | 0 | I'm writing a simple script, that just connects to telnet port, listens everything on it, staying connected and when some string, for example '123' appears, script do something.
I use tn.read_until("123", 2), but when '123' appears, script just disconnects. How to make it stay online? | EOL character in Linux and Windows | 1.2 | 0 | 0 | 384 |
2,433,816 | 2010-03-12T15:41:00.000 | 3 | 0 | 1 | 0 | python,exception-handling | 2,433,856 | 2 | true | 0 | 0 | I would say that "trapping" and "catching" an exception are the same thing: you have to trap/catch it to be able to handle it, but the act of trapping it is not the same as handling it.
Trapping-but-not-handling = supressing, in other words. Handling implies that you actually do something with the information at your ... | 1 | 2 | 0 | I'm looking into exception handling in python and a blog post I read differentiated between trapping and handling an exception. Can someone explain the core difference between these two, both in python specifically and the overall conceptual difference? A google search for 'exception trapping handling' isn't super-usef... | What is the difference between trapping and handling an exception? | 1.2 | 0 | 0 | 1,373 |
2,435,066 | 2010-03-12T18:59:00.000 | 23 | 0 | 1 | 0 | python,python-3.x,introspection | 5,876,453 | 3 | false | 0 | 0 | The callable() builtin function from Py2.x was resurrected in python3.2. | 1 | 13 | 0 | I was studying introspection in Python, and as I was getting through basic examples, I found out that the callable built-in function is no longer available in Python 3.1.
How can I check if a method is callable now?
Thank you | What is the new way of checking "callable" methods in python 3.x? | 1 | 0 | 0 | 4,173 |
2,435,281 | 2010-03-12T19:32:00.000 | 0 | 0 | 0 | 0 | python,database,postgresql | 2,435,639 | 1 | true | 0 | 0 | To make sure we're on the same page, is the following correct?
You're inserting the photo information into the Photo table immediately after the user uploads the photo but before he/she submits the form;
When the user submits the form, you're inserting a row into the User table;
One of the items in that row is informa... | 1 | 0 | 0 | Let's say I have an user registration form. In this form, I have the option for the user to upload a photo. I have an User table and Photo table. My User table has a "PathToPhoto" column. My question is how do I fill in the "PathToPhoto" column if the photo is uploaded and inserted into Photo table before the user i... | Database: storing data from user registration form | 1.2 | 1 | 0 | 397 |
2,435,294 | 2010-03-12T19:34:00.000 | 0 | 0 | 0 | 0 | python,ruby,client,size | 2,435,731 | 1 | false | 0 | 0 | Could you add a little more information and code to your example?
Are you thinking about sock.recv_into() which takes a buffer and buffer size as arguments? Alternately, are you hitting a timeout issue by failing to have a keepalive on the Ruby side?
Guessing in advance of knowledge. | 1 | 0 | 0 | We have server on Python and client + web service on Ruby. That works only if file from URL is less than 800 k. It seems like "socket.puts data" in a client works, but "output = socket.gets" - not. I think problem is in a Python part. For big files tests run "Connection reset by peer". Is it buffer size variable by def... | File size in Python server | 0 | 0 | 1 | 183 |
2,435,470 | 2010-03-12T19:59:00.000 | -1 | 0 | 0 | 0 | python,pdf,qt4,pyqt4 | 2,435,561 | 3 | false | 0 | 1 | what about okular? It is a full app, but it can always be call from another app. | 1 | 8 | 0 | I'm writing a Python+Qt4 application that would ideally need to pop up a window every once in a while, to display pdf documents and allow very basic operations, namely scrolling through the different pages and printing the document.
I've found the reportLab to create pdf files, but nothing about pdf viewers. Does anyon... | pdf viewer for pyqt4 application? | -0.066568 | 0 | 0 | 6,219 |
2,436,578 | 2010-03-12T23:39:00.000 | 9 | 0 | 1 | 0 | python,callable | 2,436,587 | 3 | true | 0 | 0 | They take parameters and return a result depending on those parameters.
A callable is just an abstract form of a function resp an interface that defines that an object acts like a function (i.e. accepts parameters).
As functions are first class objects, it is obvious that functions are callable objects. If you are talk... | 2 | 12 | 0 | What is the purpose of a callable object? What problems do they solve? | Why do we have callable objects in python? | 1.2 | 0 | 0 | 7,287 |
2,436,578 | 2010-03-12T23:39:00.000 | 13 | 0 | 1 | 0 | python,callable | 2,436,614 | 3 | false | 0 | 0 | Many kinds of objects are callable in Python, and they can serve many purposes:
functions are callable, and they may carry along a "closure" from an outer function
classes are callable, and calling a class gets you an instance of that class
methods are callable, for function-like behavior specifically pertaining to an... | 2 | 12 | 0 | What is the purpose of a callable object? What problems do they solve? | Why do we have callable objects in python? | 1 | 0 | 0 | 7,287 |
2,436,787 | 2010-03-13T00:46:00.000 | 0 | 0 | 0 | 0 | python,continuous-integration,hudson,pylint,pyflakes | 34,396,655 | 3 | false | 0 | 0 | The Violations plugin requires xml output from the various checkers
This is wrong: Some checkers like "checkstyle" output XML, some others like "pylint" and "pep8" output "text" files with one record per line. The heading in Jenkins "XML filename pattern" is plain misleading. | 2 | 8 | 0 | We use Hudson for continuous integration with the Violations Plugin which parses our output from pylint. However, pylint is a bit too strict, and hard to configure. What we'd rather use is pyflakes which would give us the right level of "You're doing it wrong." | How would I start integrating pyflakes with Hudson | 0 | 0 | 0 | 1,783 |
2,436,787 | 2010-03-13T00:46:00.000 | 1 | 0 | 0 | 0 | python,continuous-integration,hudson,pylint,pyflakes | 2,436,865 | 3 | false | 0 | 0 | The Violations plugin requires xml output from the various checkers that it supports.
I'm not familiar with pyflakes, but from my brief scan, it doesn't appear to support xml as an output type. So you'll have to post-process the pyflakes output before letting Violations try to parse it (or you could modify pyflakes an... | 2 | 8 | 0 | We use Hudson for continuous integration with the Violations Plugin which parses our output from pylint. However, pylint is a bit too strict, and hard to configure. What we'd rather use is pyflakes which would give us the right level of "You're doing it wrong." | How would I start integrating pyflakes with Hudson | 0.066568 | 0 | 0 | 1,783 |
2,436,927 | 2010-03-13T01:41:00.000 | 0 | 0 | 0 | 1 | .net,python,windows-services,ironpython | 2,539,346 | 3 | true | 0 | 0 | I had to host a WCF in the windows service to allow it to be notified remotely. Just to keep deploying the solution as simple as possible. using the ServiceController would require the correct setup of permissions | 1 | 1 | 0 | What is the easiest way to ping/notify a .NET Windows Service? Do I have to use WCF for this? Or is there an easier way?
I would like to be able to wake up the service using a Python (or an Iron Python) script from anywhere.
Also is there a way I can be notified (by email) if that the service has stopped? | What is the easiest way to ping/notify a .NET Windows Service? | 1.2 | 0 | 0 | 858 |
2,437,167 | 2010-03-13T03:31:00.000 | 4 | 0 | 0 | 0 | python,scripting,command-prompt | 2,437,395 | 2 | false | 1 | 0 | Check assoc and ftype. If properly set, you can run a .py with arguments.
> assoc .py
.py=Python.File
> ftype Python.File
Python.File="C:\Python26\python.exe" "%1" %*
Depending on how your Python was installed, these may or may not be in place. You can set them with assoc and ftype.
> assoc .py=Python.File
> ftype... | 2 | 4 | 0 | I am trying to run my python scripts in the command-prompt without calling python.exe first. I am specifically doing this in relation to running django-admin.py. I have C:\Python26 and C:\Python26\Scripts in my PATH. However, if I try running django-admin.py by doing:
django-admin.py startproject helloworld
I get... | Issues running python scripts in Command Prompt (Specifically with command line arguments)? | 0.379949 | 0 | 0 | 1,347 |
2,437,167 | 2010-03-13T03:31:00.000 | 1 | 0 | 0 | 0 | python,scripting,command-prompt | 4,603,488 | 2 | false | 1 | 0 | I know this is an old thread, but I have searched for a few weeks for this very same problem and found nothing.
Today, however, I tried something new:
If you are using Windows 7, do not use Command Prompt for scripting purposes.
Instead, use the Windows PowerShell located at: All Programs -> Accessories -> Windows ... | 2 | 4 | 0 | I am trying to run my python scripts in the command-prompt without calling python.exe first. I am specifically doing this in relation to running django-admin.py. I have C:\Python26 and C:\Python26\Scripts in my PATH. However, if I try running django-admin.py by doing:
django-admin.py startproject helloworld
I get... | Issues running python scripts in Command Prompt (Specifically with command line arguments)? | 0.099668 | 0 | 0 | 1,347 |
2,437,196 | 2010-03-13T03:46:00.000 | 2 | 0 | 1 | 0 | python,character-codes | 2,437,201 | 3 | true | 0 | 0 | \v is a vertical tab. It was used in line printers to advance about 6 lines or so. It can be typed in *nix by pressing Ctrl-V Ctrl-K.
\f is a formfeed. It was used in line printers to advance to the next page. It can be typed in *nix by pressing Ctrl-V Ctrl-L. | 1 | 1 | 0 | In Python's module named string, there is a line that says whitespace = ' \t\n\r\v\f'.
' ' is a space character.
'\t' is a tab character.
'\n' is a newline character.
'\r' is a carriage-return character.
'\v' maps to '\x0b' (11). What does it mean and how might it be typed on a keyboard (any OS)?
'\f' maps to '\x0c... | Special Character Meanings Defined | 1.2 | 0 | 0 | 327 |
2,437,582 | 2010-03-13T07:06:00.000 | 1 | 1 | 0 | 0 | python,ruby | 2,437,648 | 2 | false | 0 | 0 | $ cat > hello.rb
$hello = 'Hello, world!'
puts $hello
^D
$ irb
irb(main):001:0> load 'hello.rb'
Hello, world!
=> true
irb(main):002:0> $hello
=> "Hello, world!"
A bit tedious, and local variables won't carry through. May be close enough for your usage? (This is basically like Python's execfile.) | 2 | 2 | 0 | ruby -n is the closest thing I found, but it repeats the whole script. Also it's not available for irb. | Is there a ruby equivalent of "python -i"? | 0.099668 | 0 | 0 | 267 |
2,437,582 | 2010-03-13T07:06:00.000 | 1 | 1 | 0 | 0 | python,ruby | 2,880,523 | 2 | true | 0 | 0 | irb -r hello.rb | 2 | 2 | 0 | ruby -n is the closest thing I found, but it repeats the whole script. Also it's not available for irb. | Is there a ruby equivalent of "python -i"? | 1.2 | 0 | 0 | 267 |
2,439,039 | 2010-03-13T16:22:00.000 | 1 | 0 | 0 | 0 | python,wxwidgets | 2,439,208 | 2 | false | 0 | 1 | You can embed IE, but I think that's about it. wxWebKit is working on a wx add-on to use WebKit as an embedded browser in wx, but I think it's still a work in progress. | 1 | 0 | 0 | I need to show a webpage (a complex page with script and stuff, no static html) in a frame or something. It's for a desktop application, I'm using python 2.6 + wxPython 2.8.10.1. I need to catch some events too (mostly about changing page). I've found some samples using the webview module in a gtk application, but I co... | how to embed a webpage using wx? | 0.099668 | 0 | 0 | 788 |
2,439,216 | 2010-03-13T17:17:00.000 | 1 | 0 | 1 | 0 | python | 2,439,234 | 6 | false | 0 | 0 | Introduce them to enough tools (array slicing and perhaps functional-style recursion, in particular) to accomplish the reversal. Then, let them struggle with trying to figure it out for a while. Take a few different answers and compare them, showing the pros and cons of each way. | 1 | 4 | 0 | I am teaching a course "Introduction to Computer Programming" to the first year math students. One has to assume that this is the first exposure of students to computer programming. Here are the main goals of my teaching:
Students should learn and understand the basics of Python.
Eventually they need to master suffici... | How to teach beginners reversing a string in Python? | 0.033321 | 0 | 0 | 2,254 |
2,439,520 | 2010-03-13T18:40:00.000 | 3 | 0 | 1 | 0 | python,wxwidgets,tkinter,py2exe | 2,440,302 | 4 | false | 0 | 1 | If you're not afraid to learn a new language, consider Tcl/Tk. The reason I mention this is Tcl's superior-to-almost-everything distribution mechanism which makes it really easy to wrap up a single file exe that includes everything you need -- the Tcl/Tk runtime, your program, icons, sound files, etc. inside an embedde... | 2 | 7 | 0 | I'm a newbie with a little experience writing in BASIC, Python and, of all things, a smidgeon of assembler (as part of a videogame ROM hack). I wanted to create small tool for modifying the hex values at particular points, in a particular file, that would have a GUI interface.
What I'm looking for is the ability to cre... | As a newbie, where should I go if I want to create a small GUI program? | 0.148885 | 0 | 0 | 640 |
2,439,520 | 2010-03-13T18:40:00.000 | 0 | 0 | 1 | 0 | python,wxwidgets,tkinter,py2exe | 2,440,232 | 4 | false | 0 | 1 | Python would fit your needs.
wxWidgets and Python are completely different things. I think you mean wxPython, which is a GUI toolkit for Python. I am not sure whether Py2Exe would include this, as I have never used Py2Exe - I build the packages and their dependencies manually.
Pretty sure tkinter would be included. I u... | 2 | 7 | 0 | I'm a newbie with a little experience writing in BASIC, Python and, of all things, a smidgeon of assembler (as part of a videogame ROM hack). I wanted to create small tool for modifying the hex values at particular points, in a particular file, that would have a GUI interface.
What I'm looking for is the ability to cre... | As a newbie, where should I go if I want to create a small GUI program? | 0 | 0 | 0 | 640 |
2,439,638 | 2010-03-13T19:09:00.000 | 1 | 0 | 1 | 0 | python | 2,439,836 | 5 | false | 0 | 0 | I have recently taught a short Python crash course to 1st-3rd year Computer Science students the majority of whom knew only C and C++, and even that not so well. My approach was quite different from what you are suggesting.
Disclaimer: The aim of my course was to introduce the language to people who are already familia... | 1 | 17 | 0 | I am teaching Python to undergraduate math majors. I am interested in the optimal order in which students should be introduced to various Python concepts. In my view, at each stage the students should be able to solve a non-trivial programming problem using only the tools available at that time. Each new tool should en... | In what order should the Python concepts be explained to absolute beginners? | 0.039979 | 0 | 0 | 3,231 |
2,439,677 | 2010-03-13T19:21:00.000 | 1 | 0 | 0 | 0 | python,wxpython | 2,463,869 | 1 | true | 0 | 1 | Your only chance is to write some Custom Menu, which could be bit difficult but doable. So basically instead of using system menu etc, you create windows inside your main frame which look like menu. | 1 | 0 | 0 | I want to know if it's possible to put a frame or a panel over a menubar using wxpython?
Thanks in advance! | Is it possible to put a wx.window (frame/panel) over a wx.MenuBar? | 1.2 | 0 | 0 | 123 |
2,439,708 | 2010-03-13T19:30:00.000 | -1 | 0 | 0 | 0 | python,wxpython | 2,440,868 | 2 | false | 0 | 1 | don't think it's doable -- it defaults to the platform's native look | 1 | 1 | 0 | I want to change the wxpython menubar colours.
How can I do it? | How can we change a wx.MenuBar background and foreground colour using wxpython? | -0.099668 | 0 | 0 | 1,776 |
2,439,837 | 2010-03-13T20:01:00.000 | 0 | 0 | 1 | 0 | python,range | 2,439,859 | 5 | false | 0 | 0 | numpy.arange might serve your purpose well. | 1 | 1 | 0 | I can print a range of numbers easily using range, but is is possible to print a range with 1 decimal place from -10 to 10?
e.g
-10.0, -9.9, -9.8 all they way through to +10? | How to print a range with decimal points in Python? | 0 | 0 | 0 | 1,691 |
2,439,987 | 2010-03-13T20:54:00.000 | 1 | 0 | 1 | 0 | python,internet-explorer,caching,pylons | 3,907,139 | 4 | false | 0 | 0 | The jQuery library has pretty nice ajax functions, and settings to control them. One of them is is called "cache" and it will automatically append a random number to the query that essentially forces the browser to not cache the page. This can be set along with the parameter "dataType", which can be set to "json" to ma... | 1 | 2 | 0 | I'm have an action /json that returns json from the server.
Unfortunately in IE, the browser likes to cache this json.
How can I make it so that this action doesn't cache? | Disable browser caching in pylons | 0.049958 | 0 | 1 | 1,603 |
2,440,511 | 2010-03-13T23:35:00.000 | 8 | 1 | 0 | 1 | python,cpu,temperature | 2,440,544 | 12 | false | 0 | 0 | If your Linux supports ACPI, reading pseudo-file /proc/acpi/thermal_zone/THM0/temperature (the path may differ, I know it's /proc/acpi/thermal_zone/THRM/temperature in some systems) should do it. But I don't think there's a way that works in every Linux system in the world, so you'll have to be more specific about exa... | 1 | 28 | 0 | How do I retrieve the temperature of my CPU using Python? (Assuming I'm on Linux) | Getting CPU temperature using Python? | 1 | 0 | 0 | 57,891 |
2,440,554 | 2010-03-13T23:44:00.000 | 0 | 0 | 0 | 1 | python,video,media,gstreamer | 31,616,242 | 3 | false | 0 | 0 | Why re-invent the wheel?
Use:
gst-discoverer-1.0 filename
or
gst-discoverer-0.10 filename
Depending on the file type you may want to add " | grep Duration" to avoid the tags which can be lengthy.
For the ridding of extraneous tags for video,flac and mp3 files this should do the trick by using grep to exclud... | 1 | 13 | 0 | How do I find the playback time of media with gstreamer? | How do I find the length of media with gstreamer? | 0 | 0 | 0 | 6,793 |
2,440,579 | 2010-03-13T23:53:00.000 | 3 | 0 | 1 | 0 | python,macos,gcc,distutils,setup.py | 2,440,981 | 2 | true | 0 | 0 | I'm guessing you've installed 2.6 on 10.5 using the python.org OS X installer. In that case, the flags are accurate and you should not try to change them. The python.org installers are built using the so-called 10.4u SDK and with a deployment target of 10.3, allowing one installer image to work on Mac OS X systems fr... | 1 | 2 | 0 | I'm trying to install matplotlib on my mac setup. I find that setup.py has inaccurate flags, in particular the isysroot points to an earlier SDK.
Where does setup.py get its info and how can i fix it?
I'm on MacOS 10.5.8, XCode 3.1.2 and Python 2.6 (default config was 2.5) | Compiler options wrong with python setup.py | 1.2 | 0 | 0 | 1,851 |
2,441,078 | 2010-03-14T03:24:00.000 | 4 | 0 | 1 | 0 | python,documentation-generation,python-sphinx,epydoc | 21,603,879 | 3 | false | 0 | 0 | I recently changed from Python2 to Python3 and found that there was no Epydoc package for Python3. So it seems with Python3 there is a clear focus on using Sphinx as API documentation. | 1 | 29 | 0 | There seems to be a plethora of documentation tools for Python. Another one that I've run across is epydoc. It seems like Sphinx is the de facto standard, because it's used to generate the official Python docs. Can someone please sort out the current state of Python's documentation tools for me? | What is the relationship between docutils and Sphinx? | 0.26052 | 0 | 0 | 8,801 |
2,441,172 | 2010-03-14T04:24:00.000 | 2 | 1 | 1 | 0 | python,interpreter,embedding | 2,441,185 | 5 | false | 0 | 0 | Making a frozen binary using a utility like cx_freeze or py2exe is probably the easiest way to do this. That way you only need to distribute the executable. I know that you might prefer not to distribute a binary, but if that is a concern you could always give users the option to download the source and run from an int... | 2 | 8 | 0 | I'm looking for a way to ship the Python interpreter with my application (also written in Python), so that it doesn't need to have Python installed on the machine.
I searched Google and found a bunch of results about how to embed the Python interpreter in applications written in various languages, but nothing for appli... | Embed Python interpreter in a Python application | 0.07983 | 0 | 0 | 3,296 |
2,441,172 | 2010-03-14T04:24:00.000 | 2 | 1 | 1 | 0 | python,interpreter,embedding | 2,441,182 | 5 | false | 0 | 0 | You need some sort of executable in order to start Python. May as well be the one your app has been frozen into.
The alternative is to copy the executable, library, and pieces of the stdlib that you need into a private directory and invoke that against your app. | 2 | 8 | 0 | I'm looking for a way to ship the Python interpreter with my application (also written in Python), so that it doesn't need to have Python installed on the machine.
I searched Google and found a bunch of results about how to embed the Python interpreter in applications written in various languages, but nothing for appli... | Embed Python interpreter in a Python application | 0.07983 | 0 | 0 | 3,296 |
2,444,165 | 2010-03-14T22:56:00.000 | 4 | 0 | 1 | 0 | python,distribution | 2,444,202 | 2 | false | 0 | 0 | A zipfile (with just the .pyc or .pyo files in it, ideally) would suffice, especially if you're distributing code supporting a specific X.Y version of Python (any Z in X.Y.Z will do, i.e., if you support Python 2.6, that will work in 2.6.1, 2.6.2, and so on). Just make the zipfile part of the PYTHONPATH, just as if it... | 2 | 3 | 0 | I am writing a console application in python that will consist of a handful of modules, each with a couple hundred lines of code.
For development it would be nice to modularize the program, but for distribution I like the idea of being able to post the program as a single python script.
Are there any good scripts out t... | Good way to flatten a multiple file python program for distribution? | 0.379949 | 0 | 0 | 340 |
2,444,165 | 2010-03-14T22:56:00.000 | 0 | 0 | 1 | 0 | python,distribution | 2,596,282 | 2 | true | 0 | 0 | No code to do this seems to exist. | 2 | 3 | 0 | I am writing a console application in python that will consist of a handful of modules, each with a couple hundred lines of code.
For development it would be nice to modularize the program, but for distribution I like the idea of being able to post the program as a single python script.
Are there any good scripts out t... | Good way to flatten a multiple file python program for distribution? | 1.2 | 0 | 0 | 340 |
2,444,897 | 2010-03-15T03:19:00.000 | 1 | 0 | 1 | 0 | python,com | 2,444,939 | 2 | false | 0 | 0 | The CLSID is at least supposed not to change. Naturally a program can do a lot many stupid things breaking regulations. But: AS the CLSID is how the class is loaded, a changed CLSID would mean the USING program of a class would also have to use the changed CLSID.
Su, yous assumption is right - if the same program in th... | 2 | 0 | 0 | I am using comtypes to generate wrappers for a certain com library. I am having certain issues with a few things, that are not being generated properly. I can get around this by doing the missing work, manually. However can i depend on the fact that CLSID's will not change?
Lets say:
I install a program with the com li... | Can a CLSID be different for the same program installed on two different machines? | 0.099668 | 0 | 0 | 563 |
2,444,897 | 2010-03-15T03:19:00.000 | 1 | 0 | 1 | 0 | python,com | 2,444,964 | 2 | true | 0 | 0 | Disclaimer: Done a lot of COM, but never with python.
The UUID for a COM interface is part of the definition of the interface. It should be the same on every machine, and for all time.
Also, in ATL COM land, classes have CLSIDs, interfaces have IIDs. They both have UUIDs (or possibly GUIDs). Not sure about python. | 2 | 0 | 0 | I am using comtypes to generate wrappers for a certain com library. I am having certain issues with a few things, that are not being generated properly. I can get around this by doing the missing work, manually. However can i depend on the fact that CLSID's will not change?
Lets say:
I install a program with the com li... | Can a CLSID be different for the same program installed on two different machines? | 1.2 | 0 | 0 | 563 |
2,445,193 | 2010-03-15T05:04:00.000 | 7 | 0 | 1 | 0 | python | 2,445,239 | 5 | false | 0 | 0 | Python is dynamically typed: all variables can refer to an object of any type. id and name can be anything, but the actual objects are of types like int and str. 0 is a literal that is parsed to make an int object, and 'John' a literal that makes a str object. Many object types do not have literals and are returned by ... | 3 | 6 | 0 | Sorry if this is quite noobish to you, but I'm just starting out to learn Python after learning C++ & Java, and I am wondering how in the world I could just declare variables like id = 0 and name = 'John' without any int's or string's in front! I figured out that perhaps it's because there are no ''s in a number, but h... | How does Python differentiate between the different data types? | 1 | 0 | 0 | 1,782 |
2,445,193 | 2010-03-15T05:04:00.000 | 13 | 0 | 1 | 0 | python | 2,445,233 | 5 | true | 0 | 0 | The literal objects you mention carry (pointers to;-) their own types with them of course, so when a name's bound to that object the problem of type doesn't arise -- the object always has a type, the name doesn't -- just delegates that to the object it's bound to.
There's no "figuring out" in def increase(first, second... | 3 | 6 | 0 | Sorry if this is quite noobish to you, but I'm just starting out to learn Python after learning C++ & Java, and I am wondering how in the world I could just declare variables like id = 0 and name = 'John' without any int's or string's in front! I figured out that perhaps it's because there are no ''s in a number, but h... | How does Python differentiate between the different data types? | 1.2 | 0 | 0 | 1,782 |
2,445,193 | 2010-03-15T05:04:00.000 | 4 | 0 | 1 | 0 | python | 2,445,220 | 5 | false | 0 | 0 | When it comes to assigning literal values to variables, the type of the literal value can be inferred at the time of lexical analysis. For example, anything matching the regular expression (-)?[1-9][0-9]* can be inferred to be an integer literal. If you want to convert it to a float, there needs to be an explicit cas... | 3 | 6 | 0 | Sorry if this is quite noobish to you, but I'm just starting out to learn Python after learning C++ & Java, and I am wondering how in the world I could just declare variables like id = 0 and name = 'John' without any int's or string's in front! I figured out that perhaps it's because there are no ''s in a number, but h... | How does Python differentiate between the different data types? | 0.158649 | 0 | 0 | 1,782 |
2,445,761 | 2010-03-15T08:07:00.000 | 4 | 0 | 0 | 0 | python,mysql,database,django,django-south | 2,445,802 | 3 | true | 1 | 0 | Yes. I think it is not too late. I've moved to south in a middle of a project and I am happy with that choice. I think it is a big help for deployment.
The initialization of the south app can be done at any moment. | 1 | 5 | 0 | I already started a project, and the models are all synced and everything. | Django migrations--is it possible to use South in the middle of the project? | 1.2 | 0 | 0 | 561 |
2,447,118 | 2010-03-15T12:45:00.000 | 1 | 0 | 1 | 0 | java,python | 2,495,504 | 13 | false | 1 | 0 | Try to find algorithms that you understand well and see how they are implemented in python standard libraries.
Persist. :) | 4 | 34 | 0 | I've been writing Java for the last couple of years , and now I've started to write in python (in addition).
The problem is that when I look at my Python code it looks like someone tried to hammer Java code into a python format , and it comes out crappy because - well , python ain't Java.
Any tips on how to escape th... | Programming in Python vs. programming in Java | 0.015383 | 0 | 0 | 7,368 |
2,447,118 | 2010-03-15T12:45:00.000 | 0 | 0 | 1 | 0 | java,python | 2,447,141 | 13 | false | 1 | 0 | Learn a few other languages. It will help you make the difference between algorithms (the structure of processing, unchanged between languages) and the local syntaxic features of the language. Then you can "write Foo in Bar" for any combination of languages "Foo" and "Bar". | 4 | 34 | 0 | I've been writing Java for the last couple of years , and now I've started to write in python (in addition).
The problem is that when I look at my Python code it looks like someone tried to hammer Java code into a python format , and it comes out crappy because - well , python ain't Java.
Any tips on how to escape th... | Programming in Python vs. programming in Java | 0 | 0 | 0 | 7,368 |
2,447,118 | 2010-03-15T12:45:00.000 | 0 | 0 | 1 | 0 | java,python | 2,495,445 | 13 | false | 1 | 0 | Eat Python, Sleep Python and Drink Python. That is the only way........ | 4 | 34 | 0 | I've been writing Java for the last couple of years , and now I've started to write in python (in addition).
The problem is that when I look at my Python code it looks like someone tried to hammer Java code into a python format , and it comes out crappy because - well , python ain't Java.
Any tips on how to escape th... | Programming in Python vs. programming in Java | 0 | 0 | 0 | 7,368 |
2,447,118 | 2010-03-15T12:45:00.000 | 3 | 0 | 1 | 0 | java,python | 2,448,287 | 13 | false | 1 | 0 | Definitely not a panacea but I think you should try some code golf in Python. Obviously nobody should write "golfed" code IRL, but finding the most terse way to express something really forces you to exploit the built in functionality of the language. | 4 | 34 | 0 | I've been writing Java for the last couple of years , and now I've started to write in python (in addition).
The problem is that when I look at my Python code it looks like someone tried to hammer Java code into a python format , and it comes out crappy because - well , python ain't Java.
Any tips on how to escape th... | Programming in Python vs. programming in Java | 0.046121 | 0 | 0 | 7,368 |
2,447,143 | 2010-03-15T12:48:00.000 | 19 | 0 | 1 | 0 | python,flush | 2,447,205 | 5 | false | 0 | 0 | NB: close() and flush() won't ensure that the data is actually secure on the disk. It just ensures that the OS has the data == that it isn't buffered inside the process.
You can try sync or fsync to get the data written to the disk. | 1 | 44 | 0 | In Python, and in general - does a close() operation on a file object imply a flush() operation? | does close() imply flush() in Python? | 1 | 0 | 0 | 16,987 |
2,448,035 | 2010-03-15T14:58:00.000 | 0 | 0 | 0 | 0 | python,django,pickle | 2,448,188 | 2 | false | 1 | 0 | You can overload the serialization methods. But it would be simpler to put the id and class in a tuple or dict and pickle that. | 2 | 4 | 0 | My app uses a "per-user session" to allow multiple sessions from the same user to share state. It operates very similarly to the django session by pickling objects.
I need to pickle a complex object that refers to django model objects. The standard pickling process stores a denormalized object in the pickle. So if t... | How to customize pickle for django model objects | 0 | 0 | 0 | 2,714 |
2,448,035 | 2010-03-15T14:58:00.000 | 1 | 0 | 0 | 0 | python,django,pickle | 2,448,369 | 2 | true | 1 | 0 | It's unclear what your goal is.
"But if I just store the id and class in a tuple then I'm necessarily going back to the database every time I use any of the django objects. I'd like to be able to keep the ones I'm using in memory over the course of a page request."
This doesn't make sense, since a view function is a pa... | 2 | 4 | 0 | My app uses a "per-user session" to allow multiple sessions from the same user to share state. It operates very similarly to the django session by pickling objects.
I need to pickle a complex object that refers to django model objects. The standard pickling process stores a denormalized object in the pickle. So if t... | How to customize pickle for django model objects | 1.2 | 0 | 0 | 2,714 |
2,448,984 | 2010-03-15T17:08:00.000 | 0 | 1 | 1 | 1 | python,linux,multithreading,mutex | 2,449,391 | 5 | false | 0 | 0 | Write code using immutable objects. Write objects that implement the Singleton Pattern.
Use a stable Distributed messaging technology such as IPC, webservices, or XML-RPC.
I would take a look at Twisted. They got plenty of solutions for such task.
I wouldn't use threads in Python esp with regards to the GIL, I would l... | 2 | 7 | 0 | Our server cluster consists of 20 machines, each with 10 pids of 5 threads. We'd like some way to prevent any two threads, in any pid, on any machine, from modifying the same object at the same time.
Our code's written in Python and runs on Linux, if that helps narrow things down.
Also, it's a pretty rare case that two... | What are some good ways to do intermachine locking? | 0 | 0 | 0 | 2,492 |
2,448,984 | 2010-03-15T17:08:00.000 | 1 | 1 | 1 | 1 | python,linux,multithreading,mutex | 2,466,954 | 5 | false | 0 | 0 | if you can get the complete infrastructure for a distributed lock manager then go ahead and use that. But that infrastructure is not easy to setup! But here is a practical solution:
-designate the node with the lowest ip address as the the master node
(that means if the node with lowest ip address hangs, a new node wi... | 2 | 7 | 0 | Our server cluster consists of 20 machines, each with 10 pids of 5 threads. We'd like some way to prevent any two threads, in any pid, on any machine, from modifying the same object at the same time.
Our code's written in Python and runs on Linux, if that helps narrow things down.
Also, it's a pretty rare case that two... | What are some good ways to do intermachine locking? | 0.039979 | 0 | 0 | 2,492 |
2,449,115 | 2010-03-15T17:28:00.000 | 0 | 0 | 0 | 0 | python,django,python-imaging-library | 2,449,251 | 1 | true | 1 | 0 | Ah, if i only open the orginal image once and create the thumbnail after resizing then the problem is solved | 1 | 0 | 0 | I have been using pil for the first time today. And I wanted to resize an image assuming it was larger than 800x600 and also create a thumbnail. I could do either of these tasks separately but not together in one method (I am doing a custom save method in django admin). This returns a "cannot identify image file" error... | Python Image Library, Close method | 1.2 | 0 | 0 | 773 |
2,451,682 | 2010-03-16T02:03:00.000 | 10 | 0 | 0 | 0 | python,eclipse,import | 2,452,084 | 8 | false | 0 | 0 | It sounds like MySQLdb is somewhere on your sys.path, but not on your Eclipse project's PYTHONPATH; in other words, Eclipse thinks you're going to get an import error at runtime because you haven't fully configured it. Google seems to say that you can alter this setting in Window->Preferences->Preferences->PyDev->Pytho... | 2 | 11 | 0 | When I write import MySQLdb in Eclipse using the PyDev plugin, I get an unresolved import. However, the program runs without error. I can add an annotation to get the error to go away, but what is the right way to handle this?
How can I help Eclipse know that MySQLdb is there? | How do I handle an UnresolvedImport Eclipse (Python) | 1 | 0 | 0 | 16,362 |
2,451,682 | 2010-03-16T02:03:00.000 | 10 | 0 | 0 | 0 | python,eclipse,import | 12,980,991 | 8 | false | 0 | 0 | cdleary above provided the reason two years ago, but this may be easier. Basically, one reinstalls the interpreter.
Select Window - > Preferences -> PyDev -> Interpreter - Python
Select the python interpreter in the upper pane
Click on Remove
Click on Auto Config
Agree to everything.
This works on Fedora 17 using the... | 2 | 11 | 0 | When I write import MySQLdb in Eclipse using the PyDev plugin, I get an unresolved import. However, the program runs without error. I can add an annotation to get the error to go away, but what is the right way to handle this?
How can I help Eclipse know that MySQLdb is there? | How do I handle an UnresolvedImport Eclipse (Python) | 1 | 0 | 0 | 16,362 |
2,452,488 | 2010-03-16T06:24:00.000 | 3 | 0 | 1 | 1 | python,security,filesystems,sandbox | 2,452,503 | 3 | false | 0 | 0 | You are probably best to use a virtual machine like VirtualBox or VMware (perhaps even creating one per user/session).
That will allow you some control over other resources such as memory and network as well as disk
The only python that I know of that has such features built in is the one on Google App Engine. That m... | 1 | 4 | 0 | I have a web service to which users upload python scripts that are run on a server. Those scripts process files that are on the server and I want them to be able to see only a certain hierarchy of the server's filesystem (best: a temporary folder on which I copy the files I want processed and the scripts).
The server w... | faking a filesystem / virtual filesystem | 0.197375 | 0 | 0 | 1,877 |
2,454,494 | 2010-03-16T13:06:00.000 | 0 | 0 | 0 | 0 | python,header,urllib2,setcookie | 39,896,162 | 3 | false | 0 | 0 | set-cookie is different though. From RFC 6265:
Origin servers SHOULD NOT fold multiple Set-Cookie header fields into
a single header field. The usual mechanism for folding HTTP headers
fields (i.e., as defined in [RFC2616]) might change the semantics of
the Set-Cookie header field because the %x2C (","... | 1 | 3 | 0 | I am using urllib2 to interact with a website that sends back multiple Set-Cookie headers. However the response header dictionary only contains one - seems the duplicate keys are overriding each other.
Is there a way to access duplicate headers with urllib2? | urllib2 multiple Set-Cookie headers in response | 0 | 0 | 1 | 3,778 |
2,454,576 | 2010-03-16T13:19:00.000 | 5 | 1 | 1 | 0 | python,import,global-variables,module | 2,454,624 | 2 | false | 0 | 0 | When you import a module B (like import B), every line in B will be interpreted. I assume this is what you mean when you say you want to run it. To reference members in B's namespace, you can get them like:
B.something_defined_in_B.
If you wish to use sys explicitly in C, you will need to import it within C as well. | 1 | 0 | 0 | I have a module "B", I want to run it from a script "C", and I want to call global variables in "B", as they were in the "C" root. Another problem is if I imported sys in "B" when I run "C" it doesn't see sys
# NameError: global name 'sys' is not defined #
What shall I do? | How do you run python scripts from other script and have their root in my root? | 0.462117 | 0 | 0 | 4,158 |
2,455,018 | 2010-03-16T14:13:00.000 | 0 | 0 | 0 | 0 | python,django,panel,admin | 2,455,815 | 3 | false | 1 | 0 | The automatically generated administration area created by Django is for data maintenance.
It provides forms to edit data in your models.
If it doesn't "handle this feature", then it sounds like your "configuration panel" (configuration panel should let me choose some basic options like highlighting some news, setting ... | 1 | 2 | 0 | I would like to create a configuration panel for the homepage of the web-app I'm designing with Django.
This configuration panel should let me choose some basic options like highlighting some news, setting a showcase banner, and so on.
Basically I don't need an app with different rows, but just a panel page with some c... | How to create a custom admin configuration panel in Django? | 0 | 0 | 0 | 4,970 |
2,455,062 | 2010-03-16T14:20:00.000 | 19 | 1 | 1 | 0 | python,emacs,spell-checking,docstring | 2,455,436 | 1 | true | 0 | 0 | I recommend you to try flyspell-mode. You could use something like:
(add-hook 'python-mode-hook 'flyspell-prog-mode)
in your Emacs configuration. | 1 | 11 | 0 | I'd like to run a spell checker on the docstrings of my Python code, if possible from within emacs.
I've found the ispell-check-comments setting which can be used to spell check only comments in code, but I was not able to target only the docstrings which are a fairly python-specific thing. | How to spell check python docstring with emacs? | 1.2 | 0 | 0 | 1,226 |
2,456,226 | 2010-03-16T16:35:00.000 | 1 | 1 | 1 | 0 | python,unit-testing,automation | 2,456,703 | 2 | true | 0 | 0 | I do this type of thing for testing Unix user creation and home directory copies. The Zip suggestion is a good one.
I personally keep two directory structures -- one is a source and one becomes the test structure. I just sync the source to the destination via shutil.copytree as part of the test setup.
That makes i... | 1 | 2 | 0 | I'm looking for a way to create a tree of test files to unit test a packaging tool. Basically, I want to create some common file system structures -- directories, nested directories, symlinks within the selected tree, symlinks outside the tree, &c.
Ideally I want to do this with as little boilerplate as possible. Of co... | Using Python, what's the best way to create a set of files on disk for testing? | 1.2 | 0 | 0 | 149 |
2,456,926 | 2010-03-16T18:11:00.000 | 0 | 0 | 0 | 0 | python,pylons | 2,457,303 | 1 | false | 1 | 1 | I'm assuming that "I can only get the first value" means you've got a series of checkboxes with the same value for the 'name' attribute within your form?
Now, if that's the case and you're wanting a list of boolean values based on whether or not the boxes are checked or not, you'll need to do two things:
First, whe... | 1 | 1 | 0 | I have been trying to add some check boxes in a pylons mako. However I don't know how to get their values in the controller. It seems that it can only get the first value of the check boxes. I tried using form encode but i got several errors. Is there an easier way to do this?
Thanks | Checkboxes with pylons | 0 | 0 | 0 | 1,306 |
2,457,367 | 2010-03-16T19:16:00.000 | 3 | 0 | 1 | 0 | python,memory,performance,substring | 2,457,480 | 4 | false | 0 | 0 | As with most garbage collected languages, strings are created as often as needed, which is very often. The reason for this is because tracking substrings as described would make garbage collection more difficult.
What is the actual algorithm you are trying to implement. It might be possible to give you advice for way... | 3 | 4 | 0 | I've got the entire contents of a text file (at least a few KB) in string myStr.
Will the following code create a copy of the string (less the first character) in memory?
myStr = myStr[1:]
I'm hoping it just refers to a different location in the same internal buffer. If not, is there a more efficient way to do this?
Th... | How efficient is Python substring extraction? | 0.148885 | 0 | 0 | 2,172 |
2,457,367 | 2010-03-16T19:16:00.000 | 4 | 0 | 1 | 0 | python,memory,performance,substring | 2,457,449 | 4 | true | 0 | 0 | At least in 2.6, slices of strings are always new allocations; string_slice() calls PyString_FromStringAndSize(). It doesn't reuse memory--which is a little odd, since with invariant strings, it should be a relatively easy thing to do.
Short of the buffer API (which you probably don't want), there isn't a more efficie... | 3 | 4 | 0 | I've got the entire contents of a text file (at least a few KB) in string myStr.
Will the following code create a copy of the string (less the first character) in memory?
myStr = myStr[1:]
I'm hoping it just refers to a different location in the same internal buffer. If not, is there a more efficient way to do this?
Th... | How efficient is Python substring extraction? | 1.2 | 0 | 0 | 2,172 |
2,457,367 | 2010-03-16T19:16:00.000 | 1 | 0 | 1 | 0 | python,memory,performance,substring | 2,458,894 | 4 | false | 0 | 0 | Depending on what you are doing, itertools.islice may be a suitable memory-efficient solution (should one become necessary). | 3 | 4 | 0 | I've got the entire contents of a text file (at least a few KB) in string myStr.
Will the following code create a copy of the string (less the first character) in memory?
myStr = myStr[1:]
I'm hoping it just refers to a different location in the same internal buffer. If not, is there a more efficient way to do this?
Th... | How efficient is Python substring extraction? | 0.049958 | 0 | 0 | 2,172 |
2,458,296 | 2010-03-16T21:28:00.000 | 1 | 0 | 0 | 1 | python | 2,458,335 | 5 | false | 0 | 0 | If you're worried about writes, you can have a set of servers that dispatch the tasks (may be stripe the servers to equalize load) and have each server write bulk checkpoints to the DB (this way, you will not have so many write queries). You still have to write to be able to recover if scheduling server dies, of course... | 2 | 17 | 0 | We have hundreds of thousands of tasks that need to be run at a variety of arbitrary intervals, some every hour, some every day, and so on. The tasks are resource intensive and need to be distributed across many machines.
Right now tasks are stored in a database with an "execute at this time" timestamp. To find tasks t... | How to schedule hundreds of thousands of tasks? | 0.039979 | 0 | 0 | 2,429 |
2,458,296 | 2010-03-16T21:28:00.000 | 1 | 0 | 0 | 1 | python | 2,459,571 | 5 | false | 0 | 0 | 350,000 tasks * 48 times per day is
16,800,000 tasks executed per day.
To schedule the jobs, you don't need a database.
Databases are for things that are updated. The only update visible here is a change to the schedule to add, remove or reschedule a job.
Cron does this in a totally scalable fashion with a single f... | 2 | 17 | 0 | We have hundreds of thousands of tasks that need to be run at a variety of arbitrary intervals, some every hour, some every day, and so on. The tasks are resource intensive and need to be distributed across many machines.
Right now tasks are stored in a database with an "execute at this time" timestamp. To find tasks t... | How to schedule hundreds of thousands of tasks? | 0.039979 | 0 | 0 | 2,429 |
2,458,355 | 2010-03-16T21:39:00.000 | 6 | 0 | 0 | 0 | python,django,web-applications | 2,458,468 | 2 | false | 1 | 0 | In Django, I'd suggest having a property on the User (or Profile) model that calculates a user's reputation on-demand. Then, cache the reputation with your caching framework and/or store to the database for fast retrieval.
This way, in addition to having the records of what impacts reputation, you can change your repu... | 2 | 8 | 0 | I'm thinking of adding a reputation system to my Django web application; the site is already being used so I'm trying to be careful about my choices.
Reputation is generated in all actions that contribute to the site, similar to Stackoverflow's system.
I know there are literally millions of ways of implementing this, a... | Giving users a "reputation system" - Should I...? | 1 | 0 | 0 | 550 |
2,458,355 | 2010-03-16T21:39:00.000 | 4 | 0 | 0 | 0 | python,django,web-applications | 2,458,375 | 2 | false | 1 | 0 | keep track of the reasons, IMHO. It surely wouldn't be that complex, and you don't need to store a huge amount of information, just a datetime, point value, command, target, and originator. If the data gets to be too much after some time dump the DB to a backup medium and clear the history. | 2 | 8 | 0 | I'm thinking of adding a reputation system to my Django web application; the site is already being used so I'm trying to be careful about my choices.
Reputation is generated in all actions that contribute to the site, similar to Stackoverflow's system.
I know there are literally millions of ways of implementing this, a... | Giving users a "reputation system" - Should I...? | 0.379949 | 0 | 0 | 550 |
2,458,624 | 2010-03-16T22:30:00.000 | 2 | 0 | 0 | 1 | python,linux,file-io,flush | 2,458,697 | 3 | true | 0 | 0 | It's somewhat filesystem dependent, but in some filesystems, if you delete a file before (all of) it is allocated, the IO to write the blocks will never happen. This might also be true if you truncate it so that the part which is still being written is chopped off.
Not sure that you can really abort a write if you want... | 2 | 3 | 0 | Is there a way to abort a python write operation in such a way that the OS doesn't feel it's necessary to flush the unwritten data to the disc?
I'm writing data to a USB device, typically many megabytes. I'm using 4096 bytes as my block size on the write, but it appears that Linux caches up a bunch of data early on, an... | Abort a slow flush to disk after write? | 1.2 | 0 | 0 | 683 |
2,458,624 | 2010-03-16T22:30:00.000 | 1 | 0 | 0 | 1 | python,linux,file-io,flush | 2,458,871 | 3 | false | 0 | 0 | When you abort the write operation, trying doing file.truncate(0); before closing it. | 2 | 3 | 0 | Is there a way to abort a python write operation in such a way that the OS doesn't feel it's necessary to flush the unwritten data to the disc?
I'm writing data to a USB device, typically many megabytes. I'm using 4096 bytes as my block size on the write, but it appears that Linux caches up a bunch of data early on, an... | Abort a slow flush to disk after write? | 0.066568 | 0 | 0 | 683 |
2,459,300 | 2010-03-17T01:13:00.000 | 11 | 0 | 1 | 0 | python,import | 2,459,384 | 4 | true | 0 | 0 | Best practice is to import every module that defines identifiers you need, and use those identifiers as qualified by the module's name; I recommend using from only when what you're importing is a module from within a package. The question has often been discussed on SO.
Importing a module, say moda, from many modules ... | 4 | 3 | 0 | I have a file, myfile.py, which imports Class1 from file.py and file.py contains imports to different classes in file2.py, file3.py, file4.py.
In my myfile.py, can I access these classes or do I need to again import file2.py, file3.py, etc.?
Does Python automatically add all the imports included in the file I imported,... | Python importing | 1.2 | 0 | 0 | 15,516 |
2,459,300 | 2010-03-17T01:13:00.000 | 1 | 0 | 1 | 0 | python,import | 2,459,311 | 4 | false | 0 | 0 | Python doesn't automatically introduce anything into the namespace of myfile.py, but you can access everything that is in the namespaces of all the other modules.
That is to say, if in file1.py you did from file2 import SomeClass and in myfile.py you did import file1, then you can access it within myfile as file1.Some... | 4 | 3 | 0 | I have a file, myfile.py, which imports Class1 from file.py and file.py contains imports to different classes in file2.py, file3.py, file4.py.
In my myfile.py, can I access these classes or do I need to again import file2.py, file3.py, etc.?
Does Python automatically add all the imports included in the file I imported,... | Python importing | 0.049958 | 0 | 0 | 15,516 |
2,459,300 | 2010-03-17T01:13:00.000 | 0 | 0 | 1 | 0 | python,import | 2,459,322 | 4 | false | 0 | 0 | In the myfile module, you can either do from file import ClassFromFile2 or from file2 import ClassFromFile2 to access ClassFromFile2, assuming that the class is also imported in file.
This technique is often used to simplify the API a bit. For example, a db.py module might import various things from the modules mysqldb... | 4 | 3 | 0 | I have a file, myfile.py, which imports Class1 from file.py and file.py contains imports to different classes in file2.py, file3.py, file4.py.
In my myfile.py, can I access these classes or do I need to again import file2.py, file3.py, etc.?
Does Python automatically add all the imports included in the file I imported,... | Python importing | 0 | 0 | 0 | 15,516 |
2,459,300 | 2010-03-17T01:13:00.000 | 0 | 0 | 1 | 0 | python,import | 2,459,332 | 4 | false | 0 | 0 | If you are using wildcard import, yes, wildcard import actually is the way of creating new aliases in your current namespace for contents of the imported module. If not, you need to use the namespace of the module you have imported as usual. | 4 | 3 | 0 | I have a file, myfile.py, which imports Class1 from file.py and file.py contains imports to different classes in file2.py, file3.py, file4.py.
In my myfile.py, can I access these classes or do I need to again import file2.py, file3.py, etc.?
Does Python automatically add all the imports included in the file I imported,... | Python importing | 0 | 0 | 0 | 15,516 |
2,459,549 | 2010-03-17T02:26:00.000 | 1 | 0 | 0 | 0 | python,zope,web2py,zodb,grok | 9,985,357 | 3 | false | 1 | 0 | Zope and the ZODB have been used with big applications, but I'd still consider linking Zope with MySQL or something like that for serious large-scale applications. Even though Zope has had a lot of development cycles, it is usually used with another database engine for good reason. As far as I know, the argument appl... | 2 | 3 | 0 | I am planning to make some big project (1 000 000 users, approximately 500 request pre second - in hot time).
For performance I'm going to use no relational dbms (each request could cost lot of instructions in relational dbms like mysql) - so i can't use DAL.
My question is:
how web2py is working with a big traffic, i... | web2py or grok (zope) on a big portal, | 0.066568 | 1 | 0 | 1,388 |
2,459,549 | 2010-03-17T02:26:00.000 | 7 | 0 | 0 | 0 | python,zope,web2py,zodb,grok | 2,459,620 | 3 | false | 1 | 0 | First, don't assume that a data abstraction layer will have unacceptable performance, until you actually see it in practice. It is pretty easy to switch to RAW sql if and when you run into a problem.
Second, most users who worry about there server technology handling a million users never finish their applications. P... | 2 | 3 | 0 | I am planning to make some big project (1 000 000 users, approximately 500 request pre second - in hot time).
For performance I'm going to use no relational dbms (each request could cost lot of instructions in relational dbms like mysql) - so i can't use DAL.
My question is:
how web2py is working with a big traffic, i... | web2py or grok (zope) on a big portal, | 1 | 1 | 0 | 1,388 |
2,459,636 | 2010-03-17T02:54:00.000 | 0 | 1 | 1 | 0 | python-3.x,relative-path | 5,054,020 | 1 | false | 0 | 0 | You are trying to run the test files directly, then you can't have relative imports. Change them to be absolute imports, and it will solve the problem. | 1 | 0 | 0 | I am currently working with converting Pycrypto over to Python 3.X
Whilst I seem to have the cryptography side working the same cannot be said for the tests
provided with the module :(
I have used the tests under Python 2.64 and all works fine.
I then ran '2to3' over the tests to generate new files in 3.X format.
There... | Python 3 relative path conversion issue | 0 | 0 | 0 | 215 |
2,459,739 | 2010-03-17T03:29:00.000 | 1 | 0 | 0 | 0 | python,cluster-analysis | 2,460,285 | 4 | false | 0 | 0 | Yeah I think there isn't a good implementation to what I need.
I have some crazy requirements, like distance caching etc.
So i think i will just write my own lib and release it as GPLv3 soon. | 1 | 9 | 1 | I am interested to perform kmeans clustering on a list of words with the distance measure being Leveshtein.
1) I know there are a lot of frameworks out there, including scipy and orange that has a kmeans implementation. However they all require some sort of vector as the data which doesn't really fit me.
2) I need a g... | Python KMeans clustering words | 0.049958 | 0 | 0 | 1,947 |
2,460,177 | 2010-03-17T06:02:00.000 | 9 | 0 | 1 | 0 | python,algorithm,edit,distance | 24,172,422 | 10 | false | 0 | 0 | Here is my version for Levenshtein distance
def edit_distance(s1, s2):
m=len(s1)+1
n=len(s2)+1
tbl = {}
for i in range(m): tbl[i,0]=i
for j in range(n): tbl[0,j]=j
for i in range(1, m):
for j in range(1, n):
cost = 0 if s1[i-1] == s2[j-1] else 1
tbl[i,j] = min(t... | 1 | 57 | 0 | I'm programming a spellcheck program in Python. I have a list of valid words (the dictionary) and I need to output a list of words from this dictionary that have an edit distance of 2 from a given invalid word.
I know I need to start by generating a list with an edit distance of one from the invalid word(and then run ... | Edit Distance in Python | 1 | 0 | 0 | 109,493 |
2,460,401 | 2010-03-17T07:04:00.000 | 2 | 0 | 1 | 0 | python,matplotlib,tkinter,break,python-idle | 31,151,803 | 4 | false | 0 | 0 | I had same issue in Canopy Python Editor, and I was able to interrupt python session with CTRL+. ("dot" button). Hope that helps, or they probably do things in a similar ways | 3 | 11 | 0 | I have a python script that uses plt.show() as it's last instruction. When it runs, IDLE just hangs after the last instruction. I get the image but I don't get the prompt back.
On other scripts I typically use ctrl-c to break the program (sometimes doesn't work immediately) but how do I get the prompt back with the plt... | How to stop Python program execution in IDLE | 0.099668 | 0 | 0 | 54,617 |
2,460,401 | 2010-03-17T07:04:00.000 | 7 | 0 | 1 | 0 | python,matplotlib,tkinter,break,python-idle | 2,460,438 | 4 | true | 0 | 0 | I have seen this problem with IDLE and matplotlib when using them on Windows. I don't know the exact cause, but Ctrl-c a couple times has typically worked for me. If that doesn't work for you, you can use the normal interpreter instead of write your plot directly to a file instead of the screen.
This is one of those (p... | 3 | 11 | 0 | I have a python script that uses plt.show() as it's last instruction. When it runs, IDLE just hangs after the last instruction. I get the image but I don't get the prompt back.
On other scripts I typically use ctrl-c to break the program (sometimes doesn't work immediately) but how do I get the prompt back with the plt... | How to stop Python program execution in IDLE | 1.2 | 0 | 0 | 54,617 |
2,460,401 | 2010-03-17T07:04:00.000 | 7 | 0 | 1 | 0 | python,matplotlib,tkinter,break,python-idle | 20,615,556 | 4 | false | 0 | 0 | Ctrl+F6
(Restart shell)
or Shell->Restart Shell | 3 | 11 | 0 | I have a python script that uses plt.show() as it's last instruction. When it runs, IDLE just hangs after the last instruction. I get the image but I don't get the prompt back.
On other scripts I typically use ctrl-c to break the program (sometimes doesn't work immediately) but how do I get the prompt back with the plt... | How to stop Python program execution in IDLE | 1 | 0 | 0 | 54,617 |
2,460,491 | 2010-03-17T07:28:00.000 | 1 | 0 | 0 | 0 | python,mysql,database,datetime,date | 2,460,546 | 3 | false | 0 | 0 | Solved.
I just did this:
datetime.datetime.now() ...insert that into the column. | 1 | 5 | 0 | I am using Python MySQLDB, and I want to insert this into DATETIME field in Mysql . How do I do that with cursor.execute? | In Python, if I have a unix timestamp, how do I insert that into a MySQL datetime field? | 0.066568 | 1 | 0 | 9,981 |
2,461,364 | 2010-03-17T10:15:00.000 | 3 | 0 | 0 | 0 | python,django,redirect,search-form | 2,461,426 | 1 | true | 1 | 0 | Search queries should probably be GETs, rather than POSTs, because they are not changing anything - they are simply passing parameters to get certain information. POST should be reserved for forms that actually change things in the database, or result in a specific action (eg submitting an email).
To reply to your comm... | 1 | 0 | 0 | After processing form from POST I should redirect, to prevent user from hitting back. However, I am using form to determine search query on a database, so I need to either pass params to the redirected site or the result of a search. Or maybe there is some other good practice, how to solve this problem? Maybe in this s... | django: search forms and redirect | 1.2 | 0 | 0 | 726 |
2,461,964 | 2010-03-17T11:59:00.000 | 2 | 1 | 0 | 0 | python,cgi,backgroundworker | 2,462,349 | 1 | false | 1 | 0 | well, short answer: you can't.
medium answer: CGI sucks.
long answer: CGI works by running your script and returning whatever your script prints to the browser. If your script is still running, the browser will be waiting. If your script launches a background job and returns data to the browser, then the background job... | 1 | 1 | 0 | I have a python CGI which runs some script in the background and shows the stdout in the html page. I run the script when the user clicks some button in the page.
My problem is when the script starts running the page becomes busy and the user can't use the other client side features in the page.
What I want is:
The scr... | Running a python script in background from a CGI | 0.379949 | 0 | 0 | 1,221 |
2,464,442 | 2010-03-17T17:32:00.000 | 0 | 1 | 0 | 0 | python,zope | 2,466,236 | 2 | true | 1 | 0 | Maybe you could create a new template including (use-macro) just the macros you want to access from python and then use z3c.pt.pagetemplate.PageTemplateFile() to render it?
Actually, it might be possible (and certainly easier) to use chameleon.zpt.template.PageTemplate('<div tal:use-macro="<your-macro-here>" />'), but ... | 2 | 1 | 0 | One of our page templates is made up of a bunch of macros. These items are a bunch of html tables.
Now, I want a couple of these tables in a Python script to create a PDF. Is there a way call a macro from a Python script and get back the HTML that is produced?
If so, can you explain?
Thanks
Eric | Call macro from Python script? | 1.2 | 0 | 0 | 334 |
2,464,442 | 2010-03-17T17:32:00.000 | 0 | 1 | 0 | 0 | python,zope | 2,464,507 | 2 | false | 1 | 0 | I'd probably use urllib.urlopen(url), pull the data from the page back to python and use BeautifulSoup to pull the table(s) out of the HTML... And then render that to PDF with XHTML2PDF (pisa.ho).
There might be a simpler way but for me, this would be the least stressful approach. | 2 | 1 | 0 | One of our page templates is made up of a bunch of macros. These items are a bunch of html tables.
Now, I want a couple of these tables in a Python script to create a PDF. Is there a way call a macro from a Python script and get back the HTML that is produced?
If so, can you explain?
Thanks
Eric | Call macro from Python script? | 0 | 0 | 0 | 334 |
2,464,568 | 2010-03-17T17:50:00.000 | 0 | 0 | 1 | 0 | python | 2,464,634 | 6 | false | 0 | 0 | Basically this method tells you if the first parameter is a subclass of the second. So naturally, both your parameters need to be classes. It appears from your call, that you have called issubclass without any parameters, which confuses the interpreter.
Calling issubclass is like asking the interpreter: "Hey! is this c... | 1 | 7 | 0 | I have zero idea as to why I'm getting this error. | Can someone explain what exactly this error means,TypeError: issubclass() arg 1 must be a class | 0 | 0 | 0 | 30,197 |
2,464,704 | 2010-03-17T18:09:00.000 | 1 | 0 | 1 | 1 | python,subprocess,watchdog | 2,464,752 | 2 | false | 0 | 0 | I've done this same thing to process web statistics using a semaphore. Essentially, as processes are created, the semaphore is incremented. When they exit, it's decremented. The creation process is blocked when the semaphore blocks.
This actually fires off threads, which run external processes down execution path a... | 1 | 2 | 0 | I need it to open 10 processes, and each time one of them finishes I want to wait few seconds and start another one.
It seems pretty simple, but somehow I can't get it to work. | How to implement a master/watchdog script in python? | 0.099668 | 0 | 0 | 1,275 |
2,465,056 | 2010-03-17T18:59:00.000 | 2 | 0 | 0 | 1 | python,google-app-engine,artificial-intelligence | 2,471,015 | 3 | false | 1 | 0 | If the game is turn based then it would probably be best to avoid the Cron task and just update the NPCs every time the player moves. I'm not sure how big of a map you are planning on but you may consider even having the player object find the NPCs that are close to it and call their AI routine. That way NPCs that are... | 3 | 1 | 0 | I am currently in the planning stages of a game for google app engine, but cannot wrap my head around how I am going to handle AI. I intend to have persistant NPCs that will move about the map, but short of writing a program that generates the same XML requests I use to control player actions, than run it on another s... | Artificial Intelligence in online game using Google App Engine | 0.132549 | 0 | 0 | 1,026 |
2,465,056 | 2010-03-17T18:59:00.000 | 2 | 0 | 0 | 1 | python,google-app-engine,artificial-intelligence | 2,471,126 | 3 | false | 1 | 0 | Bear in mind that you can also break up your updates into multiple requests (internally): do a bit of work, redirect to the same handler but different state; do more work; etc. (I'm failing somehow to comment on Peter Recore's answer, which is where this really belongs.)
I see that the free service only allows 100k ta... | 3 | 1 | 0 | I am currently in the planning stages of a game for google app engine, but cannot wrap my head around how I am going to handle AI. I intend to have persistant NPCs that will move about the map, but short of writing a program that generates the same XML requests I use to control player actions, than run it on another s... | Artificial Intelligence in online game using Google App Engine | 0.132549 | 0 | 0 | 1,026 |
2,465,056 | 2010-03-17T18:59:00.000 | 3 | 0 | 0 | 1 | python,google-app-engine,artificial-intelligence | 2,465,142 | 3 | true | 1 | 0 | Will your game be turn based or real time?
Either way, I think you have 2 options to look into. One is to use the Cron feature so you can schedule NPC updates at regular intervals, the other is to stick a "update NPCs" task into the Task Queue every time a human player moves. | 3 | 1 | 0 | I am currently in the planning stages of a game for google app engine, but cannot wrap my head around how I am going to handle AI. I intend to have persistant NPCs that will move about the map, but short of writing a program that generates the same XML requests I use to control player actions, than run it on another s... | Artificial Intelligence in online game using Google App Engine | 1.2 | 0 | 0 | 1,026 |
2,465,719 | 2010-03-17T20:40:00.000 | 0 | 0 | 1 | 0 | python,regex | 2,465,817 | 4 | false | 0 | 0 | Some regular expressions match a finite number of input strings, but many (most?) match an infinite number of input strings. It's kind of like asking 'given the python language grammar, generate all possible python programs'. You probably could write a program to list them all in sequence if you tried (though it would ... | 1 | 2 | 0 | I'm trying to use a regex as an input, and from there generate all the possible values that the regex would match.
So, for example, if the regex is "three-letter words starting with a, and ending in c," then the code would generate a list with the values [aac, abc, acc, adc, a1c....].
Is there an easy way to do this? I... | Generating a list of values a regex COULD match in Python | 0 | 0 | 0 | 2,614 |
2,467,609 | 2010-03-18T04:55:00.000 | -6 | 0 | 0 | 1 | python,linux | 2,467,717 | 6 | false | 0 | 0 | No reason to use python. Avoid writing a shell script in Python and go with something like bash or an equivalent. | 2 | 32 | 0 | How would I download files (video) with Python using wget and save them locally? There will be a bunch of files, so how do I know that one file is downloaded so as to automatically start downloding another one?
Thanks. | Using wget via Python | -1 | 0 | 1 | 92,663 |
2,467,609 | 2010-03-18T04:55:00.000 | 9 | 0 | 0 | 1 | python,linux | 2,467,646 | 6 | false | 0 | 0 | No reason to use os.system. Avoid writing a shell script in Python and go with something like urllib.urlretrieve or an equivalent.
Edit... to answer the second part of your question, you can set up a thread pool using the standard library Queue class. Since you're doing a lot of downloading, the GIL shouldn't be a pr... | 2 | 32 | 0 | How would I download files (video) with Python using wget and save them locally? There will be a bunch of files, so how do I know that one file is downloaded so as to automatically start downloding another one?
Thanks. | Using wget via Python | 1 | 0 | 1 | 92,663 |
2,467,807 | 2010-03-18T06:03:00.000 | 0 | 1 | 0 | 0 | c++,python,c | 2,468,907 | 3 | false | 1 | 0 | I don't think you should use a compiled language (at least not c++) for web programming. I thought about doing this once too but remember that for any change you'll have to compile etc.
Facebook uses php and it's hip hop application changes php into c++. Maybe you should take a look at that.
Of course c++ (or any compi... | 1 | 2 | 0 | Can C/C++ be choice of keeping all your logic (business/domain) for web application?
Why?
I've two resources (cousins) having knowledge on C/C++ and me also good in C/C++, Python, HTML, CSS and JavaScript.
We like to utilize our free time to work on our some good ideas we developed together. The ideas require knowledg... | C/C++ for Core Logic Development of a Web Application? | 0 | 0 | 0 | 390 |
2,469,031 | 2010-03-18T10:31:00.000 | 7 | 0 | 0 | 0 | python,random,open-source,mersenne-twister | 2,469,142 | 2 | false | 0 | 0 | Mersenne Twister is an implementation that is used by standard python library. You can see it in random.py file in your python distribution.
On my system (Ubuntu 9.10) it is in /usr/lib/python2.6, on Windows it should be in C:\Python26\Lib | 1 | 4 | 1 | Is there any good open-source implementation of Mersenne Twister and other good random number generators in Python available? I would like to use in for teaching math and comp sci majors? I am also looking for the corresponding theoretical support.
Edit: Source code of Mersenne Twister is readily available in various ... | Open-source implementation of Mersenne Twister in Python? | 1 | 0 | 0 | 5,857 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.