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
674,229
2009-03-23T16:58:00.000
9
0
1
0
python,indexing,list
674,268
10
false
0
0
To add to Devin's response: This is an old debate between special return values versus exceptions. Many programming gurus prefer an exception because on an exception, I get to see the whole stacktrace and immediate infer what is wrong.
5
26
0
Why does list.index throw an exception, instead of using an arbitrary value (for example, -1)? What's the idea behind this? To me it looks cleaner to deal with special values, rather than exceptions. EDIT: I didn't realize -1 is a potentially valid value. Nevertheless, why not something else? How about a value of None?
Python list.index throws exception when index not found
1
0
0
22,838
674,229
2009-03-23T16:58:00.000
1
0
1
0
python,indexing,list
674,281
10
false
0
0
I agree with Devin Jeanpierre, and would add that dealing with special values may look good in small example cases but (with a few notable exceptions, e.g. NaN in FPUs and Null in SQL) it doesn't scale nearly as well. The only time it works is where: You've typically got lots of nested homogeneous processing (e.g. ma...
5
26
0
Why does list.index throw an exception, instead of using an arbitrary value (for example, -1)? What's the idea behind this? To me it looks cleaner to deal with special values, rather than exceptions. EDIT: I didn't realize -1 is a potentially valid value. Nevertheless, why not something else? How about a value of None?
Python list.index throws exception when index not found
0.019997
0
0
22,838
674,764
2009-03-23T18:57:00.000
0
0
1
0
python,string,find
48,610,988
9
false
0
0
if x is a string and you search for y which also a string their is two cases : case 1: y is exist in x so x.find(y) = the index (the position) of the y in x . case 2: y is not exist so x.find (y) = -1 this mean y is not found in x.
1
63
0
I am trying to find some examples but no luck. Does anyone know of some examples on the net? I would like to know what it returns when it can't find, and how to specify from start to end, which I guess is going to be 0, -1.
Examples for string find in Python
0
0
0
376,942
675,442
2009-03-23T22:17:00.000
99
0
1
0
python,docstring
675,452
19
false
0
0
The only cure I know for this is a good editor. Sorry.
5
537
0
Is there a mechanism to comment out large blocks of Python code? Right now, the only ways I can see of commenting out code are to either start every line with a #, or to enclose the code in triple quotes: """. The problem with these is that inserting # before every line is cumbersome and """ makes the string I want to ...
How to comment out a block of code in Python
1
0
0
1,947,381
675,442
2009-03-23T22:17:00.000
36
0
1
0
python,docstring
15,196,667
19
false
0
0
In JetBrains PyCharm on Mac use Command + / to comment/uncomment selected block of code. On Windows, use CTRL + /.
5
537
0
Is there a mechanism to comment out large blocks of Python code? Right now, the only ways I can see of commenting out code are to either start every line with a #, or to enclose the code in triple quotes: """. The problem with these is that inserting # before every line is cumbersome and """ makes the string I want to ...
How to comment out a block of code in Python
1
0
0
1,947,381
675,442
2009-03-23T22:17:00.000
1
0
1
0
python,docstring
8,910,010
19
false
0
0
On Eric4 there is an easy way: select a block, type Ctrl+M to comment the whole block or Ctrl+alt+M to uncomment.
5
537
0
Is there a mechanism to comment out large blocks of Python code? Right now, the only ways I can see of commenting out code are to either start every line with a #, or to enclose the code in triple quotes: """. The problem with these is that inserting # before every line is cumbersome and """ makes the string I want to ...
How to comment out a block of code in Python
0.010526
0
0
1,947,381
675,442
2009-03-23T22:17:00.000
1
0
1
0
python,docstring
8,934,599
19
false
0
0
Another editor-based solution: text "rectangles" in Emacs. Highlight the code you want to comment out, then C-x-r-t # To un-comment the code: highlight, then C-x-r-k I use this all-day, every day. (Assigned to hot-keys, of course.) This and powerful regex search/replace is the reason I tolerate Emacs's other "eccent...
5
537
0
Is there a mechanism to comment out large blocks of Python code? Right now, the only ways I can see of commenting out code are to either start every line with a #, or to enclose the code in triple quotes: """. The problem with these is that inserting # before every line is cumbersome and """ makes the string I want to ...
How to comment out a block of code in Python
0.010526
0
0
1,947,381
675,442
2009-03-23T22:17:00.000
1
0
1
0
python,docstring
676,446
19
false
0
0
Triple quotes are OK to me. You can use ''' foo ''' for docstrings and """ bar """ for comments or vice-versa to make the code more readable.
5
537
0
Is there a mechanism to comment out large blocks of Python code? Right now, the only ways I can see of commenting out code are to either start every line with a #, or to enclose the code in triple quotes: """. The problem with these is that inserting # before every line is cumbersome and """ makes the string I want to ...
How to comment out a block of code in Python
0.010526
0
0
1,947,381
676,460
2009-03-24T07:44:00.000
1
0
0
1
python,google-app-engine,web-crawler
677,133
4
false
1
0
App Engine code only runs in response to HTTP requests, so you can't run a persistent crawler in the background. With the upcoming release of scheduled tasks, you could write a crawler that uses that functionality, but it would be less than ideal.
2
4
0
Is it impossible to run a web crawler on GAE along side with my app considering the I am running the free startup version?
Web crawlers and Google App Engine Hosted applications
0.049958
0
0
3,097
676,460
2009-03-24T07:44:00.000
0
0
0
1
python,google-app-engine,web-crawler
677,320
4
false
1
0
It's possible. But that's not really an application for appengine just as Arachnid wrote. If you manage to get it working I'll doubt you'll stay in the qotas for free accounts.
2
4
0
Is it impossible to run a web crawler on GAE along side with my app considering the I am running the free startup version?
Web crawlers and Google App Engine Hosted applications
0
0
0
3,097
677,028
2009-03-24T11:34:00.000
2
0
0
0
python,sqlite,notifications
677,042
8
false
0
0
Just open a socket between the two processes and have the editor tell all the players about the update.
5
15
0
Let's say I have two or more processes dealing with an SQLite database - a "player" process and many "editor" processes. The "player" process reads the database and updates a view - in my case it would be a waveform being mixed to the soundcard depending on events stored in the database. An "editor" process is any edi...
How do I notify a process of an SQLite database change done in a different process?
0.049958
1
0
15,631
677,028
2009-03-24T11:34:00.000
2
0
0
0
python,sqlite,notifications
677,215
8
false
0
0
I think in that case, I would make a process to manage the database read/writes. Each editor that want to make some modifications to the database makes a call to this proccess, be it through IPC or network, or whatever method. This process can then notify the player of a change in the database. The player, when he want...
5
15
0
Let's say I have two or more processes dealing with an SQLite database - a "player" process and many "editor" processes. The "player" process reads the database and updates a view - in my case it would be a waveform being mixed to the soundcard depending on events stored in the database. An "editor" process is any edi...
How do I notify a process of an SQLite database change done in a different process?
0.049958
1
0
15,631
677,028
2009-03-24T11:34:00.000
2
0
0
0
python,sqlite,notifications
677,087
8
false
0
0
If it's on the same machine, the simplest way would be to have named pipe, "player" with blocking read() and "editors" putting a token in pipe whenever they modify DB.
5
15
0
Let's say I have two or more processes dealing with an SQLite database - a "player" process and many "editor" processes. The "player" process reads the database and updates a view - in my case it would be a waveform being mixed to the soundcard depending on events stored in the database. An "editor" process is any edi...
How do I notify a process of an SQLite database change done in a different process?
0.049958
1
0
15,631
677,028
2009-03-24T11:34:00.000
4
0
0
0
python,sqlite,notifications
677,085
8
true
0
0
A relational database is not your best first choice for this. Why? You want all of your editors to pass changes to your player. Your player is -- effectively -- a server for all those editors. Your player needs multiple open connections. It must listen to all those connections for changes. It must display those ch...
5
15
0
Let's say I have two or more processes dealing with an SQLite database - a "player" process and many "editor" processes. The "player" process reads the database and updates a view - in my case it would be a waveform being mixed to the soundcard depending on events stored in the database. An "editor" process is any edi...
How do I notify a process of an SQLite database change done in a different process?
1.2
1
0
15,631
677,028
2009-03-24T11:34:00.000
1
0
0
0
python,sqlite,notifications
677,169
8
false
0
0
How many editor processes (why processes?), and how often do you expect updates? This doesn't sound like a good design, especially not considering sqlite really isn't too happy about multiple concurrent accesses to the database. If multiple processes makes sense and you want persistence, it would probably be smarter to...
5
15
0
Let's say I have two or more processes dealing with an SQLite database - a "player" process and many "editor" processes. The "player" process reads the database and updates a view - in my case it would be a waveform being mixed to the soundcard depending on events stored in the database. An "editor" process is any edi...
How do I notify a process of an SQLite database change done in a different process?
0.024995
1
0
15,631
677,641
2009-03-24T14:28:00.000
5
1
1
0
python,linux,gstreamer
677,681
2
true
0
0
tee will block if either output blocks, so it's probably your bottleneck. I suggest to write the stream that takes longer to encode to disk and encode from there.
2
4
0
I'm trying to use gstreamer 0.10 from Python to simultaneously display a v4l2 video source and record it to xvid-in-avi. Over a long period of time the computer would be fast enough to do this but if another program uses the disk it drops frames. That's bad enough, but on playback there are bursts of movement in the vi...
How can I record live video with gstreamer without dropping frames?
1.2
0
0
3,103
677,641
2009-03-24T14:28:00.000
2
1
1
0
python,linux,gstreamer
2,237,878
2
false
0
0
and you need to write xvimagesink, not xvimagesync
2
4
0
I'm trying to use gstreamer 0.10 from Python to simultaneously display a v4l2 video source and record it to xvid-in-avi. Over a long period of time the computer would be fast enough to do this but if another program uses the disk it drops frames. That's bad enough, but on playback there are bursts of movement in the vi...
How can I record live video with gstreamer without dropping frames?
0.197375
0
0
3,103
680,207
2009-03-25T04:23:00.000
4
0
1
0
python
680,227
5
false
0
0
If you are typing "python" to launch it, it is probably CPython. IronPython's executable name is "ipy".
1
4
0
I am using Python 2.5.2. How can I tell whether it is CPython or IronPython or Jython? Another question: how can I use a DLL developed in VB.NET in my project?
How do I tell which Python interpreter I'm using?
0.158649
0
0
6,072
680,336
2009-03-25T05:34:00.000
3
0
1
0
python,ironpython
680,367
1
true
0
1
You won't be able to run your script in that application. The script console in that QT application doubtlessly uses plain ol' CPython instead of IronPython. There's no real good way to change that without significant surgery to the application that's hosting the python console.
1
0
0
This is a continuation of my question Python2.5.2 The code i developed is working fine with clr.Addreference(). Now thee problem is I have to load ny script which uses dll developed in .NET to another application.They had used QT for its implementation.There is a Script console in that application.When ii entered 'impo...
Python 2.5.2 continued
1.2
0
0
614
681,853
2009-03-25T14:33:00.000
1
1
1
0
.net,python,clr,ironpython
681,875
4
false
0
0
As far as I know you are not going to get anything more actively developed than IronPython . IronPython is currently one of the .NET 5 being developed by the language team (C#, VB.NET, F#, IronPython and IronRuby) so I doubt that there's another open source .NET Python project that's gone anywhere near as far.
2
3
0
Are there any alternatives to Python for .NET or IronPython for accessing .NET CLR? Both of these seem to have downsides in that Python for .NET is not under active development (as far as I can tell) and you lose some features available in CPython if you use IronPython. So are there any alternatives?
Any alternatives to IronPython, Python for .NET for accessing CLR from python?
0.049958
0
0
3,386
681,853
2009-03-25T14:33:00.000
4
1
1
0
.net,python,clr,ironpython
682,313
4
false
0
0
Apart from Python for .NET (which works pretty well for me), the only other solution I'm aware of is exposing the .NET libraries via COM interop, so you can use them via the pywin32 extensions. (I don't know much about .NET com interop yet, so hopefully someone else can provide further explanation on that.)
2
3
0
Are there any alternatives to Python for .NET or IronPython for accessing .NET CLR? Both of these seem to have downsides in that Python for .NET is not under active development (as far as I can tell) and you lose some features available in CPython if you use IronPython. So are there any alternatives?
Any alternatives to IronPython, Python for .NET for accessing CLR from python?
0.197375
0
0
3,386
682,799
2009-03-25T18:08:00.000
1
0
0
1
python,command-line,windows-console
4,378,603
6
false
0
0
I got the same message but it was strange because the command was not that long (130 characters) and it used to work, it just stopped working one day. I just closed the command window and opened a new one and it worked. I have had the command window opened for a long time (maybe months, it's a remote virtual machine). ...
2
10
0
I am trying to use os.system() to call another program that takes an input and an output file. The command I use is ~250 characters due to the long folder names. When I try to call the command, I'm getting an error: The input line is too long. I'm guessing there's a 255 character limit (its built using a C system call...
What to do with "The input line is too long" error message?
0.033321
0
0
26,102
682,799
2009-03-25T18:08:00.000
1
0
0
1
python,command-line,windows-console
682,807
6
false
0
0
Assuming you're using windows, from the backslashes, you could write a .bat file from python and then os.system() on that. It's a hack.
2
10
0
I am trying to use os.system() to call another program that takes an input and an output file. The command I use is ~250 characters due to the long folder names. When I try to call the command, I'm getting an error: The input line is too long. I'm guessing there's a 255 character limit (its built using a C system call...
What to do with "The input line is too long" error message?
0.033321
0
0
26,102
683,273
2009-03-25T20:18:00.000
2
1
1
0
c#,python
687,099
10
false
0
0
I'm pretty much in your shoes too, still using C# for most of my work, but using Python more and more for other projects. @e-satis probably knows Python inside-out and all his advice is top-notch. From my point of view what made the biggest difference to me was the following: Get back into functional. not necessarily s...
2
74
0
I've mainly been doing C# development for the past few years but recently started to do a bit of Python (not Iron Python). But I'm not sure if I've made the mental leap to Python...I kind of feel I'm trying to do things as I would in C#. Any advice on how I can fully take advantage of Python? Or any tips\tricks, thing...
Advice for C# programmer writing Python
0.039979
0
0
12,232
683,273
2009-03-25T20:18:00.000
16
1
1
0
c#,python
683,362
10
false
0
0
Refrain from using classes. Use dictionaries, sets, list and tuples. Setters and getters are forbidden. Don't have exception handlers unless you really need to - let it crash in style. Pylint can be your friend for more pythonish coding style. When you're ready - check out list comprehensions, generators and lambda fun...
2
74
0
I've mainly been doing C# development for the past few years but recently started to do a bit of Python (not Iron Python). But I'm not sure if I've made the mental leap to Python...I kind of feel I'm trying to do things as I would in C#. Any advice on how I can fully take advantage of Python? Or any tips\tricks, thing...
Advice for C# programmer writing Python
1
0
0
12,232
683,493
2009-03-25T21:17:00.000
2
0
0
0
python,httpwebrequest
683,519
3
true
0
0
Set the HTTP request timeout.
1
1
0
Very occasionally when making a http request, I am waiting for an age for a response that never comes. What is the recommended way to cancel this request after a reasonable period of time?
Timeout on a HTTP request in python
1.2
0
1
578
684,171
2009-03-26T01:19:00.000
38
0
1
0
python
684,229
11
false
0
0
So, far I have been exiting and reentering the Interpreter because re importing the file again is not working for me. Yes, just saying import again gives you the existing copy of the module from sys.modules. You can say reload(module) to update sys.modules and get a new copy of that single module, but if any other mod...
1
448
0
I often test my module in the Python Interpreter, and when I see an error, I quickly update the .py file. But how do I make it reflect on the Interpreter ? So, far I have been exiting and reentering the Interpreter because re importing the file again is not working for me.
How to re import an updated package while in Python Interpreter?
1
0
0
297,115
685,533
2009-03-26T12:24:00.000
0
0
0
1
python,linux,ms-office
685,656
7
false
0
0
I've had some success at using XSLT to process the XML-based office files into something usable in the past. It's not necessarily a python-based solution, but it does get the job done.
1
11
0
Any recomendations on a method to convert .doc, .ppt, and .xls to plain text on linux using python? Really any method of conversion would be useful. I have already looked at using Open Office but, I would like a solution that does not require having to install Open Office.
python convert microsoft office docs to plain text on linux
0
0
0
11,214
685,671
2009-03-26T13:01:00.000
0
0
1
0
python
970,635
9
false
0
0
the solutions based on 'set' have a small drawback, namely they only work for hashable objects. the solution based on itertools.groupby on the other hand works for all comparable objects (e.g.: dictionaries and lists).
1
0
0
I have a list of strings that should be unique. I want to be able to check for duplicates quickly. Specifically, I'd like to be able to take the original list and produce a new list containing any repeated items. I don't care how many times the items are repeated so it doesn't have to have a word twice if there are two...
In Python, how do I take a list and reduce it to a list of duplicates?
0
0
0
837
687,703
2009-03-26T21:52:00.000
0
1
1
0
python,io,global-variables
687,855
3
false
0
0
Nope. Variables are too specific to be passed around in the global namespace. Hide them inside static functions/classes instead that can do magic things to them at run time (or call other ones entirely). Consider what happens if the IO can periodically change state or if it needs to block for a while (like many socket...
2
5
0
I'm programming a game in Python, where all IO activities are done by an IO object (in the hope that it will be easy to swap that object out for another which implements a different user interface). Nearly all the other objects in the game need to access the IO system at some point (e.g. printing a message, updating th...
Python game programming: is my IO object a legitimate candidate for being a global variable?
0
0
0
250
687,703
2009-03-26T21:52:00.000
1
1
1
0
python,io,global-variables
687,782
3
false
0
0
Yes, I think so. Another possibility would be to create a module loggerModule that has functions like print() and write(), but this would only marginally be better.
2
5
0
I'm programming a game in Python, where all IO activities are done by an IO object (in the hope that it will be easy to swap that object out for another which implements a different user interface). Nearly all the other objects in the game need to access the IO system at some point (e.g. printing a message, updating th...
Python game programming: is my IO object a legitimate candidate for being a global variable?
0.066568
0
0
250
688,302
2009-03-27T02:19:00.000
5
0
1
0
python,text-editor,tui
688,315
10
false
0
0
Curses type libraries and resources will get you into the textual user interfaces, and provide very nice, relatively easy to use windows, menus, editors, etc. Then you'll want to look into code highlighting modules for python. It's a fun process dealing with the limitations of textual interfaces, and you can learn a lo...
2
20
0
I have gotten to know my way around a few programming languages, and I'd like to try my hand at making a command-line text editor -- something that runs in the terminal, like vim/emacs/nano, but is pure text (no guis, please). Preferably, I'd like to do this in python. Where do I start? Are there any (python) libraries...
How do I make a command line text editor?
0.099668
0
0
21,324
688,302
2009-03-27T02:19:00.000
2
0
1
0
python,text-editor,tui
688,313
10
false
0
0
Well, what do you mean by a GUI? If you just want to create something that can be used on a console, look into the curses module in the Python standard library, which allows you to simulate a primitive GUI of sorts on a console.
2
20
0
I have gotten to know my way around a few programming languages, and I'd like to try my hand at making a command-line text editor -- something that runs in the terminal, like vim/emacs/nano, but is pure text (no guis, please). Preferably, I'd like to do this in python. Where do I start? Are there any (python) libraries...
How do I make a command line text editor?
0.039979
0
0
21,324
688,740
2009-03-27T06:36:00.000
17
1
1
0
php,python,dynamic-languages
688,756
4
true
0
0
Before you start refactoring you should create tests that will be able to test what you're going to change - if you say unit tests will not be enought, or they will be hard to create, then by all means create higher level tests possibly even excersising the whole of your product. If you have code coverage tools for yo...
2
7
0
How to make sure that code is still working after refactoring ( i.e, after variable name change)? In static language, if a class is renamed but other referring class is not, then I will get a compilation error. But in dynamic language there is no such safety net, and your code can break during refactoring if you are ...
How to Make sure the code is still working after refactoring ( Dynamic language)
1.2
0
0
403
688,740
2009-03-27T06:36:00.000
0
1
1
0
php,python,dynamic-languages
1,813,232
4
false
0
0
1) For Python use PyUnit for PHP phpunit. 2) TDD approach is good but also making tests after writing code is acceptable. 3) Also use refactoring tools that are available for Your IDE they do only safe refactorings. In Python You have rope (this is library but have plugins for most IDEs). 4) Good books are: 'Test-Drive...
2
7
0
How to make sure that code is still working after refactoring ( i.e, after variable name change)? In static language, if a class is renamed but other referring class is not, then I will get a compilation error. But in dynamic language there is no such safety net, and your code can break during refactoring if you are ...
How to Make sure the code is still working after refactoring ( Dynamic language)
0
0
0
403
689,560
2009-03-27T12:19:00.000
1
1
1
0
python,jpeg,python-imaging-library,fedora,libjpeg
689,629
2
false
0
0
Turns out this gets solved by completely removing the installed versions of PIL and starting the build again from scratch.
1
3
0
I'm on Fedora Core 6 (64 bit) after "yum install libjpeg-devel" I have downloaded and built PIL. It gives the message: --- JPEG support ok Looks like JPEG built okay, but when running selftest.py: IOError: decoder jpeg not available Why would it appear to have built correctly, but fail the selftest?
Building Python PIL for JPEG looks okay, but fails the selftest
0.099668
0
0
2,349
690,527
2009-03-27T16:45:00.000
3
1
0
0
python,email,pop3,fetchmail
690,536
4
false
0
0
Pop doesn't support sent email. Pop is an inbox only, Sent mail will be stored in IMAP, Exchange or other proprietary system.
4
0
0
I have been asked to quote a project where they want to see sent email using POP. I am pretty sure this is not possible, but I thought if it was. So is it possible given a users POP email server details to access their sent mail? If so any examples in Python or fetchmail?
Is it possible to Access a Users Sent Email over POP?
0.148885
0
1
3,820
690,527
2009-03-27T16:45:00.000
1
1
0
0
python,email,pop3,fetchmail
690,541
4
false
0
0
The smtp (mail sending) server could forward a copy of all sent mail back to the sender, they could then access this over pop.
4
0
0
I have been asked to quote a project where they want to see sent email using POP. I am pretty sure this is not possible, but I thought if it was. So is it possible given a users POP email server details to access their sent mail? If so any examples in Python or fetchmail?
Is it possible to Access a Users Sent Email over POP?
0.049958
0
1
3,820
690,527
2009-03-27T16:45:00.000
5
1
0
0
python,email,pop3,fetchmail
690,542
4
true
0
0
POP3 only handles receiving email; sent mail is sent via SMTP in these situations, and may be sent via a different ISP to the receiver (say, when you host your own email server, but use your current ISP to send). As such, this isn't directly possible. IMAP could do it, as this offers server side email folders as well a...
4
0
0
I have been asked to quote a project where they want to see sent email using POP. I am pretty sure this is not possible, but I thought if it was. So is it possible given a users POP email server details to access their sent mail? If so any examples in Python or fetchmail?
Is it possible to Access a Users Sent Email over POP?
1.2
0
1
3,820
690,527
2009-03-27T16:45:00.000
1
1
0
0
python,email,pop3,fetchmail
690,540
4
false
0
0
Emails are not sent using POP, but collected from a server using POP. They are sent using SMTP, and they don't hang around on the server once they're gone. You might want to look into IMAP?
4
0
0
I have been asked to quote a project where they want to see sent email using POP. I am pretty sure this is not possible, but I thought if it was. So is it possible given a users POP email server details to access their sent mail? If so any examples in Python or fetchmail?
Is it possible to Access a Users Sent Email over POP?
0.049958
0
1
3,820
690,856
2009-03-27T18:05:00.000
4
1
0
0
php,python,django,codeigniter
691,231
3
false
1
0
Deployment is clearly a problem for all non-PHP based web apps, but I think things are getting better with the DreamHost/Engineyard type ISP's who provide Ruby/Python etc. out of the box. It also looks like there's going to be a lot of discussion at PyCon this week about ways to fix deployment problems. The growth in...
3
8
0
I'm going to build a turn-key solution for a vertical market, and would like to offer both options: software as a service, and give them the opportunity to host the application on their own. In other words, I'm aiming to have similar deployment options as Joel's FogBugz. I'm a Python programmer, and I could fly over th...
Django or CodeIgniter for Turn-Key Web Application
0.26052
0
0
6,522
690,856
2009-03-27T18:05:00.000
3
1
0
0
php,python,django,codeigniter
691,549
3
false
1
0
If you want your application to be mainstream then your almost forced to go with PHP. Going from Django to PHP is alot easier than going from PHP to Django. You know the standards, you just need to learn the PHP syntax and functions. I would definitely use a PHP framework. Symfony and akelos are very similar to Rails (...
3
8
0
I'm going to build a turn-key solution for a vertical market, and would like to offer both options: software as a service, and give them the opportunity to host the application on their own. In other words, I'm aiming to have similar deployment options as Joel's FogBugz. I'm a Python programmer, and I could fly over th...
Django or CodeIgniter for Turn-Key Web Application
0.197375
0
0
6,522
690,856
2009-03-27T18:05:00.000
2
1
0
0
php,python,django,codeigniter
692,907
3
false
1
0
Based on your own conclusions, I would go with CodeIgniter. It seems like there would be a ton of work helping your customers install your web app, and I assume you don't want that. Build a simple-to-install web app so that you can concentrate your efforts on making it better and selling it, instead of working extra as...
3
8
0
I'm going to build a turn-key solution for a vertical market, and would like to offer both options: software as a service, and give them the opportunity to host the application on their own. In other words, I'm aiming to have similar deployment options as Joel's FogBugz. I'm a Python programmer, and I could fly over th...
Django or CodeIgniter for Turn-Key Web Application
0.132549
0
0
6,522
692,259
2009-03-28T05:14:00.000
0
0
1
0
python,animation,image-manipulation
692,396
2
false
0
0
Answer would depend on the platform and game too. e.g. I did once similar things for helicopter flash game, as it was very simple 2d game with well defined colored maze It was on widows with copy to clipboard and win32 key events using win32api bindings for python.
1
0
0
I want to automate playing a video game with Python. I want to write a script that can grab the screen image, diff it with the next frame and track an object to click on. What libraries would be useful for this other than PIL?
How do I track an animated object in Python?
0
0
0
331
693,752
2009-03-28T23:20:00.000
2
0
1
1
python,virtualbox
694,365
1
true
0
0
Consider using libvirt. The VirtualBox support is bleeding-edge (not in any release, may not even be in source control yet, but is available as a set of patches on the mailing list) -- but this single API, available for C, Python and several other languages, lets you control virtual machines and images running in Qemu/...
1
2
0
I want to make some python scripts to create an "Appliance" with VirtualBox. However, I can't find any documentation anywhere on making calls to VBoxService.exe. Well, I've found stuff that works from OUTSIDE the Machine, but nothing from working from inside the machine. Does anyone know anything about this? If there's...
Python module for VBox?
1.2
0
0
1,234
696,792
2009-03-30T11:12:00.000
0
1
1
0
python
697,052
5
false
0
0
I agree with 'create a package'. If you cannot do that, how about using symbolic links/junctions (ln -s on Linux, linkd on Windows)?
2
5
0
Lets say I have projects x and y in brother directories: projects/x and projects/y. There are some utility funcs common to both projects in myutils.py and some db stuff in mydbstuff.py, etc. Those are minor common goodies, so I don't want to create a single package for them. Questions arise about the whereabouts of s...
What is the pythonic way to share common files in multiple projects?
0
0
0
426
696,792
2009-03-30T11:12:00.000
9
1
1
0
python
696,825
5
true
0
0
The pythonic way is to create a single extra package for them. Why don't you want to create a package? You can distribute this package with both projects, and the effect would be the same. You'll never do it right for all instalation scenarios and platforms if you do it by mangling with PYTHONPATH and custom imports. J...
2
5
0
Lets say I have projects x and y in brother directories: projects/x and projects/y. There are some utility funcs common to both projects in myutils.py and some db stuff in mydbstuff.py, etc. Those are minor common goodies, so I don't want to create a single package for them. Questions arise about the whereabouts of s...
What is the pythonic way to share common files in multiple projects?
1.2
0
0
426
697,142
2009-03-30T13:14:00.000
1
0
0
0
python,eclipse,eclipse-plugin,pydev
698,968
2
false
1
0
project properties (right click project in left pane) Go to "run/debug settings", add a new profile. Setup the path and environment etc... you want to launch. The new configuration will show up in your build menu. You could also configure it as an "external tool"
1
14
0
I'm learning Python and Django using the Eclipse Pydev plugin. I want the internal or external browser to launch or refresh with the URL http:/127.0.0.1 when I press Run or Debug. I've seen it done with the PHP plugins but not Pydev.
How do I configure Eclipse to launch a browser when Run or Debug is selected using Pydev plugin
0.099668
0
0
12,436
697,320
2009-03-30T13:58:00.000
5
1
0
0
python,class,introspection
697,405
3
false
1
0
This is the wrong approach for Django and really forcing things. The typical Django app pattern is: /project /appname models.py views.py /templates index.html etc.
1
121
0
Given a class C in Python, how can I determine which file the class was defined in? I need something that can work from either the class C, or from an instance off C. The reason I am doing this, is because I am generally a fan off putting files that belong together in the same folder. I want to create a class that uses...
How do I get the filepath for a class in Python?
0.321513
0
0
56,627
697,594
2009-03-30T15:05:00.000
1
1
0
0
java,python,reporting,birt
716,222
1
false
0
0
What kind of integration are you talking about? If you want to call some BIRT API the I gues it could be done from Jython as Jython can call any Java API. If you don't need to call the BIRT API then you can just get the birt reports with http requests from the BIRT report server (a tomcat application).
1
3
0
Has anyone ever tried that?
How to integrate BIRT with Python
0.197375
0
0
4,155
697,749
2009-03-30T15:40:00.000
0
1
0
0
c++,python,swig
698,089
2
false
0
1
If split properly, the modules don't necessarily need to have the same dependencies as the others - just what's necessary to do compilation. If you break things up appropriately, you can have libraries without cyclic dependencies. The issue with using multiple libraries is that by default, SWIG declares its runtime c...
1
9
0
I hit this issue about two years ago when I first implemented our SWIG bindings. As soon as we exposed a large amount of code we got to the point where SWIG would output C++ files so large the compiler could not handle them. The only way I could get around the issue was to split up the interfaces into multiple module...
Is it possible to split a SWIG module for compilation, but rejoin it when linking?
0
0
0
2,117
697,776
2009-03-30T15:49:00.000
0
0
1
0
python,bash,mp3,m4a
698,252
5
false
1
0
You can just write a simple app with a mapping of each tag name in each format to an "abstract tag" type, and then its easy to convert from one to the other. You don't even have to know all available types - just those that you are interested in. Seems to me like a weekend-project type of time investment, possibly less...
2
14
0
I'm looking for a resource in python or bash that will make it easy to take, for example, mp3 file X and m4a file Y and say "copy X's tags to Y". Python's "mutagen" module is great for manupulating tags in general, but there's no abstract concept of "artist field" that spans different types of tag; I want a library tha...
abstracting the conversion between id3 tags, m4a tags, flac tags
0
0
0
4,835
697,776
2009-03-30T15:49:00.000
0
0
1
0
python,bash,mp3,m4a
740,815
5
false
1
0
There's also tagpy, which seems to work well.
2
14
0
I'm looking for a resource in python or bash that will make it easy to take, for example, mp3 file X and m4a file Y and say "copy X's tags to Y". Python's "mutagen" module is great for manupulating tags in general, but there's no abstract concept of "artist field" that spans different types of tag; I want a library tha...
abstracting the conversion between id3 tags, m4a tags, flac tags
0
0
0
4,835
697,866
2009-03-30T16:11:00.000
10
1
0
0
python,frameworks,seaside
698,677
9
true
1
0
Disclaimer: I really don't like PHP, Python is nice, but doesn't come close to Smalltalk in my book. But I am a biased Smalltalker. Some answers about Seaside/Squeak: Q: Which I guess runs on a squeak app server? Seaside runs in several different Smalltalks (VW, Gemstone, Squeak etc). The term "app server" is not reall...
3
9
0
I know it's kinda subjective but, if you were to put yourself in my shoes which would you invest the time in learning? I want to write a web app which deals securely with relatively modest amounts of peoples private data, a few thousand records of a few Kb each but stuff that needs to be kept safe, addresses, phone num...
Dilemma: Should I learn Seaside or a Python framework?
1.2
0
0
2,399
697,866
2009-03-30T16:11:00.000
6
1
0
0
python,frameworks,seaside
698,940
9
false
1
0
I've been getting into seaside myself but in many ways it is very hard to get started, which has nothing to do with the smalltalk which can be picked up extremely quickly. The challenge is that you are really protected from writing html directly. I find in most frameworks when you get stuck on how to do something th...
3
9
0
I know it's kinda subjective but, if you were to put yourself in my shoes which would you invest the time in learning? I want to write a web app which deals securely with relatively modest amounts of peoples private data, a few thousand records of a few Kb each but stuff that needs to be kept safe, addresses, phone num...
Dilemma: Should I learn Seaside or a Python framework?
1
0
0
2,399
697,866
2009-03-30T16:11:00.000
1
1
0
0
python,frameworks,seaside
697,934
9
false
1
0
I think you've pretty much summed up the pros and cons. Seaside isn't that hard to set up (I've installed it twice for various projects) but using it will definitely affect how you work--in addition to re-learning the language you'll probably have to adjust lots of assumptions about your work flow. It also depends o...
3
9
0
I know it's kinda subjective but, if you were to put yourself in my shoes which would you invest the time in learning? I want to write a web app which deals securely with relatively modest amounts of peoples private data, a few thousand records of a few Kb each but stuff that needs to be kept safe, addresses, phone num...
Dilemma: Should I learn Seaside or a Python framework?
0.022219
0
0
2,399
699,177
2009-03-30T21:50:00.000
0
0
1
0
python
699,187
8
false
0
0
It has to store the length somewhere, so you aren't counting the number of items every time.
3
93
0
If I keep calling len() on a very long list, am I wasting time, or does it keep an int count in the background?
Python: Do Python Lists keep a count for len() or does it count for each call?
0
0
0
19,296
699,177
2009-03-30T21:50:00.000
3
0
1
0
python
699,211
8
false
0
0
A Python "list" is really a resizeable array, not a linked list, so it stores the size somewhere.
3
93
0
If I keep calling len() on a very long list, am I wasting time, or does it keep an int count in the background?
Python: Do Python Lists keep a count for len() or does it count for each call?
0.07486
0
0
19,296
699,177
2009-03-30T21:50:00.000
100
0
1
0
python
699,191
8
true
0
0
Don't worry: Of course it saves the count and thus len() on lists is a pretty cheap operation. Same is true for strings, dictionaries and sets, by the way!
3
93
0
If I keep calling len() on a very long list, am I wasting time, or does it keep an int count in the background?
Python: Do Python Lists keep a count for len() or does it count for each call?
1.2
0
0
19,296
699,325
2009-03-30T22:39:00.000
12
1
0
1
python,redirect
2,728,111
9
false
0
0
If your search engine lead you to this old question (like me), be aware that using PIPE may lead to deadlocks. Indeed, because pipes are buffered, you can write a certain number of bytes in a pipe, even if no one read it. However the size of buffer is finite. And consequently if your program A has an output larger than...
1
45
0
I have a binary named A that generates output when called. If I call it from a Bash shell, most of the output is suppressed by A > /dev/null. All of the output is suppressed by A &> /dev/null I have a python script named B that needs to call A. I want to be able to generate output from B, while suppressing all the outp...
Suppress output in Python calls to executables
1
0
0
42,935
700,073
2009-03-31T05:06:00.000
2
0
1
0
python,multithreading,process,ctypes
700,142
4
true
0
0
There's two parts you'll need to answer here: one if how to communicate between the two processes (your GUI and the process executing the function), and the other is how to change your function so it responds to asynchronous requests ("oh, I've been told to just return whatever I've got"). Working out the answer to the...
3
2
0
I have a python GUI app that uses a long running function from a .so/.dll it calls through ctypes. I'm looking for a way to communicate with the function while it's running in a separate thread or process, so that I can request it to terminate early (which requires some work on the C side before returning a partial res...
communication with long running tasks in python
1.2
0
0
714
700,073
2009-03-31T05:06:00.000
0
0
1
0
python,multithreading,process,ctypes
700,089
4
false
0
0
You said it: signals and pipes. It doesn't have to be too complex, but it will be a heck of a lot easier if you use an existing structure than if you try to roll your own.
3
2
0
I have a python GUI app that uses a long running function from a .so/.dll it calls through ctypes. I'm looking for a way to communicate with the function while it's running in a separate thread or process, so that I can request it to terminate early (which requires some work on the C side before returning a partial res...
communication with long running tasks in python
0
0
0
714
700,073
2009-03-31T05:06:00.000
0
0
1
0
python,multithreading,process,ctypes
700,088
4
false
0
0
If you're on *nix register a signal handler for SIGUSR1 or SIGINT in your C program then from Python use os.kill to send the signal.
3
2
0
I have a python GUI app that uses a long running function from a .so/.dll it calls through ctypes. I'm looking for a way to communicate with the function while it's running in a separate thread or process, so that I can request it to terminate early (which requires some work on the C side before returning a partial res...
communication with long running tasks in python
0
0
0
714
700,350
2009-03-31T07:07:00.000
2
0
0
0
python,pbx,genesys,pabx
700,425
4
true
1
0
If they are providing a C library, you can use ctypes to interact with it.
3
0
0
Genesys is a contact center platform that provides software for working with both hard and soft PBXs. There are also a number of ancillary services they provide to support the wider contact center business. I'm aware of the .NET and Java SDKs that Genesys supply on a first hand basis. Is there SDK support for any other...
What languages provide SDKs for interacting with Genesys services?
1.2
0
0
607
700,350
2009-03-31T07:07:00.000
0
0
0
0
python,pbx,genesys,pabx
4,862,326
4
false
1
0
What do you need to interact with exacly? The GIS provides soap calls for a lot of functions.
3
0
0
Genesys is a contact center platform that provides software for working with both hard and soft PBXs. There are also a number of ancillary services they provide to support the wider contact center business. I'm aware of the .NET and Java SDKs that Genesys supply on a first hand basis. Is there SDK support for any other...
What languages provide SDKs for interacting with Genesys services?
0
0
0
607
700,350
2009-03-31T07:07:00.000
0
0
0
0
python,pbx,genesys,pabx
7,123,654
4
false
1
0
There is neither a native C nor a Python library. Best bet is to use GIS as suggested.
3
0
0
Genesys is a contact center platform that provides software for working with both hard and soft PBXs. There are also a number of ancillary services they provide to support the wider contact center business. I'm aware of the .NET and Java SDKs that Genesys supply on a first hand basis. Is there SDK support for any other...
What languages provide SDKs for interacting with Genesys services?
0
0
0
607
701,802
2009-03-31T16:12:00.000
10
0
1
0
python,string,exec
48,054,410
14
false
0
0
It's worth mentioning, that' exec's brother exist as well called execfile if you want to call a python file. That is sometimes good if you are working in a third party package which have terrible IDE's included and you want to code outside of their package. Example: execfile('/path/to/source.py)' or: exec(open("/path...
3
459
0
How do I execute a string containing Python code in Python?
How do I execute a string containing Python code in Python?
1
0
0
430,791
701,802
2009-03-31T16:12:00.000
22
0
1
0
python,string,exec
17,378,416
14
false
0
0
Remember that from version 3 exec is a function! so always use exec(mystring) instead of exec mystring.
3
459
0
How do I execute a string containing Python code in Python?
How do I execute a string containing Python code in Python?
1
0
0
430,791
701,802
2009-03-31T16:12:00.000
13
0
1
0
python,string,exec
4,278,878
14
false
0
0
eval() is just for expressions, while eval('x+1') works, eval('x=1') won't work for example. In that case, it's better to use exec, or even better: try to find a better solution :)
3
459
0
How do I execute a string containing Python code in Python?
How do I execute a string containing Python code in Python?
1
0
0
430,791
702,861
2009-03-31T20:20:00.000
5
0
0
0
java,python
703,221
2
false
1
0
Of course, Jython allows you to use Java classes from within Python. It's an alternate way of looking at it that would allow much tighter integration of the Java code.
1
15
0
How do I do this?
Executing Java programs through Python
0.462117
0
0
33,606
703,262
2009-03-31T22:03:00.000
0
1
0
0
python,input,binaryfiles
703,588
4
false
0
0
I found that array.fromfile is the fastest methods for homogeneous data.
1
6
1
I have binary files no larger than 20Mb in size that have a header section and then a data section containing sequences of uchars. I have Numpy, SciPy, etc. and each library has different ways of loading in the data. Any suggestions for the most efficient methods I should use?
Most efficient way of loading formatted binary files in Python
0
0
0
450
703,925
2009-04-01T03:11:00.000
1
0
0
1
python,eclipse
10,695,484
4
false
0
0
I know this is a ancient post... but, in case of some newbee like me to get the better answer. I just using "Eclipse Marketplace" from the "Help" menu and search for keyword "python" or "PyDev" to get PyDev, and get it successfully installed. AND, you should add PyDev to the top-right dock. For the instance, my eclipse...
2
11
0
I setup PyDev with this path for the python interpreter /System/Library/Frameworks/Python.framework/Versions/2.5/Python since the one under /usr/bin were alias and Eclipse won't select it. I can run my python script now but cannot run the shell as an external tool. The message I get is variable references empty selecti...
Using pydev with Eclipse on OSX
0.049958
0
0
11,573
703,925
2009-04-01T03:11:00.000
3
0
0
1
python,eclipse
884,296
4
false
0
0
Common practice seems to be to install an up-to-date Python 2.5 from python.org and use that instead of the system installation. I saw that recommended here and there when I got started on Mac OS X. It installs under /Library (as opposed to /System/Library) so the system Python is intact. Pydev has /Library/Frameworks/...
2
11
0
I setup PyDev with this path for the python interpreter /System/Library/Frameworks/Python.framework/Versions/2.5/Python since the one under /usr/bin were alias and Eclipse won't select it. I can run my python script now but cannot run the shell as an external tool. The message I get is variable references empty selecti...
Using pydev with Eclipse on OSX
0.148885
0
0
11,573
704,152
2009-04-01T05:19:00.000
22
0
1
0
python,integer,char,type-conversion
704,157
4
false
0
0
ord and chr
1
395
0
I want to get, given a character, its ASCII value. For example, for the character a, I want to get 97, and vice versa.
How can I convert a character to a integer in Python, and viceversa?
1
0
0
631,220
704,203
2009-04-01T05:44:00.000
0
0
0
1
python,bash,unix,process,kill
704,223
7
false
0
0
One idea: Save the process's PID (returned by fork() in your child process) to a file, then either schedule a cron job to kill it or kill it manually, reading the PID from the file. Another option: Create a shell script wrapper that automatically kills and restarts the process. Same as above, but you can keep the PID i...
1
0
0
I need to run a process, wait a few hours, kill it, and start it again. Is there an easy way that I can accomplish this with Python or Bash? I can run it in the background but how do I identify it to use kill on it?
How do I schedule a process' termination?
0
0
0
2,629
704,526
2009-04-01T08:08:00.000
0
0
1
0
python
704,562
7
false
0
0
With sorted lists a binary search is usually the fastest alghorythm. Could you please provide an example list and an example "missing alphabet"?
1
2
0
I'm trying to find the missing letter in the alphabet from the list with the least lines of code. If the list is sorted already (using list.sort()), what is the fastest or least lines of code to find the missing letter. If I know there are only one missing letter. (This is not any type of interview questions. I actuall...
python: finding a missing letter in the alphabet from a list - least lines of code
0
0
0
8,681
704,834
2009-04-01T09:54:00.000
0
0
0
0
python,django,workflow
704,838
10
false
1
0
I know there is an openerp, but it's not workflow.....
1
19
0
I'm searching for a workflow library/framework for Python. I'm astonished that there I cannot find anything which is simple and not attached to Zope/Plone. Does anyone know of an open-source, simple workflow library/framework. It's preferred to support Django, but not required.
Does anyone know about workflow frameworks/libraries in Python?
0
0
0
15,282
704,945
2009-04-01T10:35:00.000
0
0
0
1
python,chmod
704,953
5
false
0
0
Does it have to be python? You can also use find to do that : "find . -perm 775"
1
3
0
i want a python program that given a directory, it will return all directories within that directory that have 775 (rwxrwxr-x) permissions thanks!
check permissions of directories in python
0
0
0
15,588
706,101
2009-04-01T15:39:00.000
1
1
1
0
python,json,python-2.6
5,541,345
7
false
0
0
Even though _json is available, I've noticed json decoding is very slow on CPython 2.6.6. I haven't compared with other implementations, but I've switched to string manipulation when inside performance-critical loops.
1
45
0
I'm using the json module in Python 2.6 to load and decode JSON files. However I'm currently getting slower than expected performance. I'm using a test case which is 6MB in size and json.loads() is taking 20 seconds. I thought the json module had some native code to speed up the decoding? How do I check if this is bein...
Python 2.6 JSON decoding performance
0.028564
0
0
37,359
707,242
2009-04-01T20:38:00.000
1
0
1
1
python,windows,py2exe
707,261
5
false
0
0
This is not the best way to do it, but you might consider using executable SFX Archive with both the .exe and .dll files inside, and setting it to execute your .exe file when it's double clicked.
2
16
0
is there a way to create a standalone .exe from a python script. Executables generated with py2exe can run only with pythonXX.dll. I'd like to obtain a fully standalone .exe which does not require to install the python runtime library. It looks like a linking problem but using static library instead the dynamic one and...
Create a standalone windows exe which does not require pythonXX.dll
0.039979
0
0
9,499
707,242
2009-04-01T20:38:00.000
5
0
1
1
python,windows,py2exe
707,310
5
false
0
0
Due to how Windows' dynamic linker works you cannot use the static library if you use .pyd or .dll Python modules; DLLs loaded in Windows do not automatically share their symbol space with the executable and so require a separate DLL containing the Python symbols.
2
16
0
is there a way to create a standalone .exe from a python script. Executables generated with py2exe can run only with pythonXX.dll. I'd like to obtain a fully standalone .exe which does not require to install the python runtime library. It looks like a linking problem but using static library instead the dynamic one and...
Create a standalone windows exe which does not require pythonXX.dll
0.197375
0
0
9,499
708,531
2009-04-02T06:35:00.000
0
0
0
0
python,xml,sax
715,813
4
false
1
0
You could load it into Firefox, if you don't have an XML editor. Firefox shows you the error.
3
0
0
I stripped some tags that I thought were unnecessary from an XML file. Now when I try to parse it, my SAX parser throws an error and says my file is not well-formed. However, I know every start tag has an end tag. The file's opening tag has a link to an XML schema. Could this be causing the trouble? If so, then how do ...
Python SAX parser says XML file is not well-formed
0
0
1
2,338
708,531
2009-04-02T06:35:00.000
0
0
0
0
python,xml,sax
711,033
4
false
1
0
I would second recommendation to try to parse it using another XML parser. That should give an indication as to whether it's the document that's wrong, or parser. Also, the actual error message might be useful. One fairly common problem for example is that the xml declaration (if one is used, it's optional) must be the...
3
0
0
I stripped some tags that I thought were unnecessary from an XML file. Now when I try to parse it, my SAX parser throws an error and says my file is not well-formed. However, I know every start tag has an end tag. The file's opening tag has a link to an XML schema. Could this be causing the trouble? If so, then how do ...
Python SAX parser says XML file is not well-formed
0
0
1
2,338
708,531
2009-04-02T06:35:00.000
2
0
0
0
python,xml,sax
708,546
4
false
1
0
I would suggest putting those tags back in and making sure it still works. Then, if you want to take them out, do it one at a time until it breaks. However, I question the wisdom of taking them out. If it's your XML file, you should understand it better. If it's a third-party XML file, you really shouldn't be fiddling ...
3
0
0
I stripped some tags that I thought were unnecessary from an XML file. Now when I try to parse it, my SAX parser throws an error and says my file is not well-formed. However, I know every start tag has an end tag. The file's opening tag has a link to an XML schema. Could this be causing the trouble? If so, then how do ...
Python SAX parser says XML file is not well-formed
0.099668
0
1
2,338
708,762
2009-04-02T08:05:00.000
5
0
0
0
python,sqlalchemy
709,452
4
true
0
0
I don't think (correct me if I'm wrong) INSERT OR REPLACE is in any of the SQL standards; it's an SQLite-specific thing. There is MERGE, but that isn't supported by all dialects either. So it's not available in SQLAlchemy's general dialect. The cleanest solution is to use Session, as suggested by M. Utku. You could ...
1
13
0
does anybody know what is the equivalent to SQL "INSERT OR REPLACE" clause in SQLAlchemy and its SQL expression language? Many thanks -- honzas
SQLAlchemy - INSERT OR REPLACE equivalent
1.2
1
0
20,634
709,397
2009-04-02T11:54:00.000
1
0
1
0
python,xcode,macos
851,810
4
false
0
0
There are no special facilities for working with non-Cocoa Python projects with Xcode. Therefore, you probably just want to create a project with the "Empty Project" template (under "Other") and just drag in your source code. For convenience, you may want to set up an executable in the project. You can do this by ctrl/...
1
6
0
I've got a python project I've been making in terminal with vim etc.. I've read that XCode supports Python development at that it supports SVN (which I am using) but I can't find documentation on how to start a new XCode project from an existing code repository. Other developers are working on the project not using XCo...
Import an existing python project to XCode
0.049958
0
0
9,095
709,490
2009-04-02T12:21:00.000
27
0
1
0
python,conventions,pylint
709,709
3
true
0
0
Somehow some variable names are matched with the regex for constants (const-rgx) instead of the variable name regex (variable-rgx). Are those variables declared on module level? Maybe that's why they are treated as constants (at least that's how they should be declared, according to PEP-8).
1
10
0
I'm trying out pylint to check my source code for conventions. Somehow some variable names are matched with the regex for constants (const-rgx) instead of the variable name regex (variable-rgx). How to match the variable name with variable-rgx? Or should I extend const-rgx with my variable-rgx stuff? e.g. C0103: 31: In...
python code convention using pylint
1.2
0
0
9,144
710,551
2009-04-02T16:40:00.000
43
1
1
0
python,python-import
710,598
21
false
0
0
Both ways are supported for a reason: there are times when one is more appropriate than the other. import module: nice when you are using many bits from the module. drawback is that you'll need to qualify each reference with the module name. from module import ...: nice that imported items are usable directly without ...
6
535
0
I've tried to find a comprehensive guide on whether it is best to use import module or from module import. I've just started with Python and I'm trying to start off with best practices in mind. Basically, I was hoping if anyone could share their experiences, what preferences other developers have and what's the best wa...
Use 'import module' or 'from module import'?
1
0
0
216,208
710,551
2009-04-02T16:40:00.000
4
1
1
0
python,python-import
710,831
21
false
0
0
To add to what people have said about from x import *: besides making it more difficult to tell where names came from, this throws off code checkers like Pylint. They will report those names as undefined variables.
6
535
0
I've tried to find a comprehensive guide on whether it is best to use import module or from module import. I've just started with Python and I'm trying to start off with best practices in mind. Basically, I was hoping if anyone could share their experiences, what preferences other developers have and what's the best wa...
Use 'import module' or 'from module import'?
0.038077
0
0
216,208
710,551
2009-04-02T16:40:00.000
0
1
1
0
python,python-import
34,892,472
21
false
0
0
Import Module - You don't need additional efforts to fetch another thing from module. It has disadvantages such as redundant typing Module Import From - Less typing &More control over which items of a module can be accessed.To use a new item from the module you have to update your import statement.
6
535
0
I've tried to find a comprehensive guide on whether it is best to use import module or from module import. I've just started with Python and I'm trying to start off with best practices in mind. Basically, I was hoping if anyone could share their experiences, what preferences other developers have and what's the best wa...
Use 'import module' or 'from module import'?
0
0
0
216,208
710,551
2009-04-02T16:40:00.000
1
1
1
0
python,python-import
62,796,069
21
false
0
0
since many people answered here but i am just trying my best :) import module is best when you don't know which item you have to import from module. In this way it may be difficult to debug when problem raises because you don't know which item have problem. form module import <foo> is best when you know which item yo...
6
535
0
I've tried to find a comprehensive guide on whether it is best to use import module or from module import. I've just started with Python and I'm trying to start off with best practices in mind. Basically, I was hoping if anyone could share their experiences, what preferences other developers have and what's the best wa...
Use 'import module' or 'from module import'?
0.009524
0
0
216,208
710,551
2009-04-02T16:40:00.000
3
1
1
0
python,python-import
710,861
21
false
0
0
My own answer to this depends mostly on first, how many different modules I'll be using. If i'm only going to use one or two, I'll often use from ... import since it makes for fewer keystrokes in the rest of the file, but if I'm going to make use of many different modules, I prefer just import because that means that ...
6
535
0
I've tried to find a comprehensive guide on whether it is best to use import module or from module import. I've just started with Python and I'm trying to start off with best practices in mind. Basically, I was hoping if anyone could share their experiences, what preferences other developers have and what's the best wa...
Use 'import module' or 'from module import'?
0.028564
0
0
216,208
710,551
2009-04-02T16:40:00.000
575
1
1
0
python,python-import
710,603
21
true
0
0
The difference between import module and from module import foo is mainly subjective. Pick the one you like best and be consistent in your use of it. Here are some points to help you decide. import module Pros: Less maintenance of your import statements. Don't need to add any additional imports to start using anoth...
6
535
0
I've tried to find a comprehensive guide on whether it is best to use import module or from module import. I've just started with Python and I'm trying to start off with best practices in mind. Basically, I was hoping if anyone could share their experiences, what preferences other developers have and what's the best wa...
Use 'import module' or 'from module import'?
1.2
0
0
216,208
710,609
2009-04-02T16:53:00.000
8
1
1
0
python,module,version
710,653
7
true
0
0
I'd stay away from hashing. The version of libxslt being used might contain some type of patch that doesn't effect your use of it. As an alternative, I'd like to suggest that you don't check at run time (don't know if that's a hard requirement or not). For the python stuff I write that has external dependencies (3r...
2
136
0
Many third-party Python modules have an attribute which holds the version information for the module (usually something like module.VERSION or module.__version__), however some do not. Particular examples of such modules are libxslt and libxml2. I need to check that the correct version of these modules are being used a...
Checking a Python module version at runtime
1.2
0
0
83,866
710,609
2009-04-02T16:53:00.000
6
1
1
0
python,module,version
710,642
7
false
0
0
Some ideas: Try checking for functions that exist or don't exist in your needed versions. If there are no function differences, inspect function arguments and signatures. If you can't figure it out from function signatures, set up some stub calls at import time and check their behavior.
2
136
0
Many third-party Python modules have an attribute which holds the version information for the module (usually something like module.VERSION or module.__version__), however some do not. Particular examples of such modules are libxslt and libxml2. I need to check that the correct version of these modules are being used a...
Checking a Python module version at runtime
1
0
0
83,866
711,884
2009-04-02T22:31:00.000
30
0
1
0
python,naming-conventions
712,035
5
false
0
0
I know my solution is not very popular from the pythonic point of view, but I prefer to use the Java approach of one module->one class, with the module named as the class. I do understand the reason behind the python style, but I am not too fond of having a very large file containing a lot of classes. I find it difficu...
1
120
0
I have a module whose purpose is to define a class called "nib". (and a few related classes too.) How should I call the module itself? "nib"? "nibmodule"? Anything else?
Python naming conventions for modules
1
0
0
120,168
712,020
2009-04-02T23:27:00.000
3
1
0
0
python,unit-testing,nose,nosetests
716,408
3
false
0
0
There will be soon: a new --collect switch that produces this behavior was demo'd at PyCon last week. It should be on the trunk "soon" and will be in the 0.11 release. The http://groups.google.com/group/nose-users list is a great resource for nose questions.
1
42
0
I use nosetests to run my unittests and it works well. I want to get a list of all the tests nostests finds without actually running them. Is there a way to do that?
List all Tests Found by Nosetest
0.197375
0
0
9,288
712,113
2009-04-03T00:14:00.000
0
1
0
0
python,escaping,python-module
712,154
1
true
1
0
See lxml, which is based on libxml2. While it's primarily a XML library, HTML support is available.
1
0
0
There is cgi.escape but that appears to be implemented in pure python. It seems like most frameworks like Django also just run some regular expressions. This is something we do a lot, so it would be good to have it be as fast as possible. Maybe C implementations wouldn't be much faster than a series of regexes for th...
Is there a good python module that does HTML encoding/escaping in C?
1.2
0
0
961
712,460
2009-04-03T03:33:00.000
0
0
1
0
python,numeric-ranges
713,040
6
false
0
0
I also had to do something similar for an app lately. If you don't need concrete numbers but just a way to see whether a given number is in the range, you might consider parsing it to a Python expression you can eval into a lambda. For example <3, 5-10, 12 could be func=(lambda x:x<3 or (5 <= x <= 10) or x==12)). Then ...
2
6
0
In a Pylons webapp, I need to take a string such as "<3, 45, 46, 48-51, 77" and create a list of ints (which are actually IDs of objects) to search on. Any suggestions on ways to do this? I'm new to Python, and I haven't found anything out there that helps with this kind of thing. The list would be: [1, 2, 3, 45, 46, ...
Interpreting Number Ranges in Python
0
0
0
5,943
712,460
2009-04-03T03:33:00.000
0
0
1
0
python,numeric-ranges
712,486
6
false
0
0
First, you'll need to figure out what kind of syntax you'll accept. You current have three in your example: Single number: 45, 46 Less than operator Dash ranging: 48-51 After that, it's just a matter of splitting the string into tokens, and checking the format of the token.
2
6
0
In a Pylons webapp, I need to take a string such as "<3, 45, 46, 48-51, 77" and create a list of ints (which are actually IDs of objects) to search on. Any suggestions on ways to do this? I'm new to Python, and I haven't found anything out there that helps with this kind of thing. The list would be: [1, 2, 3, 45, 46, ...
Interpreting Number Ranges in Python
0
0
0
5,943