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
1,236,285
2009-08-05T23:34:00.000
46
0
0
0
python,django,debugging,testing,stdout
1,239,545
5
true
1
0
Checked TEST_RUNNER in settings.py, it's using a project-specific runner that calls out to Nose. Nose has the -s option to stop it from capturing stdout, but if I run: ./manage.py test -s manage.py captures it first and throws a "no such option" error. The help for manage.py doesn't mention this, but I found that if I ...
2
54
0
When I run tests with ./manage.py test, whatever I send to the standard output through print doesn't show. When tests fail, I see an "stdout" block per failed test, so I guess Django traps it (but doesn't show it when tests pass).
How do I see stdout when running Django tests?
1.2
0
0
33,876
1,236,285
2009-08-05T23:34:00.000
4
0
0
0
python,django,debugging,testing,stdout
1,236,326
5
false
1
0
You probably have some intermediate test runner, such as Nose, intercepting and storing stdout. Try either running the Django tests directly, or write to stderr instead.
2
54
0
When I run tests with ./manage.py test, whatever I send to the standard output through print doesn't show. When tests fail, I see an "stdout" block per failed test, so I guess Django traps it (but doesn't show it when tests pass).
How do I see stdout when running Django tests?
0.158649
0
0
33,876
1,237,126
2009-08-06T05:32:00.000
0
0
0
1
python,google-app-engine,cron,scheduled-tasks
1,237,224
1
false
1
0
"fetch" your OWN url (on appspot.com probably, but, who cares -- use a relative url anywau1-), not google.com, the homepage of the search engine -- what's that got to do w/your app anyway?!-)...
1
0
0
I want to add a scheduled task to fetch a URL via cron job using google app engine. I am continuously getting a failure. I am just fetching www.google.com. Why is the url fetch failing? Am I missing something?
Cron job python Google App Engine
0
0
0
1,453
1,237,200
2009-08-06T06:08:00.000
1
0
1
0
.net,vba,com,vb6,ironpython
1,237,238
2
true
0
0
You need to generate a Runtime COM Wrapper assembly using the tlbimp tool, and add a reference to that; languages which support .net attributes can do the interoperation explicitly, but even there, autogenerating the wrapper is far simpler. Inspecting the wrapper assembly in ildasm will show exactly how the conversion ...
2
2
0
I'm currently developing what is more or less a script that needs to get some data from a VB 6 COM dll. This dll is currently used in a MS Word VBA project, and it exports classes, etc to the VBA code. It is added in the Tools -> References menu in the VBA editor, and I can see it's classes in the object browser of VBA...
How can I use a VB6 COM 'reference' in IronPython?
1.2
0
0
559
1,237,200
2009-08-06T06:08:00.000
0
0
1
0
.net,vba,com,vb6,ironpython
1,237,242
2
false
0
0
In any .NET language (in Visual Studio, not sure if IronPython has full language support there, or if it only runs on the CLR with .NET Framework?) you simply go to the Add Reference dialog, select the COM tab, select the library (much like in the VB6/VBA references dialog) and you're basically done. VisualStudio then ...
2
2
0
I'm currently developing what is more or less a script that needs to get some data from a VB 6 COM dll. This dll is currently used in a MS Word VBA project, and it exports classes, etc to the VBA code. It is added in the Tools -> References menu in the VBA editor, and I can see it's classes in the object browser of VBA...
How can I use a VB6 COM 'reference' in IronPython?
0
0
0
559
1,237,602
2009-08-06T08:26:00.000
-1
0
0
0
python,django,django-models
1,237,762
2
false
1
0
My initial instinct when reading this was that you need to overload the save method on the model, and use the os.rename() method, but that causes a lot of overhead, and is just generally a hassle from start to finish. If you simply want to rename the file, but don't want to make any physical changes to it (resizing, du...
1
8
0
I'm uploading images (represented by a FileField) and I need to rename those files when they are uploaded. I want them to be formated like that: "%d-%d-%s.%s" % (width, height, md5hash, original_extension) I've read the documentation but I don't know if I need to write my own FileSystemStorage class or my own FileField...
Choose the filename of an uploaded file with Django
-0.099668
0
0
7,557
1,238,606
2009-08-06T12:39:00.000
113
0
1
0
python,python-3.x
1,238,632
2
true
0
0
You don't need to inherit from object to have new style in python 3. All classes are new-style.
1
105
0
In older Python versions when you create a class, it can inherit from object which is as far I understand a special built-in Python element that allows your class to be a new-style class. What about newer versions (> 3.0 and 2.6)? I googled about the object class but I get so many results (for obvious reasons).
Is it necessary or useful to inherit from Python's object in Python 3.x?
1.2
0
0
24,895
1,241,148
2009-08-06T20:16:00.000
13
0
1
0
python,constructor,copy
1,241,241
8
false
0
0
For your situation, I would suggest writing a class method (or it could be a static method or a separate function) that takes as an argument an instance of the library's class and returns an instance of your class with all applicable attributes copied over.
1
111
0
Is there a copy constructor in python ? If not what would I do to achieve something similar ? The situation is that I am using a library and I have extended one of the classes there with extra functionality and I want to be able to convert the objects I get from the library to instances of my own class.
Copy constructor in python?
1
0
0
81,359
1,241,758
2009-08-06T21:58:00.000
0
0
0
0
python,database,database-design,file-io
1,241,784
4
false
0
0
Are you likely to need all rows in order or will you want only specific known rows? If you need to read all the data there isn't much advantage to having it in a database. edit: If the code fits in memory then a simple CSV is fine. Plain text data formats are always easier to deal with than opaque ones if you can use t...
3
0
1
I'm developing an app that handle sets of financial series data (input as csv or open document), one set could be say 10's x 1000's up to double precision numbers (Simplifying, but thats what matters). I plan to do operations on that data (eg. sum, difference, averages etc.) as well including generation of say another ...
Store data series in file or database if I want to do row level math operations?
0
1
0
581
1,241,758
2009-08-06T21:58:00.000
0
0
0
0
python,database,database-design,file-io
1,241,787
4
false
0
0
What matters most if all data will fit simultaneously into memory. From the size that you give, it seems that this is easily the case (a few megabytes at worst). If so, I would discourage using a relational database, and do all operations directly in Python. Depending on what other processing you need, I would probably...
3
0
1
I'm developing an app that handle sets of financial series data (input as csv or open document), one set could be say 10's x 1000's up to double precision numbers (Simplifying, but thats what matters). I plan to do operations on that data (eg. sum, difference, averages etc.) as well including generation of say another ...
Store data series in file or database if I want to do row level math operations?
0
1
0
581
1,241,758
2009-08-06T21:58:00.000
2
0
0
0
python,database,database-design,file-io
1,245,169
4
true
0
0
"I plan to do operations on that data (eg. sum, difference, averages etc.) as well including generation of say another column based on computations on the input." This is the standard use case for a data warehouse star-schema design. Buy Kimball's The Data Warehouse Toolkit. Read (and understand) the star schema befo...
3
0
1
I'm developing an app that handle sets of financial series data (input as csv or open document), one set could be say 10's x 1000's up to double precision numbers (Simplifying, but thats what matters). I plan to do operations on that data (eg. sum, difference, averages etc.) as well including generation of say another ...
Store data series in file or database if I want to do row level math operations?
1.2
1
0
581
1,241,797
2009-08-06T22:07:00.000
8
1
1
0
python,benchmarking,fft
1,241,961
3
false
0
0
I would recommend numpy library, I not sure if it's the fastest implementation that exist but but surely it's one of best scientific module on the "market".
1
5
0
Taking speed as an issue it may be better to choose another language, but what is your library/module/implementation of choice for doing a 1D fast Fourier transform (FFT) in Python?
What is the recommended Python module for fast Fourier transforms (FFT)?
1
0
0
2,655
1,241,813
2009-08-06T22:11:00.000
14
0
0
0
python,django,binary
1,248,531
3
false
1
0
Oh, again that old one... Simply stated, you can't deploy an application in a non-compiled language (Python, Perl, PHP, Ruby...) in a source-safe way - all existing tricks are extremely easy to circumvent. Anyway, that doesn't matter at all: the contract you have with your customer does. Even for Java there are neat d...
2
14
0
is there possible only to deploy binary version of web application based on django , no source code publish? Thanks
django binary (no source code) deployment
1
0
0
7,256
1,241,813
2009-08-06T22:11:00.000
3
0
0
0
python,django,binary
1,248,511
3
false
1
0
No, there isn't a reliable to do this at the moment. Even compiled code like referenced in the answer above this one isn't 100% secure. My advice: clean open code for your clients and a good relation with them is the only way to go. Keeping your code hidden can be good from a business point of view but from a client re...
2
14
0
is there possible only to deploy binary version of web application based on django , no source code publish? Thanks
django binary (no source code) deployment
0.197375
0
0
7,256
1,242,541
2009-08-07T02:03:00.000
2
0
0
0
python,gtk,colors,pygtk
1,242,550
1
true
0
1
If you're running on a system that uses a palette display (as opposed to a true-colour display), then you must allocate new colours in the palette before you can use them. This is because palette-based displays can only display a limited number of colours at once (usually 256 or sometimes 65536). Most displays these da...
1
1
0
Various examples always use alloc_color() and stuff like gtk.color.parse('red'), etc. I just do gtk.gdk.Color(65535,0,0), and that seems to work. What's the need for alloc_color?
What's the point of alloc_color() in gtk?
1.2
0
0
236
1,244,784
2009-08-07T13:46:00.000
0
0
1
0
python,setuptools
1,245,527
4
false
0
0
If you are packaging something to be installed on Debian (as implied), the best way to manage dependencies is to package your program as a .deb and express the dependencies the Debian way. (Note, PIL is available in Debian as python-imaging.)
3
0
0
For instance, what if PIL, python-rsvg and libev3 are dependencies of the program? These dependencies are not in pypi index, the latter two are Debian package names.
How to write a setup.py for a program that depends on packages outside pypi
0
0
0
1,505
1,244,784
2009-08-07T13:46:00.000
2
0
1
0
python,setuptools
1,244,867
4
true
0
0
Simply don't put them in your dependencies and document that in your INSTALL or README.
3
0
0
For instance, what if PIL, python-rsvg and libev3 are dependencies of the program? These dependencies are not in pypi index, the latter two are Debian package names.
How to write a setup.py for a program that depends on packages outside pypi
1.2
0
0
1,505
1,244,784
2009-08-07T13:46:00.000
0
0
1
0
python,setuptools
1,246,840
4
false
0
0
Since the setup.py is Python code too, you just can download and run the setup.py on those packages.
3
0
0
For instance, what if PIL, python-rsvg and libev3 are dependencies of the program? These dependencies are not in pypi index, the latter two are Debian package names.
How to write a setup.py for a program that depends on packages outside pypi
0
0
0
1,505
1,244,897
2009-08-07T14:06:00.000
-7
0
1
1
python,windows,linux,console,ncurses
1,244,980
5
false
0
0
develop two interfaces for your program, a text console ui and a graphical ui. Make the console one work only on linux. Nobody on windows uses text console apps.
1
24
0
I'm looking into developing a console application in python which should be able to run under Windows as well as Linux. For this, I'd really like to use a high-level console library like curses. However, as far as I know, curses is not available on Windows. What other options do I have? Unfortunately, using cygwin unde...
curses-like library for cross-platform console app in python
-1
0
0
13,292
1,245,818
2009-08-07T16:48:00.000
3
1
0
1
python
1,245,828
4
false
0
0
Rename it to *.pyw to hide the console on execution in Windows.
1
2
0
I have a python script which I can run from pythonwin on which I give the arguments. Is it possible to automate this so that when I just click on the *.py file, I don't see the script and it asks for the path in a dos window?
Run Python script without opening Pythonwin
0.148885
0
0
6,240
1,245,907
2009-08-07T17:08:00.000
2
0
1
0
python,readline
1,245,925
3
true
0
0
I don't know of any existing code for the task, but if I were to do this I'd catch the exception, try adding a fake trailing quote, and see how shlex.split does with the string thus modified.
1
1
0
I've written a simple shell-like program that uses readline in order to provide smart completion of arguments. I would like the mechanism to support arguments that have spaces and are quoted to signify as one argument (as with providing the shell with such). I've seen that shlex.split() knows how to parse quoted argum...
Handling lines with quotes using python's readline
1.2
0
0
954
1,246,131
2009-08-07T17:51:00.000
2
0
0
0
python,audio,compression
1,334,217
6
false
1
0
You may use ctypes module to call functions directly from dynamic libraries. It doesn't require you to install external Python libs and it has better performance than command line tools, but it's usually harder to implement (plus of course you need to provide external library).
2
21
0
I'm trying to find a Python library that would take an audio file (e.g. .ogg, .wav) and convert it into mp3 for playback on a webpage. Also, any thoughts on setting its quality for playback would be great. Thank you.
Python library for converting files to MP3 and setting their quality
0.066568
0
1
51,200
1,246,131
2009-08-07T17:51:00.000
1
0
0
0
python,audio,compression
1,246,816
6
false
1
0
Another option to avoid installing Python modules for this simple task would be to just exec "lame" or other command line encoder from the Python script (with the popen module.)
2
21
0
I'm trying to find a Python library that would take an audio file (e.g. .ogg, .wav) and convert it into mp3 for playback on a webpage. Also, any thoughts on setting its quality for playback would be great. Thank you.
Python library for converting files to MP3 and setting their quality
0.033321
0
1
51,200
1,246,235
2009-08-07T18:12:00.000
-1
0
0
1
python,arm,embedded
4,729,963
2
false
0
0
I suggest using SQLite. I have an application running Python+SQLite for telemetry purposes and it works like a charm. It's much easier than MySQL.
1
0
0
I have an application where a small embedded ARM9 device (running Linux) must gather information from sensors and then connect to a remote mySQL database and INSERT the data. I have Python 2.5 running on the ARM9 device fine. I have developed a prototype application in Python 2.5 running on x86 Windows and it connects ...
Python/mySQL on an Embedded ARM9 Device?
-0.099668
0
0
1,766
1,246,552
2009-08-07T19:27:00.000
1
0
0
0
python,windows,gtk,pygtk
1,247,303
3
false
0
1
Gtk provides function gtk_status_icon_position_menu that can be passed into gtk_menu_popup as a GtkPositionFunc. This seems to provide the requested functionality.
2
4
0
I am assisting with Windows support for a PyGTK app that appears as a system tray applet, but am not so strong on the GTK+ gooey stuff... We have it so when you left-click the systray icon, the window appears right by your tray icon no matter where your system tray is--and on Linux this works great, using the results o...
Getting the position of the gtk.StatusIcon on Windows
0.066568
0
0
1,237
1,246,552
2009-08-07T19:27:00.000
0
0
0
0
python,windows,gtk,pygtk
1,874,016
3
false
0
1
The behavior i experienced in windows with gtk_status_icon_position_menu was that it spawns the window at the location the user clicked in the statusicon
2
4
0
I am assisting with Windows support for a PyGTK app that appears as a system tray applet, but am not so strong on the GTK+ gooey stuff... We have it so when you left-click the systray icon, the window appears right by your tray icon no matter where your system tray is--and on Linux this works great, using the results o...
Getting the position of the gtk.StatusIcon on Windows
0
0
0
1,237
1,247,486
2009-08-07T23:43:00.000
16
0
1
0
python,list-comprehension,map-function
1,247,531
14
false
0
0
I find list comprehensions are generally more expressive of what I'm trying to do than map - they both get it done, but the former saves the mental load of trying to understand what could be a complex lambda expression. There's also an interview out there somewhere (I can't find it offhand) where Guido lists lambdas an...
2
878
0
Is there a reason to prefer using map() over list comprehension or vice versa? Is either of them generally more efficient or considered generally more pythonic than the other?
List comprehension vs map
1
0
0
283,077
1,247,486
2009-08-07T23:43:00.000
19
0
1
0
python,list-comprehension,map-function
24,108,573
14
false
0
0
If you plan on writing any asynchronous, parallel, or distributed code, you will probably prefer map over a list comprehension -- as most asynchronous, parallel, or distributed packages provide a map function to overload python's map. Then by passing the appropriate map function to the rest of your code, you may not h...
2
878
0
Is there a reason to prefer using map() over list comprehension or vice versa? Is either of them generally more efficient or considered generally more pythonic than the other?
List comprehension vs map
1
0
0
283,077
1,247,501
2009-08-07T23:47:00.000
0
0
0
0
python,django
1,247,506
4
false
1
0
Then I thought it might be a DNS issue, but the site loads instantly when served with Apache2. How are you serving your Django site? I presume you're running mod_python on Apache2? You may want to start by running an Apache2 locally on you computer (use MAMP or WAMP and install mod_python there) and seeing if it'...
3
2
0
I have a slowness problem with Django and I can't find the source .. I'm not sure what I'm doing wrong, but at least twice while working on projects Django became really slow. Requests takes age to complete (~15 seconds) and Validating model when starting the development server is also very slow (12+ seconds on a quad ...
django extreme slowness
0
0
0
3,386
1,247,501
2009-08-07T23:47:00.000
0
0
0
0
python,django
1,247,774
4
false
1
0
I've once used remote edit to develop my Django site. The validating process seem to be very slow too. But, everything else is fine not like yours. It's come from the webserver can't add/change .pyc in that directory.
3
2
0
I have a slowness problem with Django and I can't find the source .. I'm not sure what I'm doing wrong, but at least twice while working on projects Django became really slow. Requests takes age to complete (~15 seconds) and Validating model when starting the development server is also very slow (12+ seconds on a quad ...
django extreme slowness
0
0
0
3,386
1,247,501
2009-08-07T23:47:00.000
0
0
0
0
python,django
1,248,504
4
false
1
0
If the validating models takes forever don't search for anything else. On a dual core some of my largest enterprise applications (+30 models) take less then a second to validate. The problem must lie somewhere with your models but without source code it's hard to tell what the problem is. Kind regards, Michael Open Sou...
3
2
0
I have a slowness problem with Django and I can't find the source .. I'm not sure what I'm doing wrong, but at least twice while working on projects Django became really slow. Requests takes age to complete (~15 seconds) and Validating model when starting the development server is also very slow (12+ seconds on a quad ...
django extreme slowness
0
0
0
3,386
1,247,921
2009-08-08T03:51:00.000
1
0
0
0
python,graphics,sprite,pygame
1,247,984
4
false
0
1
you might consider switching to using png images where you can do any kind of transparency you want directly in the image.
1
4
0
I've just started working with pygame and I'm trying to make a semi-transparent sprite, and the sprite's source file is a non-transparent bitmap file loaded from the disk. I don't want to edit the source image if I can help it. I'm sure there's a way to do this with pygame code, but Google is of no help to me.
How to make translucent sprites in pygame
0.049958
0
0
7,546
1,250,086
2009-08-08T22:57:00.000
1
0
0
1
java,python,audio,mp3
5,060,666
4
false
1
0
One (somehow pretentious) idea: record a mute (silent) mp3 in bitrate that your mp3 is. Then, copy all the frames from original mp3 up to the point when you want your silence to start. Then, copy as much muted frames you need from your 'silence file'. Then, copy the rest from the original file. You'll have muted fi...
1
5
0
I'm trying to write a batch process that can take an MP3 file and mute certain parts of it, ideally in Python or Java. Take this example: Given a 2 minute MP3, I want to mute the time between 1:20 and 1:30. When saved back to a file, the rest of the MP3 will play normally -- only that portion will be silent. Any advice...
Manipulate MP3 programmatically: Muting certain parts?
0.049958
0
0
1,648
1,250,295
2009-08-09T01:02:00.000
1
0
1
0
python,ide
1,273,578
6
false
0
0
In contrast to the other answers i think that IDE's are very important especially for script languages. Almost all code is bad documentated and an IDE with a good debugger gives you much insides about what is really going on what datatypes are assigned to this values. Is this a hash of lists of hashes or a list of hash...
4
5
0
I'm a beginning Python programmer, just getting my feet wet in the language and its tools and native practices. In the past, I've used languages that were tightly integrated into IDEs, and indeed I had never before considered that it was even possible to program outside of such a tool. However, much of the documentatio...
What is the importance of an IDE when programming in Python?
0.033321
0
0
1,921
1,250,295
2009-08-09T01:02:00.000
0
0
1
0
python,ide
1,252,287
6
false
0
0
(1) IDEs are less important than for other languages, but if you find one that is useful, it still makes things easier. Without IDEs -- what are doing? Always running Python from command line? (2-3) On my Mac there's included IDLE which I keep always open for its Python shell (it's colored unlike the one in Terminal) a...
4
5
0
I'm a beginning Python programmer, just getting my feet wet in the language and its tools and native practices. In the past, I've used languages that were tightly integrated into IDEs, and indeed I had never before considered that it was even possible to program outside of such a tool. However, much of the documentatio...
What is the importance of an IDE when programming in Python?
0
0
0
1,921
1,250,295
2009-08-09T01:02:00.000
4
0
1
0
python,ide
1,250,429
6
false
0
0
A matter of habit and personal preferences. Me, I use vim (I have to admit emacs is at least as powerful, but my fingers are deeply trained by over 30 years of vi, and any other editor gives me the jitters, especially when it tries to imitate vi and never really manages to get it 100% right;-), occasionally an interact...
4
5
0
I'm a beginning Python programmer, just getting my feet wet in the language and its tools and native practices. In the past, I've used languages that were tightly integrated into IDEs, and indeed I had never before considered that it was even possible to program outside of such a tool. However, much of the documentatio...
What is the importance of an IDE when programming in Python?
0.132549
0
0
1,921
1,250,295
2009-08-09T01:02:00.000
3
0
1
0
python,ide
1,250,364
6
false
0
0
How important is an IDE to normal Python development? Not very, IMHO. It's a lightweight language with much less boilerplate and simpler idioms than in some other languages, so there's less need for an IDE for that part. The standard interactive interpreter provides help and introspection functionality and a reasonab...
4
5
0
I'm a beginning Python programmer, just getting my feet wet in the language and its tools and native practices. In the past, I've used languages that were tightly integrated into IDEs, and indeed I had never before considered that it was even possible to program outside of such a tool. However, much of the documentatio...
What is the importance of an IDE when programming in Python?
0.099668
0
0
1,921
1,250,437
2009-08-09T02:46:00.000
1
0
0
1
python,google-app-engine,model-view-controller,google-cloud-datastore
1,251,369
2
false
1
0
If you roll your own user model, you're going to need to do your own session handling as well; the App Engine Users API creates login sessions for you behind the scenes. Also, while this should be obvious, you shouldn't store the user's password in plaintext; store an SHA-1 hash and compare it to a hash of the user's...
1
4
0
How does one handle logging in and out/creating users, without using Google Users? I'd like a few more options then just email and password. Is it just a case of making a user model with the fields I need? Is that secure enough? Alternatively, is there a way to get the user to log in using the Google ID, but without be...
Creating alternative login to Google Users for Google app engine
0.099668
0
0
928
1,250,739
2009-08-09T05:31:00.000
1
0
0
0
python,twisted,pygame,pyro
1,255,178
3
false
0
0
I've nothing against Twisted and PyRo, but the sort of simple messages you're going to be sending don't require anything like that and might be overcomplicated by using some sort of framework. Pickling an object and sending it over a socket is actually a very easy operation and well worth trying, even if you do eventua...
1
3
0
I am making a simple multiplayer economic game in pygame. It consists of turns of a certain length, at the end of which, data is sent to the central server. A few quick calculations are done on the data and the results are sent back to the players. My question is how I should implement the network support. I was lookin...
Network Support for Pygame
0.066568
0
0
3,753
1,251,260
2009-08-09T12:04:00.000
3
0
1
1
python,windows,user-interface
1,251,275
3
false
0
0
I would recommend that you use IronPython, which is Microsoft's implementation of Python for the .NET framework.
1
1
0
What would be the optimal way to develop a basic graphical application for Windows based on a Python console script? It would be great if the solution could be distributed as a standalone directory, containing the .exe file.
Writing Windows GUI applications with embedded Python scripts
0.197375
0
0
1,987
1,252,357
2009-08-09T21:40:00.000
36
0
1
0
python
1,252,369
4
false
0
0
That's what "is" is for. Instead of testing "if a == b", which tests for the same value, test "if a is b", which will test for the same identifier.
2
94
0
This would be similar to the java.lang.Object.hashcode() method. I need to store objects I have no control over in a set, and make sure that only if two objects are actually the same object (not contain the same values) will the values be overwritten.
Is there an object unique identifier in Python
1
0
0
90,732
1,252,357
2009-08-09T21:40:00.000
2
0
1
0
python
1,252,386
4
false
0
0
As ilya n mentions, id(x) produces a unique identifier for an object. But your question is confusing, since Java's hashCode method doesn't give a unique identifier. Java's hashCode works like most hash functions: it always returns the same value for the same object, two objects that are equal always get equal codes, a...
2
94
0
This would be similar to the java.lang.Object.hashcode() method. I need to store objects I have no control over in a set, and make sure that only if two objects are actually the same object (not contain the same values) will the values be overwritten.
Is there an object unique identifier in Python
0.099668
0
0
90,732
1,253,232
2009-08-10T05:29:00.000
-1
1
0
0
java,python,.net,ruby,perl
2,274,406
16
false
0
0
GTK, originally in C. Ported to Java, Python, Ruby, C++, and most every other common language you can think of.
3
10
0
Since I am working with different Platforms and programming languages, I found there are many good libraries that are ported with different programming language than its original. For example JUnit and Log4j which has been ported into several different languages. Sometimes if I am already used to working with these lib...
Which libraries have been ported to different programming languages?
-0.012499
0
0
1,282
1,253,232
2009-08-10T05:29:00.000
3
1
0
0
java,python,.net,ruby,perl
1,269,650
16
false
0
0
Java,Java C#, .NET Ohh com'on, just kidding, ok, down vote me now!
3
10
0
Since I am working with different Platforms and programming languages, I found there are many good libraries that are ported with different programming language than its original. For example JUnit and Log4j which has been ported into several different languages. Sometimes if I am already used to working with these lib...
Which libraries have been ported to different programming languages?
0.037482
0
0
1,282
1,253,232
2009-08-10T05:29:00.000
2
1
0
0
java,python,.net,ruby,perl
1,253,957
16
false
0
0
Hibernate, Java NHibernate, .NET
3
10
0
Since I am working with different Platforms and programming languages, I found there are many good libraries that are ported with different programming language than its original. For example JUnit and Log4j which has been ported into several different languages. Sometimes if I am already used to working with these lib...
Which libraries have been ported to different programming languages?
0.024995
0
0
1,282
1,253,905
2009-08-10T09:26:00.000
3
0
0
0
python,network-programming
1,254,288
4
false
0
0
Python is a mature language that can do almost anything that you can do in C/C++ (even direct memory access if you really want to hurt yourself). You'll find that you can write beautiful code in it in a very short time, that this code is readable from the start and that it will stay readable (you will still know what i...
2
4
0
I am considering programming the network related features of my application in Python instead of the C/C++ API. The intended use of networking is to pass text messages between two instances of my application, similar to a game passing player positions as often as possible over the network. Although the python socket mo...
Suggestion Needed - Networking in Python - A good idea?
0.148885
0
1
1,015
1,253,905
2009-08-10T09:26:00.000
1
0
0
0
python,network-programming
1,253,945
4
false
0
0
To answer #1, I know that among other things, EVE Online (the MMO) uses a variant of Python for their server code.
2
4
0
I am considering programming the network related features of my application in Python instead of the C/C++ API. The intended use of networking is to pass text messages between two instances of my application, similar to a game passing player positions as often as possible over the network. Although the python socket mo...
Suggestion Needed - Networking in Python - A good idea?
0.049958
0
1
1,015
1,254,028
2009-08-10T09:58:00.000
6
0
0
1
python,google-app-engine
1,255,893
2
false
1
0
There are a few issues with using Python 2.6 with the SDK, mostly related to the SDK's sandboxing, which is designed to imitate the sandbox limitations in production. Note, of course, that even if you get Python 2.6 running with the SDK, your code will still have to run under 2.5 in production.
1
9
0
Since Python 2.6 is backward compatible to 2.52 , did anyone succeeded in using it with Google app Engine ( which supports 2.52 officially ). I know i should try it myself. But i am a python and web-apps new bee and for me installation and configuration is the hardest part while getting started with something new in t...
Has anyone succeeded in using Google App Engine with Python version 2.6?
1
0
0
3,409
1,254,469
2009-08-10T11:55:00.000
7
0
1
0
python,optparse
1,254,500
5
false
0
0
And if you need programmatic access to the default values, you can get to them via the defaults attribute of the parser (it's a dict)
1
43
0
Is there a way to make Python's optparse print the default value of an option or flag when showing the help with --help?
Can Python's optparse display the default value of an option?
1
0
0
4,633
1,254,802
2009-08-10T13:13:00.000
0
1
0
0
php,python
1,256,684
3
false
1
0
I've done this in the past by serving the PHP portions directly via Apache. You could either put them in with your media files, (/site_media/php/) or if you prefer to use something more lightweight for your media server (like lighttpd), you can set up another portion of the site that goes through apache with PHP enabl...
1
2
0
I'm trying to integrate an old PHP ad management system into a (Django) Python-based web application. The PHP and the Python code are both installed on the same hosts, PHP is executed by mod_php5 and Python through mod_wsgi, usually. Now I wonder what's the best way to call this PHP ad management code from within my Py...
Call PHP code from Python
0
0
0
3,234
1,254,819
2009-08-10T13:16:00.000
7
0
0
0
python,textbox,wxpython,wxwidgets
1,254,881
1
true
0
1
wx.StaticText You could also use a regular TextCtrl with the style TE_READONLY but that shows a cursor and the text looks editable, but it isn't.
1
5
0
How to create a non-editable text box with no cursor in wxPython to dump text in?
Non-editable text box in wxPython
1.2
0
0
4,502
1,257,264
2009-08-10T21:16:00.000
3
0
0
0
java,python,sockets
1,257,332
2
false
1
0
You've got to tell us what type of object you're working with. I'm assuming you're talking about a socket read. Either you read the socket with blocking or you read without blocking. You can measure how you have just read in a non-blocking read, if you are interested in that. However, it sounds like you are trying ...
1
2
0
Java's InputStream provides a method named available which returns the number of bytes that can be read without blocking. How can I achieve this in Python?
What's Python's equivalent to Java InputStream's available method?
0.291313
0
0
2,424
1,261,875
2009-08-11T17:36:00.000
22
0
1
0
python,closures,global,python-nonlocal
4,359,041
9
false
0
0
It takes the one "closest" to the point of reference in the source code. This is called "Lexical Scoping" and is standard for >40 years now. Python's class members are really in a dictionary called __dict__ and will never be reached by lexical scoping. If you don't specify nonlocal but do x = 7, it will create a new lo...
2
428
0
What does the Python nonlocal statement do (in Python 3.0 and later)? There's no documentation on the official Python website and help("nonlocal") does not work, either.
Python nonlocal statement
1
0
0
147,059
1,261,875
2009-08-11T17:36:00.000
2
0
1
0
python,closures,global,python-nonlocal
6,939,750
9
false
0
0
My personal understanding of the "nonlocal" statement (and do excuse me as I am new to Python and Programming in general) is that the "nonlocal" is a way to use the Global functionality within iterated functions rather than the body of the code itself. A Global statement between functions if you will.
2
428
0
What does the Python nonlocal statement do (in Python 3.0 and later)? There's no documentation on the official Python website and help("nonlocal") does not work, either.
Python nonlocal statement
0.044415
0
0
147,059
1,263,756
2009-08-12T01:01:00.000
0
0
0
0
python,ruby-on-rails,django,dashboard,filemaker
1,264,058
4
false
1
0
Both of these technologies are certainly mature enough to run Mission Critical applications, you just need to look at the number of big sites already on the internet that are running these technologies, so from that point of view you shouldn't be concerned. You only need to worry about your learning curve, if you feel ...
4
1
0
I'm about to start a fairly large project for a mid-sized business with a lot of integration with other systems (POS, accounting, website, inventory, purchasing, etc.) The purpose of the system is to try to reduce current data siloing and give employees role-based access to the specific data entry and reports they need...
technology recommendation for LAN Dashboard
0
0
0
706
1,263,756
2009-08-12T01:01:00.000
0
0
0
0
python,ruby-on-rails,django,dashboard,filemaker
1,265,425
4
false
1
0
You could also take a look at ExtJS for the frontend. I've made an ExtJS frontend for a company Dashboard, and using a Django backend managing the URL dispatching, the ORM and the data retrieval (communicating with the frontend with JSON webservices) and users love it, because it's almost as interactive as a local appl...
4
1
0
I'm about to start a fairly large project for a mid-sized business with a lot of integration with other systems (POS, accounting, website, inventory, purchasing, etc.) The purpose of the system is to try to reduce current data siloing and give employees role-based access to the specific data entry and reports they need...
technology recommendation for LAN Dashboard
0
0
0
706
1,263,756
2009-08-12T01:01:00.000
1
0
0
0
python,ruby-on-rails,django,dashboard,filemaker
1,263,768
4
false
1
0
If you're comfortable with a LAMP-style stack with PHP, then there's no reason you can't use either Django or Rails. Both are mature, well documented platforms with active, helpful communities. Based on what you've described, there's no reason that you can't use either technology.
4
1
0
I'm about to start a fairly large project for a mid-sized business with a lot of integration with other systems (POS, accounting, website, inventory, purchasing, etc.) The purpose of the system is to try to reduce current data siloing and give employees role-based access to the specific data entry and reports they need...
technology recommendation for LAN Dashboard
0.049958
0
0
706
1,263,756
2009-08-12T01:01:00.000
0
0
0
0
python,ruby-on-rails,django,dashboard,filemaker
1,275,182
4
true
1
0
Thank you everyone for your helpful answers! I think they address most of the issues raised by the question. But I think the key to the "final answer" (IMO) rests on the "multiple database" aspect. Railsninja suggested a piece of software he used for a project to extend rails functionality in this manner - thank you...
4
1
0
I'm about to start a fairly large project for a mid-sized business with a lot of integration with other systems (POS, accounting, website, inventory, purchasing, etc.) The purpose of the system is to try to reduce current data siloing and give employees role-based access to the specific data entry and reports they need...
technology recommendation for LAN Dashboard
1.2
0
0
706
1,264,421
2009-08-12T05:56:00.000
4
0
1
0
python,localization,multilingual,plone,linguaplone
1,264,656
1
true
0
0
Each language folder should implement INavigationRoot. You can set that up by going to the ZMI, finding the folder, and going to the Interfaces tab. There you will find plone.app.layout.navigation.interfaces.INavigationRoot. Click it, and navigation will treat it as the root of the tree. (Note that in Plone 3.3 the sup...
1
1
0
I am developing a multi-lingual site with Plone. I want to have one language per folder but the Plone navigation UI is causing problems. I have several different folders in my root, such as en, de, nl, etcetera. Inside those folders is the actual content, such as en/news, nl/nieuw, de/nachrichten, etcetera. I have set ...
Plone navigation with one-language-per-folder site
1.2
0
0
797
1,265,599
2009-08-12T11:31:00.000
1
0
0
0
python,audio,wxpython,system-sounds
1,265,745
3
false
0
0
From the documentation: wxTopLevelWindow::RequestUserAttention void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO) Use a system-dependent way to attract users attention to the window when it is in background. flags may have the value of either wxUSER_ATTENTION_INFO (default) or wxUSER_ATTENTION_ERRO...
1
0
0
How play standard system sounds from a Python script? I'm writing a GUI program in wxPython that needs to beep on events to attract user's attention, maybe there are functions in wxPython I can utilize?
System standard sound in Python
0.066568
0
0
995
1,265,821
2009-08-12T12:22:00.000
6
0
0
0
python,wxpython,size
1,265,988
1
true
0
1
For the width or height to be automatically determined based on context you use for it the value of -1, for example (-1, 100) for a height of 100 and automatic width. The default size for controls is usually (-1, -1). If a width or height is specified and the sizer item for the control doesn't have wx.EXPAND flag set (...
1
2
0
How to change only hight of an object in wxPython, leaving its width automatic? In my case it's a TextCtrl. How to make the height of the window available for change and lock the width?
Changing height of an object in wxPython
1.2
0
0
258
1,268,252
2009-08-12T19:33:00.000
-1
0
1
0
python
1,270,886
10
false
0
0
Why not just use a database for the shared data? You have a multitude of lightweight options where you don't need to worry about the concurrency issues: sqlite, any of the nosql/key-value breed of databases, etc.
4
72
0
I have an xmlrpc server using Twisted. The server has a huge amount of data stored in-memory. Is it possible to have a secondary, separate xmlrpc server running which can access the object in-memory in the first server? So, serverA starts up and creates an object. serverB starts up and can read from the object in se...
Possible to share in-memory data between 2 separate processes?
-0.019997
0
0
67,200
1,268,252
2009-08-12T19:33:00.000
133
0
1
0
python
1,269,055
10
true
0
0
Without some deep and dark rewriting of the Python core runtime (to allow forcing of an allocator that uses a given segment of shared memory and ensures compatible addresses between disparate processes) there is no way to "share objects in memory" in any general sense. That list will hold a million addresses of tuples,...
4
72
0
I have an xmlrpc server using Twisted. The server has a huge amount of data stored in-memory. Is it possible to have a secondary, separate xmlrpc server running which can access the object in-memory in the first server? So, serverA starts up and creates an object. serverB starts up and can read from the object in se...
Possible to share in-memory data between 2 separate processes?
1.2
0
0
67,200
1,268,252
2009-08-12T19:33:00.000
2
0
1
0
python
1,270,922
10
false
0
0
Why not stick the shared data into memcache server? then both servers can access it quite easily.
4
72
0
I have an xmlrpc server using Twisted. The server has a huge amount of data stored in-memory. Is it possible to have a secondary, separate xmlrpc server running which can access the object in-memory in the first server? So, serverA starts up and creates an object. serverB starts up and can read from the object in se...
Possible to share in-memory data between 2 separate processes?
0.039979
0
0
67,200
1,268,252
2009-08-12T19:33:00.000
4
0
1
0
python
1,271,568
10
false
0
0
You could write a C library to create and manipulate shared-memory arrays for your specific purpose, and then use ctypes to access them from Python. Or, put them on the filesystem in /dev/shm (which is tmpfs). You'd save a lot of development effort for very little performance overhead: reads/writes from a tmpfs filesy...
4
72
0
I have an xmlrpc server using Twisted. The server has a huge amount of data stored in-memory. Is it possible to have a secondary, separate xmlrpc server running which can access the object in-memory in the first server? So, serverA starts up and creates an object. serverB starts up and can read from the object in se...
Possible to share in-memory data between 2 separate processes?
0.07983
0
0
67,200
1,269,242
2009-08-12T23:17:00.000
10
1
1
0
python,smalltalk
1,271,000
5
false
0
0
As someone new to smalltalk, the two things that really strike me are the image-based system, and that reflection is everywhere. These two simple facts appear to give rise to everything else cool in the system: The image means that you do everything by manipulating objects, including writing and compiling code Reflec...
3
10
0
I'm studying Smalltalk right now. It looks very similar to python (actually, the opposite, python is very similar to Smalltalk), so I was wondering, as a python enthusiast, if it's really worth for me to study it. Apart from message passing, what are other notable conceptual differences between Smalltalk and python whi...
Differences between Smalltalk and python?
1
0
0
5,971
1,269,242
2009-08-12T23:17:00.000
7
1
1
0
python,smalltalk
1,269,259
5
false
0
0
Smalltalk historically has had an amazing IDE built in. I have missed this IDE on many languages. Smalltalk also has the lovely property that it is typically in a living system. You start up clean and start modifying things. This is basically an object persistent storage system. That being said, this is both good and b...
3
10
0
I'm studying Smalltalk right now. It looks very similar to python (actually, the opposite, python is very similar to Smalltalk), so I was wondering, as a python enthusiast, if it's really worth for me to study it. Apart from message passing, what are other notable conceptual differences between Smalltalk and python whi...
Differences between Smalltalk and python?
1
0
0
5,971
1,269,242
2009-08-12T23:17:00.000
2
1
1
0
python,smalltalk
1,269,266
5
false
0
0
The language aspect often isn't that important, and many languages are quite samey, From what I see, Python and Smalltalk share OOP ideals ... but are very different in their implementation and the power in the presented language interface. the real value comes in what the subtle differences in the syntax allows in ter...
3
10
0
I'm studying Smalltalk right now. It looks very similar to python (actually, the opposite, python is very similar to Smalltalk), so I was wondering, as a python enthusiast, if it's really worth for me to study it. Apart from message passing, what are other notable conceptual differences between Smalltalk and python whi...
Differences between Smalltalk and python?
0.07983
0
0
5,971
1,269,320
2009-08-12T23:44:00.000
-1
0
0
0
python,user-interface,image,gtk,pygtk
64,004,356
6
false
0
1
actually when we use gdk_pixbuf_scale_simple(pb,700,700,GDK_INTERP_BILINEAR); this function causes memory leakage (If we monitor task manager the memory requirement goes on increasing till it kills the process) when used with a timer event. How to solve that
1
22
0
In GTK, how can I scale an image? Right now I load images with PIL and scale them beforehand, but is there a way to do it with GTK?
Scale an image in GTK
-0.033321
0
0
18,745
1,270,403
2009-08-13T06:48:00.000
0
0
1
0
python,numeric
1,270,701
3
false
0
0
Don't think i really understood question: Do you mean that operation result should be explictly specified? you can do it with explict cast float(1+0.5) int(1+0.5) complex(1+0.5) Do you mean that operators should accept only same type operands? 1+2 1+0.5 -> raises exception 1+int(0.5) float(1)+0.5 while having sense, i...
2
0
0
A little background: I'm in the process of learning Python through O'Reilly's, "Learning Python" book, I've had some experience in Java. Anyway, upon reading Chapter 5 (I'm still in the middle of it, actually) I have come across a question with the way Python treats results of Mixed Numeric expressions. In the book, t...
About Python's Mixed Numeric Data Types converting results up to the most complicated operand
0
0
0
585
1,270,403
2009-08-13T06:48:00.000
5
0
1
0
python,numeric
1,270,465
3
true
0
0
"If you have a decimal place in your expression, you know it's going to be a floating point number, if you have something like 3+4j, you know it's going to be a complex number." That is the "hierarchy of Numeric Literals". I'm not really sure what more you want. Furthermore, the result will always be a subclass of num...
2
0
0
A little background: I'm in the process of learning Python through O'Reilly's, "Learning Python" book, I've had some experience in Java. Anyway, upon reading Chapter 5 (I'm still in the middle of it, actually) I have come across a question with the way Python treats results of Mixed Numeric expressions. In the book, t...
About Python's Mixed Numeric Data Types converting results up to the most complicated operand
1.2
0
0
585
1,271,317
2009-08-13T11:09:00.000
0
0
0
0
python,windows,mapping,drive
20,201,066
7
false
0
0
I had trouble getting this line to work: win32wnet.WNetAddConnection2(win32netcon.RESOURCETYPE_DISK, drive, networkPath, None, user, password) But was successful with this: win32wnet.WNetAddConnection2(1, 'Z:', r'\UNCpath\share', None, 'login', 'password')
1
33
0
What is the best way to map a network share to a windows drive using Python? This share also requires a username and password.
What is the best way to map windows drives using Python?
0
0
1
68,179
1,271,631
2009-08-13T12:25:00.000
0
0
0
0
python,django,templates
1,271,873
6
false
1
0
You will need to add the DEBUG flag to your context_processors. There may not even be an alternative way. At least, none that I know of.
1
69
0
Do you know if it is possible to know in a django template if the TEMPLATE_DEBUG flag is set? I would like to disable my google analytics script when I am running my django app on my development machine. Something like a {% if debug %} template tag would be perfect. Unfortunately, I didn't find something like that in t...
How to check the TEMPLATE_DEBUG flag in a django template?
0
0
0
31,654
1,272,242
2009-08-13T14:17:00.000
4
0
0
1
python,windows,sysinternals
1,272,313
2
false
0
0
Yes you can put a UNC path in your %PATH% env variable, and it will work if you have access to that path with your current session.
1
1
0
I have a python script calling an exe file. The exe file can be in the same folder as that of the python script or in a network drive. Is it possible to call the exe if it is in a remote drive/computer? Can this be done by setting the %PATH% variable
Is it possible to add a network drive to %PATH% environment variable
0.379949
0
0
5,469
1,272,325
2009-08-13T14:29:00.000
2
1
0
0
python,cgi,mod-python
1,272,579
1
true
1
0
You could always write your own handler, which is the way mod_python is normally intended to be used. You would have to set some HTTP headers (and you could have a look at the publisher handler's source code for inspiration on that), but otherwise I don't think it's much more complicated than what you've been trying to...
1
2
0
I'm looking for the simplest way of using python and SQLAlchemy to produce some XML for a jQuery based HTTP client. Right now I'm using mod_python's CGI handler but I'm unhappy with the fact that I can't persist stuff like the SQLAlchemy session. The mod_python publisher handler that is apparently capable of persisting...
Alternatives to mod_python's CGI handler
1.2
1
0
1,222
1,273,297
2009-08-13T17:03:00.000
0
1
0
0
python,twisted
1,273,455
3
false
0
0
I'd use a firewall on windows, or iptables on linux.
1
2
0
What would be the best method to restrict access to my XMLRPC server by IP address? I see the class CGIScript in web/twcgi.py has a render method that is accessing the request... but I am not sure how to gain access to this request in my server. I saw an example where someone patched twcgi.py to set environment varia...
Python Twisted: restricting access by IP address
0
0
1
3,265
1,274,493
2009-08-13T20:50:00.000
2
1
1
0
php,python,operators,bitwise-operators
1,274,508
3
false
0
0
$n <<= 1; is valid php
2
1
0
I have the Python expression n <<= 1 How do you express this in PHP?
How can I write 'n <<= 1' (Python) in PHP?
0.132549
0
0
527
1,274,493
2009-08-13T20:50:00.000
5
1
1
0
php,python,operators,bitwise-operators
1,274,505
3
true
0
0
It's the same operator in php. $n <<= 1;
2
1
0
I have the Python expression n <<= 1 How do you express this in PHP?
How can I write 'n <<= 1' (Python) in PHP?
1.2
0
0
527
1,275,482
2009-08-14T00:47:00.000
1
0
0
0
python,pygame,sprite
1,296,881
3
true
0
1
Typically you will sacrifice either processor time or memory, and you need to balance between the two. Unless you've got some great limit to your processor or you're computing a lot of expensive stuff, there's no real reason to put all that into the memory. Rotating a few sprites with a transform is cheap enough that i...
2
2
0
I am working on a top-down view 2d game at the moment and I am learning a ton about sprites and sprite handling. My question is how to handle a set of sprites that can be rotated in as many as 32 directions. At the moment a given object has its sprite sheet with all of the animations oriented with the object pointing a...
What is the best way to handle rotating sprites for a top-down view game
1.2
0
0
1,381
1,275,482
2009-08-14T00:47:00.000
4
0
0
0
python,pygame,sprite
1,277,181
3
false
0
1
The 32 directions for the sprite translate into 32 rotations by 11.25 degrees. You can reduce the number of precalculated images to 8 you only calculate the first 90 degrees (11.25, 22.5, 33.75, 45.0, 56.25, 67.5, 78.75, 90.0) and use the flip operations dynamically. Flips are much faster because they essentially only...
2
2
0
I am working on a top-down view 2d game at the moment and I am learning a ton about sprites and sprite handling. My question is how to handle a set of sprites that can be rotated in as many as 32 directions. At the moment a given object has its sprite sheet with all of the animations oriented with the object pointing a...
What is the best way to handle rotating sprites for a top-down view game
0.26052
0
0
1,381
1,277,124
2009-08-14T10:22:00.000
-5
0
0
1
python,macos,shell,lxml,osx-leopard
1,277,175
15
false
0
0
I compile it in /usr/local without any issues whatsoever. Install Python, libxml2, libxslt and then lxml. You might need setuptools installed too.
2
36
0
I've tried this and run in to problems a bunch of times in the past. Does anyone have a recipe for installing lxml on OS X without MacPorts or Fink that definitely works? Preferably with complete 1-2-3 steps for downloading and building each of the dependencies.
How do you install lxml on OS X Leopard without using MacPorts or Fink?
-1
0
0
27,228
1,277,124
2009-08-14T10:22:00.000
1
0
0
1
python,macos,shell,lxml,osx-leopard
7,850,559
15
false
0
0
I had this working fine with Snow Lepoard but after I upgraded to Lion I had to symlink gcc-4.2 to gcc. Running sudo env ARCHFLAGS="-arch i386 -arch x86_64" easy_install lxml was looking for gcc-4.2 instead of gcc.
2
36
0
I've tried this and run in to problems a bunch of times in the past. Does anyone have a recipe for installing lxml on OS X without MacPorts or Fink that definitely works? Preferably with complete 1-2-3 steps for downloading and building each of the dependencies.
How do you install lxml on OS X Leopard without using MacPorts or Fink?
0.013333
0
0
27,228
1,278,664
2009-08-14T15:52:00.000
2
1
1
0
python,file
1,278,690
6
false
0
0
map "".join(line.split('.')[:-1]) to each line of the file.
1
1
0
Sequence 1.1.1 ATGCGCGCGATAAGGCGCTA ATATTATAGCGCGCGCGCGGATATATATATATATATATATT Sequence 1.2.2 ATATGCGCGCGCGCGCGGCG ACCCCGCGCGCGCGCGGCGCGATATATATATATATATATATT Sequence 2.1.1 ATTCGCGCGAGTATAGCGGCG NOW,I would like to remove the last digit from each of the line that starts with '>'. For example, in this...
How to eliminate last digit from each of the top lines
0.066568
0
0
336
1,279,244
2009-08-14T17:54:00.000
4
1
0
0
python,stringio,bytesio
1,279,251
2
true
0
0
In Python 2.x, "string" means "bytes", and "unicode" means "string". You should use the StringIO or cStringIO modules. The mode will depend on which kind of data you pass in as the buffer parameter.
1
1
0
Question: How do I get a byte stream that works like StringIO for Python 2.5? Application: I'm converting a PDF to text, but don't want to save a file to the hard disk. Other Thoughts: I figured I could use StringIO, but there's no mode parameter (I guess "String" implies text mode). Apparently the io.BytesIO class is...
BytesIO with python v2.5
1.2
0
0
4,303
1,279,768
2009-08-14T19:35:00.000
1
0
0
0
python,artificial-intelligence,ocr,computer-vision
1,280,833
4
false
0
0
It's not as robust, but you can look at the colours of 3 or 4 locations on the card so that if they are white or if they are a color, you can determine which card and suit it is. Obviously this won't work if you don't always have the same cards.
3
11
0
I decided to do a project for fun where I want to take as input the image of a playing card and return its rank and suit. I figure that I only need look at the upper-left corner, since that has all the information. It should be robust - if I have a large image of an Ace of Diamonds, I should be able to scale it anywher...
OCR Playing Cards
0.049958
0
0
8,932
1,279,768
2009-08-14T19:35:00.000
1
0
0
0
python,artificial-intelligence,ocr,computer-vision
1,288,332
4
false
0
0
Given the limited sample size (4 suits, 13 different values) I'd just try to match a reference image of the suit and value with a new input image. First find the bounding box of the incoming suit / value (the smallest box enclosing all non-white pixels), scale your reference pictures to match the size of that bounding ...
3
11
0
I decided to do a project for fun where I want to take as input the image of a playing card and return its rank and suit. I figure that I only need look at the upper-left corner, since that has all the information. It should be robust - if I have a large image of an Ace of Diamonds, I should be able to scale it anywher...
OCR Playing Cards
0.049958
0
0
8,932
1,279,768
2009-08-14T19:35:00.000
1
0
0
0
python,artificial-intelligence,ocr,computer-vision
1,280,850
4
false
0
0
Personally I would go the machine learning route with this one.
3
11
0
I decided to do a project for fun where I want to take as input the image of a playing card and return its rank and suit. I figure that I only need look at the upper-left corner, since that has all the information. It should be robust - if I have a large image of an Ace of Diamonds, I should be able to scale it anywher...
OCR Playing Cards
0.049958
0
0
8,932
1,281,075
2009-08-15T03:34:00.000
2
0
0
0
python,ajax,screen-scraping
3,134,226
5
false
1
0
Here is how I would do it: Install Firebug on Firefox, then turn the NET on in firebug and click on the desired link on YouTube. Now see what happens and what pages are requested. Find the one that are responsible for the AJAX part of page. Now you can use urllib or Mechanize to fetch the link. If you CAN pull the same...
1
2
0
I'm trying to scrap a page in youtube with python which has lot of ajax in it I've to call the java script each time to get the info. But i'm not really sure how to go about it. I'm using the urllib2 module to open URLs. Any help would be appreciated.
Scraping Ajax - Using python
0.07983
0
1
4,364
1,283,061
2009-08-15T22:48:00.000
1
0
0
1
python,pipe,popen
1,283,191
5
false
0
0
Alternatively, you can pipe your process into tee and capture only one of the streams. Something along the lines of sh -c 'process interesting stuff' | tee /dev/stderr. Of course, this only works on Unix-like systems.
2
5
0
I want to capture stdout from a long-ish running process started via subprocess.Popen(...) so I'm using stdout=PIPE as an arg. However, because it's a long running process I also want to send the output to the console (as if I hadn't piped it) to give the user of the script an idea that it's still working. Is this at a...
Python - capture Popen stdout AND display on console?
0.039979
0
0
11,350
1,283,061
2009-08-15T22:48:00.000
1
0
0
1
python,pipe,popen
1,283,062
5
true
0
0
Can you simply print it as you read it from the pipe?
2
5
0
I want to capture stdout from a long-ish running process started via subprocess.Popen(...) so I'm using stdout=PIPE as an arg. However, because it's a long running process I also want to send the output to the console (as if I hadn't piped it) to give the user of the script an idea that it's still working. Is this at a...
Python - capture Popen stdout AND display on console?
1.2
0
0
11,350
1,283,065
2009-08-15T22:52:00.000
0
1
0
0
python,pdf,fonts
1,285,029
2
false
0
0
Highlight is possible in pdf file using PDF annotations but doing it natively is not that easy job. If any of the mentioned library provide such facility is something that you may look for.
1
12
0
I'm not familiar with the PDF specification at all. I was wondering if it's possible to directly manipulate a PDF file so that certain blocks of text that I've identified as important are highlighted in colors of my choice. Language of choice would be python.
Programmatically change font color of text in PDF
0
0
0
6,726
1,283,266
2009-08-16T01:23:00.000
0
0
1
0
python,functional-programming,recursion
1,283,297
3
false
0
0
I'd implement an iterative binary adder or hamming code and run that way.
1
1
0
I have the following need (in python): generate all possible tuples of length 12 (could be more) containing either 0, 1 or 2 (basically, a ternary number with 12 digits) filter these tuples according to specific criteria, culling those not good, and keeping the ones I need. As I had to deal with small lengths until ...
Recursive generation + filtering. Better non-recursive?
0
0
0
870
1,283,646
2009-08-16T07:03:00.000
0
0
0
1
php,python,entity-framework,open-source
1,325,558
3
false
1
0
I have heard iBattis is good. A few companies fall back to iBattis when their programmer teams are not capable of understanding Hibernate (time issue). Personally, I still like Linq2Sql. Yes, the first time someone needs to delete and redrag over a table seems like too much work, but it really is not. And the time t...
1
2
0
What I really like about Entity framework is its drag and drop way of making up the whole model layer of your application. You select the tables, it joins them and you're done. If you update the database scheda, right click -> update and you're done again. This seems to me miles ahead the competiting ORMs, like the mes...
Entity Framwework-like ORM NOT for .NET
0
1
0
433
1,283,856
2009-08-16T09:14:00.000
2
0
0
0
python,mod-wsgi,mod-python,stackless,python-stackless
1,284,586
1
true
1
0
When you install a new version of Python (whether stackless or not) you also need to reinstall all of the third party modules you need -- either from sources, which you say you don't want to do, or from packages built for the new version of Python you've just installed. So, check the repository from which you installe...
1
0
0
I installed stackless pyton 2.6.2 after reading several sites that said its fully compatible with vanilla python. After installing i found that my django applications do not work any more. I did reinstall django (1.1) again and now im kind of lost. The error that i get is 500: Internal Server Error The server encounter...
Stackless python stopped mod_python/apache from working
1.2
1
0
672
1,283,922
2009-08-16T09:55:00.000
2
0
1
0
python,libraries
1,283,942
7
true
0
0
For the basics, yes, the standard Python library is probably all you'll need. But as you continue programming in Python, eventually you will need some other library for some task -- for instance, I recently needed to generate a tone at a specific, but differing, frequency for an application, and pyAudiere did the job ...
4
1
0
I am trying to learn Python and referencing the documentation for the standard Python library from the Python website, and I was wondering if this was really the only library and documentation I will need or is there more? I do not plan to program advanced 3d graphics or anything advanced at the moment. Edit: Thanks v...
Does one often use libraries outside the standard ones?
1.2
0
0
257
1,283,922
2009-08-16T09:55:00.000
0
0
1
0
python,libraries
1,283,963
7
false
0
0
Assuming that the standard library doesn't provide what we need and we don't have the time, or the knowledge, to implement the code we reuse 3rd party libraries. This is a common attitude regardless of the programming language.
4
1
0
I am trying to learn Python and referencing the documentation for the standard Python library from the Python website, and I was wondering if this was really the only library and documentation I will need or is there more? I do not plan to program advanced 3d graphics or anything advanced at the moment. Edit: Thanks v...
Does one often use libraries outside the standard ones?
0
0
0
257
1,283,922
2009-08-16T09:55:00.000
0
0
1
0
python,libraries
1,283,926
7
false
0
0
If you're just beginning, all you'll need to know is the stuff you can get from the Python website. Failing that a quick Google is the fastest way to get (most) Python answers these days. As you develop your skills and become more advanced, you'll start looking for more exciting things to do, at which point you'll natu...
4
1
0
I am trying to learn Python and referencing the documentation for the standard Python library from the Python website, and I was wondering if this was really the only library and documentation I will need or is there more? I do not plan to program advanced 3d graphics or anything advanced at the moment. Edit: Thanks v...
Does one often use libraries outside the standard ones?
0
0
0
257
1,283,922
2009-08-16T09:55:00.000
0
0
1
0
python,libraries
1,284,615
7
false
0
0
If there's a chance that someone else ever wanted to do what you want to do, there's a chance that someone created a library for it. A few minutes Googling something like "python image library" will find you what you need, or let you know that someone hasn't created a library for your purposes.
4
1
0
I am trying to learn Python and referencing the documentation for the standard Python library from the Python website, and I was wondering if this was really the only library and documentation I will need or is there more? I do not plan to program advanced 3d graphics or anything advanced at the moment. Edit: Thanks v...
Does one often use libraries outside the standard ones?
0
0
0
257
1,284,008
2009-08-16T10:51:00.000
0
0
0
0
python,gstreamer
2,610,696
3
false
0
0
The code shown above seems basically correct, but it will flounder on the rocks of v4l2. The strings you get will depend on what card you have: On four different cards so far I've encountered: "Composite" "Composite1" "composite" "Composite Video Input" Also be aware that some cards will have the driver lie, since t...
2
1
0
I own a avermedia volar HX usb stick, I want to capture fromthe composite input , but I can't because I'm unable to select the input. I'm using gstreamer with + python, I think I need to use gsttuner select input but I have no experience using gstreamer's interfaces. Could someone post a simple example? Thanks!
how can I grab video from usb video capture + dvb device with gstreamer?
0
0
0
1,572
1,284,008
2009-08-16T10:51:00.000
1
0
0
0
python,gstreamer
4,445,534
3
false
0
0
To anyone stumbling on this, some internal gstreamer changes since this was originally posted may require gst.STATE_READY now instead of STATE_PAUSED. Tripped me up as it seems half the capture devices I encounter default to PAL and I need to use the GST_TUNER interface to change it.
2
1
0
I own a avermedia volar HX usb stick, I want to capture fromthe composite input , but I can't because I'm unable to select the input. I'm using gstreamer with + python, I think I need to use gsttuner select input but I have no experience using gstreamer's interfaces. Could someone post a simple example? Thanks!
how can I grab video from usb video capture + dvb device with gstreamer?
0.066568
0
0
1,572