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
284,741
2008-11-12T17:50:00.000
1
1
0
0
python,http,post,java-me,midlet
284,857
5
false
1
0
Maybe it is a configuration issue? Django can be fronted with Apache by mod_python, WSGI and FastCGI and it can accept file uploads.
2
5
0
I have a j2me client that would post some chunked encoded data to a webserver. I'd like to process the data in python. The script is being run as a CGI one, but apparently apache will refuse a chunked encoded post request to a CGI script. As far as I could see mod_python, WSGI and FastCGI are no go too. I'd like to kno...
Processing chunked encoded HTTP POST requests in python (or generic CGI under apache)
0.039979
0
0
5,471
284,741
2008-11-12T17:50:00.000
2
1
0
0
python,http,post,java-me,midlet
284,869
5
false
1
0
Apache 2.2 mod_cgi works fine for me, Apache transparently unchunks the request as it is passed to the CGI application. WSGI currently disallows chunked requests, and mod_wsgi does indeed block them with a 411 response. It's on the drawing board for WSGI 2.0. But congratulations on finding something that does chunk req...
2
5
0
I have a j2me client that would post some chunked encoded data to a webserver. I'd like to process the data in python. The script is being run as a CGI one, but apparently apache will refuse a chunked encoded post request to a CGI script. As far as I could see mod_python, WSGI and FastCGI are no go too. I'd like to kno...
Processing chunked encoded HTTP POST requests in python (or generic CGI under apache)
0.07983
0
0
5,471
285,132
2008-11-12T19:57:00.000
2
0
1
0
python,user-interface,ide
285,516
9
false
0
0
I'm not really a Pythonista, but I am a Mac user and I appreciate a good, native interface in the apps I write and use. So, if I were to use Python for a GUI app on the Mac, I'd use PyObjC with Interface Builder and Xcode, rather than a cross-platform solution.
1
3
0
Is there any IDE (like VS) with drag and drop support for building python GUI, connecting to dbs etc? Eventhough I am an emacs guy, I find it much easier to create GUI with VS.
With what kind of IDE (if any) you build python GUI projects?
0.044415
0
0
18,625
285,226
2008-11-12T20:28:00.000
2
1
0
0
python,web-services,twitter
285,252
5
false
0
0
Python has a very nice httplib module as well as a url module which together will probably accomplish most of what you need (at least with regards to wget functionality).
1
6
0
Let's say I wanted to make a python script interface with a site like Twitter. What would I use to do that? I'm used to using curl/wget from bash, but Python seems to be much nicer to use. What's the equivalent? (This isn't Python run from a webserver, but run locally via the command line)
What Python tools can I use to interface with a website's API?
0.07983
0
1
839
285,289
2008-11-12T20:43:00.000
3
0
1
0
python,exit-code
285,310
13
false
0
0
Exit codes in many programming languages are up to programmers. So you have to look at your program source code (or manual). Zero usually means "everything went fine".
3
290
0
I got a message saying script xyz.py returned exit code 0. What does this mean? What do the exit codes in Python mean? How many are there? Which ones are important?
Exit codes in Python
0.046121
0
0
634,909
285,289
2008-11-12T20:43:00.000
17
0
1
0
python,exit-code
285,304
13
false
0
0
Exit codes of 0 usually mean, "nothing wrong here." However if the programmer of the script didn't follow convention you may have to consult the source to see what it means. Usually a non-zero value is returned as an error code.
3
290
0
I got a message saying script xyz.py returned exit code 0. What does this mean? What do the exit codes in Python mean? How many are there? Which ones are important?
Exit codes in Python
1
0
0
634,909
285,289
2008-11-12T20:43:00.000
6
0
1
0
python,exit-code
285,306
13
false
0
0
The exit codes only have meaning as assigned by the script author. The Unix tradition is that exit code 0 means 'success', anything else is failure. The only way to be sure what the exit codes for a given script mean is to examine the script itself.
3
290
0
I got a message saying script xyz.py returned exit code 0. What does this mean? What do the exit codes in Python mean? How many are there? Which ones are important?
Exit codes in Python
1
0
0
634,909
287,379
2008-11-13T16:18:00.000
0
0
1
0
python,c++,c,parsing,c-preprocessor
287,393
5
false
0
0
The GCC preprocessor is typicallly a stand-alone program, typically called cpp. That will probably also strip off your comments, of course.
2
4
0
I have a C/C++ source file with conditional compilation. Before I ship it to customers I want to remove most of the #if statements, so that my customers do not need to worry about passing the right -D options to the compiler. I have this implemented and working in Python, but it only handles #ifdef and #ifndef stateme...
Parsing C++ preprocessor #if statements
0
0
0
3,386
287,379
2008-11-13T16:18:00.000
12
0
1
0
python,c++,c,parsing,c-preprocessor
287,405
5
false
0
0
How about just passing through the C preprocessor, and letting that do the job. It will get rid of all of them, so you might need to have a pre-preprocessor step and a post pre-processor step to protect things you don't want to be expanded. Change all #include to @include Pass file through preprocessor Change @includ...
2
4
0
I have a C/C++ source file with conditional compilation. Before I ship it to customers I want to remove most of the #if statements, so that my customers do not need to worry about passing the right -D options to the compiler. I have this implemented and working in Python, but it only handles #ifdef and #ifndef stateme...
Parsing C++ preprocessor #if statements
1
0
0
3,386
288,546
2008-11-13T22:19:00.000
1
1
0
0
python,email,connection,exchange-server,pywin32
288,569
4
true
0
0
I'm pretty sure this is going to be impossible without using Outlook and a MAPI profile. If you can sweet talk your mail admin into enabling IMAP on the Exchange server it would make your life a lot easier.
1
26
0
I need to connect to an Exchange mailbox in a Python script, without using any profile setup on the local machine (including using Outlook). If I use win32com to create a MAPI.Session I could logon (with the Logon() method) with an existing profile, but I want to just provide a username & password. Is this possible? ...
Connect to Exchange mailbox with Python
1.2
0
1
107,535
288,695
2008-11-13T23:06:00.000
1
0
1
0
python,inheritance,oop
288,884
6
false
0
0
You should be fairly safe inheriting from a "builtin" class, as later modifications to these classes will usually be compatible with the current version. However, you should think seriously about wether you really want to tie your class to the additional functionality provided by the builtin class. As mentioned in ano...
4
6
0
I want to parse an Apache access.log file with a python program in a certain way, and though I am completely new to object-oriented programming, I want to start doing it now. I am going to create a class ApacheAccessLog, and the only thing I can imagine now, it will be doing is 'readline' method. Is it conventionally c...
Is it correct to inherit from built-in classes?
0.033321
0
0
1,007
288,695
2008-11-13T23:06:00.000
1
0
1
0
python,inheritance,oop
288,783
6
false
0
0
Although it is in some cases useful to inherit from builtins, the real question here is what you want to do with the output and what's your big-picture design. I would usually write a reader (that uses a file object) and spit out whatever data class I need to hold the information I just read. It's then easy to design t...
4
6
0
I want to parse an Apache access.log file with a python program in a certain way, and though I am completely new to object-oriented programming, I want to start doing it now. I am going to create a class ApacheAccessLog, and the only thing I can imagine now, it will be doing is 'readline' method. Is it conventionally c...
Is it correct to inherit from built-in classes?
0.033321
0
0
1,007
288,695
2008-11-13T23:06:00.000
15
0
1
0
python,inheritance,oop
288,807
6
true
0
0
In this case I would use delegation rather than inheritance. It means that your class should contain the file object as an attribute and invoke a readline method on it. You could pass a file object in the constructor of the logger class. There are at least two reasons for this: Delegation reduces coupling, for example...
4
6
0
I want to parse an Apache access.log file with a python program in a certain way, and though I am completely new to object-oriented programming, I want to start doing it now. I am going to create a class ApacheAccessLog, and the only thing I can imagine now, it will be doing is 'readline' method. Is it conventionally c...
Is it correct to inherit from built-in classes?
1.2
0
0
1,007
288,695
2008-11-13T23:06:00.000
1
0
1
0
python,inheritance,oop
288,778
6
false
0
0
It is perfectly acceptable to inherit from a built in class. In this case I'd say you're right on the money. The log "is a" file so that tells you inheritance is ok.. General rule. Dog "is a"n animal, therefore inherit from animal. Owner "has a"n animal therefore don't inherit from animal.
4
6
0
I want to parse an Apache access.log file with a python program in a certain way, and though I am completely new to object-oriented programming, I want to start doing it now. I am going to create a class ApacheAccessLog, and the only thing I can imagine now, it will be doing is 'readline' method. Is it conventionally c...
Is it correct to inherit from built-in classes?
0.033321
0
0
1,007
291,448
2008-11-14T21:11:00.000
25
0
1
0
python
291,470
4
true
0
0
That's certainly possible. After the script is loaded/imported, the Python interpreter won't access it anymore, except when printing source line in a exception stack trace. Any pyc file will be regenerated the next time as the source file is newer than the pyc.
2
18
0
Is it possible for a python script to open its own source file and overwrite it? The idea was to have a very simple and very dirty way for a python script to download an update of itself so that the next time it is run it would be an updated version.
Is it possible for a running python program to overwrite itself?
1.2
0
0
6,179
291,448
2008-11-14T21:11:00.000
8
0
1
0
python
291,650
4
false
0
0
Actually, it's preferable that your application starts with a dummy checker-downloader that changes rarely (if ever); before running, it should check if any updates are available; if yes, then it would download them (typically the rest of the app would be modules) and then import them and start the app. This way, as so...
2
18
0
Is it possible for a python script to open its own source file and overwrite it? The idea was to have a very simple and very dirty way for a python script to download an update of itself so that the next time it is run it would be an updated version.
Is it possible for a running python program to overwrite itself?
1
0
0
6,179
291,467
2008-11-14T21:16:00.000
2
1
0
1
python,svn,file
291,477
1
true
0
0
I think it is easiest to check out (or, better, export) the source tree using the svn command line utility: you can use os.system to invoke it. There are also direct Python-to-svn API bindings, but I would advise against using them if you are new to Python. You can then traverse the checkout folder, e.g. using os.walk;...
1
2
0
I would like my python script to search through a directory in SVN, locate the files ending with a particular extension (eg. *.exe), and copy these files to a directory that has been created in my C drive. How can I do this? I'm new to Python so a detailed response and/or point in the right direction would be very much...
Search directory in SVN for files with specific file extension and copy to another folder?
1.2
0
0
1,000
291,740
2008-11-14T23:12:00.000
43
0
1
0
python,text-files
2,203,797
16
false
0
0
linux has a split command split -l 100000 file.txt would split into files of equal 100,000 line size
2
32
0
I have a huge text file (~1GB) and sadly the text editor I use won't read such a large file. However, if I can just split it into two or three parts I'll be fine, so, as an exercise I wanted to write a program in python to do it. What I think I want the program to do is to find the size of a file, divide that number...
How do I split a huge text file in python
1
0
0
96,451
291,740
2008-11-14T23:12:00.000
16
0
1
0
python,text-files
291,759
16
true
0
0
Check out os.stat() for file size and file.readlines([sizehint]). Those two functions should be all you need for the reading part, and hopefully you know how to do the writing :)
2
32
0
I have a huge text file (~1GB) and sadly the text editor I use won't read such a large file. However, if I can just split it into two or three parts I'll be fine, so, as an exercise I wanted to write a program in python to do it. What I think I want the program to do is to find the size of a file, divide that number...
How do I split a huge text file in python
1.2
0
0
96,451
294,470
2008-11-16T22:11:00.000
5
1
0
1
python,linux,unix,process-management
294,535
2
false
0
0
Never directly scan /etc/passwd. For instance, on a Linux system I administer, the user accounts are not on /etc/passwd, but on a LDAP server. The correct way is to use getpwent/getgrent and related C functions (as in @TFKyle's answer), which will get the information on the correct way for each system (on Linux glibc, ...
1
12
0
I need to set my process to run under 'nobody', I've found os.setuid(), but how do I find uid if I have login? I've found out that uids are in /etc/passwd, but maybe there is a more pythonic way than scanning /etc/passwd. Anybody?
How do I find userid by login (Python under *NIX)
0.462117
0
0
4,216
294,963
2008-11-17T05:44:00.000
2
1
1
0
python,performance,multithreading,internals
297,747
3
false
0
0
Reasoning about a system of this complexity will rarely produce the right answer. Measure the results, and use the setting that runs the fastest. If as you say, testing can't measure the difference in various settings of setcheckinterval, then why bother changing it? Only measurable differences are interesting. If...
1
1
0
I have a port scanning application that uses work queues and threads. It uses simple TCP connections and spends a lot of time waiting for packets to come back (up to half a second). Thus the threads don't need to fully execute (i.e. first half sends a packet, context switch, does stuff, comes back to thread which has n...
How do I count bytecodes in Python so I can modify sys.setcheckinterval appropriately
0.132549
0
0
728
295,135
2008-11-17T09:02:00.000
6
0
1
0
python,filenames,slug,sanitize
634,023
26
false
0
0
Though you have to be careful. It is not clearly said in your intro, if you are looking only at latine language. Some words can become meaningless or another meaning if you sanitize them with ascii characters only. imagine you have "forêt poésie" (forest poetry), your sanitization might give "fort-posie" (strong + some...
3
379
0
I have a string that I want to use as a filename, so I want to remove all characters that wouldn't be allowed in filenames, using Python. I'd rather be strict than otherwise, so let's say I want to retain only letters, digits, and a small set of other characters like "_-.() ". What's the most elegant solution? The file...
Turn a string into a valid filename?
1
0
0
230,947
295,135
2008-11-17T09:02:00.000
15
0
1
0
python,filenames,slug,sanitize
295,298
26
false
0
0
Keep in mind, there are actually no restrictions on filenames on Unix systems other than It may not contain \0 It may not contain / Everything else is fair game. $ touch " > even multiline > haha > ^[[31m red ^[[0m > evil" $ ls -la -rw-r--r-- 0 Nov 17 23:39 ?even multiline?haha??[31m red ?[0m?evil $ ls -l...
3
379
0
I have a string that I want to use as a filename, so I want to remove all characters that wouldn't be allowed in filenames, using Python. I'd rather be strict than otherwise, so let's say I want to retain only letters, digits, and a small set of other characters like "_-.() ". What's the most elegant solution? The file...
Turn a string into a valid filename?
1
0
0
230,947
295,135
2008-11-17T09:02:00.000
6
0
1
0
python,filenames,slug,sanitize
295,354
26
false
0
0
Why not just wrap the "osopen" with a try/except and let the underlying OS sort out whether the file is valid? This seems like much less work and is valid no matter which OS you use.
3
379
0
I have a string that I want to use as a filename, so I want to remove all characters that wouldn't be allowed in filenames, using Python. I'd rather be strict than otherwise, so let's say I want to retain only letters, digits, and a small set of other characters like "_-.() ". What's the most elegant solution? The file...
Turn a string into a valid filename?
1
0
0
230,947
295,670
2008-11-17T14:24:00.000
0
0
1
0
c#,python,oop,programming-languages
296,801
8
false
0
0
Python also has meta classes but that is more like a template class than a partial class. A good example of meta class usage is the Django ORM. All of your table models inherit from a base model class which also gets functionality included from a meta class. It is a pretty cool concept that enables an active record ...
3
8
0
What is and how can it be used in C#. Can you use the same concept in Python/Perl?
What is a partial class?
0
0
0
2,258
295,670
2008-11-17T14:24:00.000
1
0
1
0
c#,python,oop,programming-languages
295,704
8
false
0
0
Because python is a dynamic language you don't need a concept like partial class. In python is possible to extend object with functionality in runtime so it possible to break class declaration into different files
3
8
0
What is and how can it be used in C#. Can you use the same concept in Python/Perl?
What is a partial class?
0.024995
0
0
2,258
295,670
2008-11-17T14:24:00.000
0
0
1
0
c#,python,oop,programming-languages
295,735
8
false
0
0
A Partial type is a type whose declaration is separated across multiple files. It makes sense to use them if you have a big class, which is hard to handle and read for a typical developer, to separate that class definition in separate files and to put in each file a logically separated section of code (for instance all...
3
8
0
What is and how can it be used in C#. Can you use the same concept in Python/Perl?
What is a partial class?
0
0
0
2,258
296,490
2008-11-17T18:56:00.000
0
0
1
0
python,file
296,498
3
false
0
0
It is perfectly acceptable to have a 'cleanup()' function that you call at the end of your script, which will call 'os.remove()' on your files.
1
0
0
I would like to remove two files from a folder at the conclusion of my script. Do I need to create a function responsible for removing these two specific files? I would like to know in some detail how to use os.remove (if that is what I should use) properly. These two files will always be discarded at the conclusion of...
How do I remove a specific number of files using python (version 2.5)?
0
0
0
355
296,650
2008-11-17T19:48:00.000
8
1
0
1
java,python,performance,protocol-buffers,thrift
628,329
8
false
0
0
I did test performance of PB with number of other data formats (xml, json, default object serialization, hessian, one proprietary one) and libraries (jaxb, fast infoset, hand-written) for data binding task (both reading and writing), but thrift's format(s) was not included. Performance for formats with multiple convert...
3
70
0
We're looking into transport/protocol solutions and were about to do various performance tests, so I thought I'd check with the community if they've already done this: Has anyone done server performance tests for simple echo services as well as serialization/deserialization for various messages sizes comparing EJB3, Th...
Performance comparison of Thrift, Protocol Buffers, JSON, EJB, other?
1
0
0
64,229
296,650
2008-11-17T19:48:00.000
5
1
0
1
java,python,performance,protocol-buffers,thrift
297,193
8
false
0
0
If the raw net performance is the target, then nothing beats IIOP (see RMI/IIOP). Smallest possible footprint -- only binary data, no markup at all. Serialization/deserialization is very fast too. Since it's IIOP (that is CORBA), almost all languages have bindings. But I presume the performance is not the only requirem...
3
70
0
We're looking into transport/protocol solutions and were about to do various performance tests, so I thought I'd check with the community if they've already done this: Has anyone done server performance tests for simple echo services as well as serialization/deserialization for various messages sizes comparing EJB3, Th...
Performance comparison of Thrift, Protocol Buffers, JSON, EJB, other?
0.124353
0
0
64,229
296,650
2008-11-17T19:48:00.000
4
1
0
1
java,python,performance,protocol-buffers,thrift
296,677
8
false
0
0
One of the things near the top of my "to-do" list for PBs is to port Google's internal Protocol Buffer performance benchmark - it's mostly a case of taking confidential message formats and turning them into entirely bland ones, and then doing the same for the data. When that's been done, I'd imagine you could build the...
3
70
0
We're looking into transport/protocol solutions and were about to do various performance tests, so I thought I'd check with the community if they've already done this: Has anyone done server performance tests for simple echo services as well as serialization/deserialization for various messages sizes comparing EJB3, Th...
Performance comparison of Thrift, Protocol Buffers, JSON, EJB, other?
0.099668
0
0
64,229
297,345
2008-11-17T23:27:00.000
1
1
1
0
python,zip
297,444
10
false
0
0
Some (many? most?) compression algorithms are based on looking at redundancies across the entire file. Some compression libraries will choose between several compression algorithms based on which works best on the file. I believe the ZipFile module does this, so it wants to see the entire file, not just pieces at a ti...
1
23
0
I've got a large amount of data (a couple gigs) I need to write to a zip file in Python. I can't load it all into memory at once to pass to the .writestr method of ZipFile, and I really don't want to feed it all out to disk using temporary files and then read it back. Is there a way to feed a generator or a file-like ...
Create a zip file from a generator in Python?
0.019997
0
0
14,983
298,004
2008-11-18T06:32:00.000
1
0
1
1
java,python,jython,archive
298,027
2
false
1
0
You can use java.util.zip, when I was using Jython the built in zip library in python didn't work
1
1
0
Is there a neat archiving library that automatically handles archiving a folder or directories for you out there? I am using Jython, so Java libs are also open for use. -UPDATE- Also Im looking for timestamp archiving. ie archive-dir/2008/11/16/zipfilebypreference.zip then the next day call it again and it creates ano...
python (jython) archiving library
0.099668
0
0
256
298,772
2008-11-18T13:52:00.000
8
0
0
0
javascript,python,django,google-app-engine,django-templates
304,627
16
false
1
0
For a dictionary, you're best of encoding to JSON first. You can use simplejson.dumps() or if you want to convert from a data model in App Engine, you could use encode() from the GQLEncoder library.
1
276
0
When I render a page using the Django template renderer, I can pass in a dictionary variable containing various values to manipulate them in the page using {{ myVar }}. Is there a way to access the same variable in Javascript (perhaps using the DOM, I don't know how Django makes the variables accessible)? I want to be ...
Django Template Variables and Javascript
1
0
0
309,660
299,249
2008-11-18T16:22:00.000
1
1
0
1
python
299,262
2
false
0
0
In general: Use os.chdir to change the directory of the parent process, then os.system to run the jar file. If you need to keep Python's working directory stable, you need to chdir back to original working directory - you need to record that with os.getcwd(). On Unix: Create a child process with os.fork explicitly. In ...
1
5
0
I am familiar with using the os.system to run from the command line. However, I would like to be able to run a jar file from inside of a specific folder, eg. my 'test' folder. This is because my jar (located in my 'test' folder) requires a file inside of my 'test' folder. So, how would I write a function in my script t...
How can I get my python (version 2.5) script to run a jar file inside a folder instead of from command line?
0.099668
0
0
8,648
299,704
2008-11-18T18:39:00.000
0
0
1
0
python,debugging
2,537,067
16
false
0
0
Eric4 IDE also has a great built-in debugger.
6
53
0
I'm getting quite a few errors in my code. Consequently, I would like to be able to minimize them at the outset or see as many errors as possible before code execution. Is this possible and if so, how can I do this?
What are good ways to make my Python code run first time?
0
0
0
28,130
299,704
2008-11-18T18:39:00.000
4
0
1
0
python,debugging
300,397
16
false
0
0
The PyDev plugin for eclipse is my tool of choice. It recognizes simple syntax mistakes and indentation errors and underlines the error with a red line. It has a powerful debugger and even has a plugin called PyLint which warns you about dangerous code. Edit: It also has a user friendly stack trace on runtime errors, p...
6
53
0
I'm getting quite a few errors in my code. Consequently, I would like to be able to minimize them at the outset or see as many errors as possible before code execution. Is this possible and if so, how can I do this?
What are good ways to make my Python code run first time?
0.049958
0
0
28,130
299,704
2008-11-18T18:39:00.000
5
0
1
0
python,debugging
299,732
16
false
0
0
Using assert statement liberally.
6
53
0
I'm getting quite a few errors in my code. Consequently, I would like to be able to minimize them at the outset or see as many errors as possible before code execution. Is this possible and if so, how can I do this?
What are good ways to make my Python code run first time?
0.062419
0
0
28,130
299,704
2008-11-18T18:39:00.000
7
0
1
0
python,debugging
299,727
16
false
0
0
Test early and test often. This doesn't necessarily mean to jump into the test driven design pool head first (though that's not such a bad idea). It just means, test your objects and methods as soon as you have something that works. Don't wait until you have a huge pile of code before doing testing. Invest some time i...
6
53
0
I'm getting quite a few errors in my code. Consequently, I would like to be able to minimize them at the outset or see as many errors as possible before code execution. Is this possible and if so, how can I do this?
What are good ways to make my Python code run first time?
1
0
0
28,130
299,704
2008-11-18T18:39:00.000
15
0
1
0
python,debugging
299,753
16
false
0
0
All the really cool stuff is easily demonstrated in the interactive interpreter. I think this might be the "gold standard" for good design: Can you exercise your class interactively? If you can do stuff interactively, then you can write unittests and doctests with confidence that it's testable, simple, reliable. And, ...
6
53
0
I'm getting quite a few errors in my code. Consequently, I would like to be able to minimize them at the outset or see as many errors as possible before code execution. Is this possible and if so, how can I do this?
What are good ways to make my Python code run first time?
1
0
0
28,130
299,704
2008-11-18T18:39:00.000
10
0
1
0
python,debugging
4,643,720
16
false
0
0
I am new to python, and have been trying several different debuggers. Here are the options I've come across so far: Eclipse with Pydev - If you're already using eclipse, this is probably the way to go. The debugger works well, and is pretty featureful. Komodo IDE - A light-weight python IDE. Basically a text editor + ...
6
53
0
I'm getting quite a few errors in my code. Consequently, I would like to be able to minimize them at the outset or see as many errors as possible before code execution. Is this possible and if so, how can I do this?
What are good ways to make my Python code run first time?
1
0
0
28,130
299,913
2008-11-18T19:51:00.000
4
1
0
0
java,php,python,dynamic-linking
300,035
2
true
1
0
"where I just can't figure out what model I need to produce the HTML form I want, which seems such a basic thing that I fear for my chances of doing anything more complex" Common problem. Root cause: Too much programming. Solution. Do less programming. Seriously. Define the Django model. Use the default admin page...
1
3
0
I've been trying to build a simple prototype application in Django, and am reaching the point of giving up, sadly, as it's just too complicated (I know it would be worth it in the long-run, but I really just don't have enough time available -- I need something up and running in a few days). So, I'm now thinking of goin...
Calling Java (or python or perl) from a PHP script
1.2
0
0
1,939
301,493
2008-11-19T10:35:00.000
2
1
0
0
java,.net,python,xml,ruby
301,538
9
false
1
0
either C# or VB.Net using LiNQ to XML. LiNQ to XML is very very powerful and easy to implement
1
21
0
We have developers with knowledge of these languages - Ruby , Python, .Net or Java. We are developing an application which will mainly handle XML documents. Most of the work is to convert predefined XML files into database tables, providing mapping between XML documents through database, creating reports from database ...
Which language is easiest and fastest to work with XML content?
0.044415
0
1
18,193
301,566
2008-11-19T11:00:00.000
1
0
0
0
python,database,postgresql,data-migration,turbogears
301,708
4
true
1
0
This always works and requires little thinking -- only patience. Make a backup. Actually make a backup. Everyone skips step 1 thinking that they have a backup, but they can never find it or work with it. Don't trust any backup that you can't recover from. Create a new database schema. Define your new structure from ...
1
1
0
I am having a postgres production database in production (which contains a lot of Data). now I need to modify the model of the tg-app to add couple of new tables to the database. How do i do this? I am using sqlAlchemy.
How to update turbogears application production database
1.2
1
0
889
302,163
2008-11-19T15:08:00.000
2
0
0
1
python,gnome
302,168
2
true
0
0
Check out the Deskbar source code - they do this; afaik, they call out a C library that interacts with X11 to do the job
1
6
0
I would like to assign a global hotkey to my Python application, running in Gnome. How do I do that? All I can find are two year old posts saying, well, pretty much nothing :-)
Global hotkey for Python application in Gnome
1.2
0
0
1,770
302,983
2008-11-19T19:04:00.000
25
0
0
0
python,django,content-management-system
3,892,818
7
true
1
0
I have worked with all three (and more) and they are all built for different use cases IMHO. I would agree that these are the top-teir choices. The grid comparison at djangopluggables.com certainly can make evaluating each of these easier. django-cms is the most full-featured and is something you could actually hand ov...
1
14
0
So I have a relatively large (enough code that it would be easier to write this CMS component from scratch than to rewrite the app to fit into a CMS) webapp that I want to add basic Page/Menu/Media management too, I've seen several Django pluggables addressing this issue, but many seem targeted as full CMS platforms. ...
Best Django 'CMS' component for integration into existing site
1.2
0
0
12,696
303,200
2008-11-19T20:15:00.000
1
0
0
1
python,file
55,308,643
20
false
0
0
For Windows, if directory is not empty, and you have read-only files or you get errors like Access is denied The process cannot access the file because it is being used by another process Try this, os.system('rmdir /S /Q "{}"'.format(directory)) It's equivalent for rm -rf in Linux/Mac.
1
1,021
0
I am getting an 'access is denied' error when I attempt to delete a folder that is not empty. I used the following command in my attempt: os.remove("/folder_name"). What is the most effective way of removing/deleting a folder/directory that is not empty?
How do I remove/delete a folder that is not empty?
0.01
0
0
854,907
304,049
2008-11-20T01:12:00.000
0
1
1
0
python,emacs,ipython,emacs23
492,173
3
false
0
0
I've used ipython with emacs cvs (which has been emacs 23 for some time now) in my python development. I, however, use it the other way around: I call emacs from the ipython promt through the $EDITOR environment variable. I tried it the other way around, but got a bit tired of all the process buffers and what not. Emac...
1
24
0
Is there anyone out there using iPython with emacs 23? The documents on the emacs wiki are a bit of a muddle and I would be interested in hearing from anyone using emacs for Python development. Do you use the download python-mode and ipython.el? What do you recommend?
Emacs 23 and iPython
0
0
0
13,374
304,117
2008-11-20T01:56:00.000
7
0
0
0
python,google-app-engine,data-modeling
307,727
4
true
1
0
Thanks to both of you for your suggestions. I've implemented (first iteration) as follows. Not sure if it's the best approach, but it's working. Class A = Articles. Has a StringListProperty which can be queried on it's list elements Class B = Tags. One entity per tag, also keeps a running count of the total number ...
2
8
0
Am wondering if anyone might provide some conceptual advice on an efficient way to build a data model to accomplish the simple system described below. Am somewhat new to thinking in a non-relational manner and want to try avoiding any obvious pitfalls. It's my understanding that a basic principal is that "storage is ...
Data Modelling Advice for Blog Tagging system on Google App Engine
1.2
0
0
3,133
304,117
2008-11-20T01:56:00.000
1
0
0
0
python,google-app-engine,data-modeling
304,170
4
false
1
0
Many-to-many sounds reasonable. Perhaps you should try it first to see if it is actually expensive. Good thing about G.A.E. is that it will tell you when you are using too many cycles. Profiling for free!
2
8
0
Am wondering if anyone might provide some conceptual advice on an efficient way to build a data model to accomplish the simple system described below. Am somewhat new to thinking in a non-relational manner and want to try avoiding any obvious pitfalls. It's my understanding that a basic principal is that "storage is ...
Data Modelling Advice for Blog Tagging system on Google App Engine
0.049958
0
0
3,133
304,216
2008-11-20T03:06:00.000
1
0
0
0
python,xml,search,celementtree
304,221
2
false
0
0
Have you looked at node.getiterator()?
1
2
0
Is there a way to find all nodes in a xml tree using cElementTree? The findall method works only for specified tags.
Find all nodes from an XML using cElementTree
0.099668
0
1
1,525
304,883
2008-11-20T10:27:00.000
4
0
0
1
python,linux,file-permissions
48,661,346
8
false
0
0
If one want to make executable hello.py first find the path where python is in your os with : which python it usually resides under "/usr/bin/python" folder. at the very first line of hello.py one should add : #!/usr/bin/python then through linux command chmod one should just make it executable like : chmod +x hello.p...
2
105
0
I just installed a linux system (Kubuntu) and was wondering if there is a program to make python programs executable for linux.
What do I use on linux to make a python program executable
0.099668
0
0
222,482
304,883
2008-11-20T10:27:00.000
1
0
0
1
python,linux,file-permissions
56,267,080
8
false
0
0
I do the following: put #! /usr/bin/env python3 at top of script chmod u+x file.py Change .py to .command in file name This essentially turns the file into a bash executable. When you double-click it, it should run. This works in Unix-based systems.
2
105
0
I just installed a linux system (Kubuntu) and was wondering if there is a program to make python programs executable for linux.
What do I use on linux to make a python program executable
0.024995
0
0
222,482
305,359
2008-11-20T13:52:00.000
2
0
1
0
python,types,sequences
312,368
12
false
0
0
I'm new here so I don't know what's the correct way to do it. I want to answer my answers: The problem with all of the above mentioned ways is that str is considered a sequence (it's iterable, has __getitem__, etc.) yet it's usually treated as a single item. For example, a function may accept an argument that can eithe...
2
18
0
I want to write a function that accepts a parameter which can be either a sequence or a single value. The type of value is str, int, etc., but I don't want it to be restricted to a hardcoded list. In other words, I want to know if the parameter X is a sequence or something I have to convert to a sequence to avoid spec...
Correct way to detect sequence parameter?
0.033321
0
0
5,050
305,359
2008-11-20T13:52:00.000
3
0
1
0
python,types,sequences
305,526
12
false
0
0
In cases like this, I prefer to just always take the sequence type or always take the scalar. Strings won't be the only types that would behave poorly in this setup; rather, any type that has an aggregate use and allows iteration over its parts might misbehave.
2
18
0
I want to write a function that accepts a parameter which can be either a sequence or a single value. The type of value is str, int, etc., but I don't want it to be restricted to a hardcoded list. In other words, I want to know if the parameter X is a sequence or something I have to convert to a sequence to avoid spec...
Correct way to detect sequence parameter?
0.049958
0
0
5,050
305,647
2008-11-20T15:28:00.000
0
0
1
1
python,windows
305,679
7
false
0
0
Does the app have any preferences, settings or options that the user can specify? If so, add an option where the user can specify the location of the data, with a default of the current Windows temp directory. There's always a chance they may not have enough space on the drive with the temp directory, and would need to...
1
3
0
My application caches some data on disk. Because the cache may be large, it should not be stored on a network drive. It should persist between invocations of the application. I have a mechanism for the user to choose a location, but would like the default to be sensible and "the right thing" for the platform. What i...
Appropriate location for my application's cache on Windows
0
0
0
955
306,456
2008-11-20T19:02:00.000
0
0
0
1
python,gtk,pygtk
306,866
2
false
0
1
The panel you are referring to is the GNOME panel. So this is a GNOME question, not a GTK question. There is not a well-defined concept of "multi-window application" in GNOME that I know of. The panel task list is probably build by querying the window manager for the list of windows and grouping the windows by their "c...
2
2
0
How can I get a list of the running applications? I'm referring to the ones in the panel at the bottom of the screen.
How can I get a list of the running applications with GTK?
0
0
0
368
306,456
2008-11-20T19:02:00.000
3
0
0
1
python,gtk,pygtk
307,046
2
true
0
1
I believe what you are looking for is libwnck
2
2
0
How can I get a list of the running applications? I'm referring to the ones in the panel at the bottom of the screen.
How can I get a list of the running applications with GTK?
1.2
0
0
368
306,811
2008-11-20T20:47:00.000
2
1
0
0
python,file,zip
307,091
1
true
0
0
Whatever you pass as zip_file to your function will be the file that the ZipFile object will write to. So if you pass it a full path, then it will be put there. If you pass it just a filename, then it will be written to that filename under the current working path. It sounds like you just need to make sure that zip_fil...
1
1
0
I have been able to zip the contents of my folder. But I would like the zipped file to remain in the folder that was just compressed. For example, I've zipped a folder called test in my C: drive. But I would like my "test.zip" file to be contained in C:\test. How can I do this? Thanks in advance. clarification of quest...
With Python, how can I ensure that compression of a folder takes place within a particular folder?
1.2
0
0
228
307,305
2008-11-20T23:40:00.000
2
1
1
0
python,audio,platform-independent
1,852,392
10
false
0
0
wxPython has support for playing wav files on Windows and Unix - I am not sure if this includes Macs. However it only support wav files as far as I can tell - it does not support other common formats such as mp3 or ogg.
1
111
0
What's the easiest way to play a sound file (.wav) in Python? By easiest I mean both most platform independent and requiring the least dependencies. pygame is certainly an option, but it seems overkill for just sound.
Play a Sound with Python
0.039979
0
0
468,055
308,254
2008-11-21T09:26:00.000
1
0
1
0
python,ipython
45,552,382
5
false
0
0
I find the simplest way to specify which python version to use is to explicitly call the ipython script using that version. To do this, you may need to know the path to the ipython script, which you can find by running which ipython. Then simply run python <path-to-ipython> to start ipython.
1
10
0
I am running an Ubuntu 8.10, using Python 2.5 out of the box. This is fine from the system point of view, but I need Python2.4 since I dev on Zope / Plone. Well, installing python2.4 is no challenge, but I can't find a (clean) way to make iPython use it : no option in the man nor in the config file. Before, there was a...
How to force iPython to use an older version of Python?
0.039979
0
0
9,837
308,605
2008-11-21T12:24:00.000
59
0
0
0
python,django,apache,rest
308,785
11
true
1
0
I'm thinking of falling back to simply writing view functions in Django that return JSON results. Explicit Portable to other frameworks Doesn't require patching Django
6
51
0
I've got a Django application that works nicely. I'm adding REST services. I'm looking for some additional input on my REST strategy. Here are some examples of things I'm wringing my hands over. Right now, I'm using the Django-REST API with a pile of patches. I'm thinking of falling back to simply writing view f...
Adding REST to Django
1.2
0
0
28,236
308,605
2008-11-21T12:24:00.000
4
0
0
0
python,django,apache,rest
308,885
11
false
1
0
Scrap the Django REST api and come up with your own open source project that others can contribute to. I would be willing to contribute. I have some code that is based on the forms api to do REST.
6
51
0
I've got a Django application that works nicely. I'm adding REST services. I'm looking for some additional input on my REST strategy. Here are some examples of things I'm wringing my hands over. Right now, I'm using the Django-REST API with a pile of patches. I'm thinking of falling back to simply writing view f...
Adding REST to Django
0.072599
0
0
28,236
308,605
2008-11-21T12:24:00.000
1
0
0
0
python,django,apache,rest
9,027,830
11
false
1
0
TastyPie looks quite interesting and promising. It goes well with Django.
6
51
0
I've got a Django application that works nicely. I'm adding REST services. I'm looking for some additional input on my REST strategy. Here are some examples of things I'm wringing my hands over. Right now, I'm using the Django-REST API with a pile of patches. I'm thinking of falling back to simply writing view f...
Adding REST to Django
0.01818
0
0
28,236
308,605
2008-11-21T12:24:00.000
1
0
0
0
python,django,apache,rest
736,425
11
false
1
0
you could try making a generic functions that process the data (like parand mentioned) which you can call from the views that generate the web pages, as well as those that generate the json/xml/whatever
6
51
0
I've got a Django application that works nicely. I'm adding REST services. I'm looking for some additional input on my REST strategy. Here are some examples of things I'm wringing my hands over. Right now, I'm using the Django-REST API with a pile of patches. I'm thinking of falling back to simply writing view f...
Adding REST to Django
0.01818
0
0
28,236
308,605
2008-11-21T12:24:00.000
2
0
0
0
python,django,apache,rest
312,910
11
false
1
0
I ended up going with my own REST API framework for Django (that I'd love to get rid of if I can find a workable alternative), with a few custom views thrown in for corner cases I didn't want to deal with. It's worked out ok. So a combination of 1 and 2; without some form of framework you'll end up writing the same bo...
6
51
0
I've got a Django application that works nicely. I'm adding REST services. I'm looking for some additional input on my REST strategy. Here are some examples of things I'm wringing my hands over. Right now, I'm using the Django-REST API with a pile of patches. I'm thinking of falling back to simply writing view f...
Adding REST to Django
0.036348
0
0
28,236
308,605
2008-11-21T12:24:00.000
3
0
0
0
python,django,apache,rest
312,544
11
false
1
0
I'm thinking of falling back to simply writing view functions in Django that return JSON results. I would go with that .. Ali A summed it pretty well. The main point for me is beign explicit. I would avoid using a function that automatically converts an object into json, what if the object has a reference to a us...
6
51
0
I've got a Django application that works nicely. I'm adding REST services. I'm looking for some additional input on my REST strategy. Here are some examples of things I'm wringing my hands over. Right now, I'm using the Django-REST API with a pile of patches. I'm thinking of falling back to simply writing view f...
Adding REST to Django
0.054491
0
0
28,236
308,912
2008-11-21T14:22:00.000
2
0
1
0
python,optimization
308,964
4
false
0
0
The big difference is that tuples are immutable, while lists and dictionaries are mutable data structures. This means that tuples are also faster, so if you have a collection of items that doesn't change, you should prefer them over lists.
3
3
0
Is there any performance advantage to using lists over dictionaries over tuples in Python? If I'm optimising for speed, is there any reason to prefer one over another?
Python data structures overhead/performance
0.099668
0
0
1,837
308,912
2008-11-21T14:22:00.000
20
0
1
0
python,optimization
308,982
4
true
0
0
Rich, Lists and dicts are beasts suitable for different needs. Make sure you don't use lists for linear searches where dicts hashes are perfect, because it's way slower. Also, if you just need a list of elements to traverse, don't use dicts because it will take much more space than lists. That may sound obvious, but pi...
3
3
0
Is there any performance advantage to using lists over dictionaries over tuples in Python? If I'm optimising for speed, is there any reason to prefer one over another?
Python data structures overhead/performance
1.2
0
0
1,837
308,912
2008-11-21T14:22:00.000
6
0
1
0
python,optimization
308,936
4
false
0
0
Tuples will be slightly faster to construct for a small number of elements. Although actually most of the gains will be in memory used rather than CPU cycles, since tuples require less space than lists. With that being said, the performance difference should be negligible, and in general you shouldn't worry about thes...
3
3
0
Is there any performance advantage to using lists over dictionaries over tuples in Python? If I'm optimising for speed, is there any reason to prefer one over another?
Python data structures overhead/performance
1
0
0
1,837
309,135
2008-11-21T15:38:00.000
8
1
1
0
python,editor,notepad++,komodo,komodoedit
314,915
9
false
0
0
I use Komodo edit. The main reasons are: Intellisense (not as good as VisualStudio, but Python's a hard language to do intellisense for) and cross-platform compatibility. It's nice being able to use the same editor on my Windows machine, my linux machine, and my macbook with little to no change in feel.
8
16
0
I'm using Notepad++ for python development, and few days ago I found out about free Komodo Edit. I need Pros and Cons for Python development between this two editors...
Komodo Edit and Notepad++ ::: Pros & Cons ::: Python dev
1
0
0
27,320
309,135
2008-11-21T15:38:00.000
9
1
1
0
python,editor,notepad++,komodo,komodoedit
314,865
9
false
0
0
I just downloaded and started using Komodo Edit. I've been using Notepad++ for awhile. Here is what I think about some of the features: Komodo Edit Pros: You can jump to a function definition, even if it's in another file (I love this) There is a plugin that displays the list of classes, functions and such for the cur...
8
16
0
I'm using Notepad++ for python development, and few days ago I found out about free Komodo Edit. I need Pros and Cons for Python development between this two editors...
Komodo Edit and Notepad++ ::: Pros & Cons ::: Python dev
1
0
0
27,320
309,135
2008-11-21T15:38:00.000
1
1
1
0
python,editor,notepad++,komodo,komodoedit
500,622
9
false
0
0
If I had to choose between Notepad++ and Komodo i would choose PyScripter ;.) Seriously I consider PyScripter as a great alternative...
8
16
0
I'm using Notepad++ for python development, and few days ago I found out about free Komodo Edit. I need Pros and Cons for Python development between this two editors...
Komodo Edit and Notepad++ ::: Pros & Cons ::: Python dev
0.022219
0
0
27,320
309,135
2008-11-21T15:38:00.000
4
1
1
0
python,editor,notepad++,komodo,komodoedit
314,871
9
false
0
0
A downside I found of Notepad++ for Python is that it tends (for me) to silently mix tabs and spaces. I know this is configurable, but it caught me out, especially when trying to work with other people using different editors / IDE's, so take care.
8
16
0
I'm using Notepad++ for python development, and few days ago I found out about free Komodo Edit. I need Pros and Cons for Python development between this two editors...
Komodo Edit and Notepad++ ::: Pros & Cons ::: Python dev
0.088656
0
0
27,320
309,135
2008-11-21T15:38:00.000
1
1
1
0
python,editor,notepad++,komodo,komodoedit
311,426
9
false
0
0
I haven't used Komodo yet (the download never quite finished on the slow connection I was on at the time), but I use Eclipse with PyDev regularly and enjoy the "IDE" features described by the other respondents. However, I'm also regularly frustrated by how much of a resource hog it is. I downloaded Notepad++ recently (...
8
16
0
I'm using Notepad++ for python development, and few days ago I found out about free Komodo Edit. I need Pros and Cons for Python development between this two editors...
Komodo Edit and Notepad++ ::: Pros & Cons ::: Python dev
0.022219
0
0
27,320
309,135
2008-11-21T15:38:00.000
5
1
1
0
python,editor,notepad++,komodo,komodoedit
309,140
9
false
0
0
As far as I know , Notepad++ doesn't show you the docstring each method has .
8
16
0
I'm using Notepad++ for python development, and few days ago I found out about free Komodo Edit. I need Pros and Cons for Python development between this two editors...
Komodo Edit and Notepad++ ::: Pros & Cons ::: Python dev
0.110656
0
0
27,320
309,135
2008-11-21T15:38:00.000
7
1
1
0
python,editor,notepad++,komodo,komodoedit
501,832
9
false
0
0
I use both Komodo Edit and Notepad++. Notepad++ is a lot quicker to launch and it's more lightweight, so I often use it for quick one-off editing. I use Komodo Edit for major projects, like my django and wxPython applications. KE is a full-featured IDE, so it has a lot more features. Main advantages of Komodo Edit for...
8
16
0
I'm using Notepad++ for python development, and few days ago I found out about free Komodo Edit. I need Pros and Cons for Python development between this two editors...
Komodo Edit and Notepad++ ::: Pros & Cons ::: Python dev
1
0
0
27,320
309,135
2008-11-21T15:38:00.000
-4
1
1
0
python,editor,notepad++,komodo,komodoedit
310,252
9
false
0
0
Downloaded both myself. Like Komodo better. Komodo Pros: Like it better. Does more. Looks like an IDE. Edits Django templates Notepad++ Cons: Don't like it as much. Does less. Looks less like and IDE.
8
16
0
I'm using Notepad++ for python development, and few days ago I found out about free Komodo Edit. I need Pros and Cons for Python development between this two editors...
Komodo Edit and Notepad++ ::: Pros & Cons ::: Python dev
-1
0
0
27,320
309,412
2008-11-21T16:44:00.000
1
0
1
0
python,windows,setuptools
897,332
14
false
0
0
OP option 1 did not work for me. However doing setup.py install as mentioned by NathanD did do the trick. Maybe that should become option 1? Werner
4
85
0
Is there any way to install Setuptools for Python 2.6 in Windows without having an exe installer? There isn't one built at the moment, and the maintainer of Setuptools has stated that it will probably be a while before he'll get to it. Does anyone know of a way to install it anyway?
How do I set up Setuptools for Python 2.6 on Windows?
0.014285
0
0
90,082
309,412
2008-11-21T16:44:00.000
1
0
1
0
python,windows,setuptools
706,069
14
false
0
0
The "first option" (4 steps: download, extract, run, verify PATH) didn't work on my Windows Server 2008 x64 machine with Python 2.6 32 bit installed, nor did it work on my Vista x64 machine with Python 2.6 32 bit installed. The "second option (5 steps: download, extract, extract, run, verify PATH) worked on both Window...
4
85
0
Is there any way to install Setuptools for Python 2.6 in Windows without having an exe installer? There isn't one built at the moment, and the maintainer of Setuptools has stated that it will probably be a while before he'll get to it. Does anyone know of a way to install it anyway?
How do I set up Setuptools for Python 2.6 on Windows?
0.014285
0
0
90,082
309,412
2008-11-21T16:44:00.000
0
0
1
0
python,windows,setuptools
817,335
14
false
0
0
Second option worked for me. Two notes: a. After installing, when you using easy_install in vista, do so as administrator. (Right click on your command line shortcut and click "run as administrator"). I had trouble trying to run easy_install without doing that. b. He means use ez_setup from setuptools-0.6c9.tar.gz
4
85
0
Is there any way to install Setuptools for Python 2.6 in Windows without having an exe installer? There isn't one built at the moment, and the maintainer of Setuptools has stated that it will probably be a while before he'll get to it. Does anyone know of a way to install it anyway?
How do I set up Setuptools for Python 2.6 on Windows?
0
0
0
90,082
309,412
2008-11-21T16:44:00.000
10
0
1
0
python,windows,setuptools
675,337
14
false
0
0
The Nov. 21 answer didn't work for me. I got it working on my 64 bit Vista machine by following the Method 1 instructions, except for Step 3 I typed: setup.py install So, in summary, I did: Download setuptools-0.6c9.tar.gz Use 7-zip to extract it to a folder (directory) outside your Windows Python installation folder...
4
85
0
Is there any way to install Setuptools for Python 2.6 in Windows without having an exe installer? There isn't one built at the moment, and the maintainer of Setuptools has stated that it will probably be a while before he'll get to it. Does anyone know of a way to install it anyway?
How do I set up Setuptools for Python 2.6 on Windows?
1
0
0
90,082
310,118
2008-11-21T20:37:00.000
4
0
1
1
python,linux,environment-variables
310,299
3
false
0
0
For accessing and setting environment variables, read up on the os.environ dictionary. You can also use os.putenv to set an environment variable.
2
1
0
I need to set an environment variable in Python and find the address in memory where it is located. Since it's on Linux, I don't mind about using libraries that only work consistently on Linux (if that's the only way). How would you do this? Edit: The scope of the problem is as follows: I'm trying to hack a program for...
Python - Setting / Getting Environment Variables and Addrs
0.26052
0
0
10,481
310,118
2008-11-21T20:37:00.000
0
0
1
1
python,linux,environment-variables
310,717
3
false
0
0
Pass the address itself in an environment variable, and just read it with os.getenv().
2
1
0
I need to set an environment variable in Python and find the address in memory where it is located. Since it's on Linux, I don't mind about using libraries that only work consistently on Linux (if that's the only way). How would you do this? Edit: The scope of the problem is as follows: I'm trying to hack a program for...
Python - Setting / Getting Environment Variables and Addrs
0
0
0
10,481
310,199
2008-11-21T21:08:00.000
0
0
1
0
python,regex
310,513
6
false
0
0
if the letters are unimportant, you could try \w\d\d\d\w\w\d\d_test.ext which would match the letter/number pattern, or b\d\d\dcv\d\d_test.ext or some mix of the two.
2
3
0
I am battling regular expressions now as I type. I would like to determine a pattern for the following example file: b410cv11_test.ext. I want to be able to do a search for files that match the pattern of the example file aforementioned. Where do I start (so lost and confused) and what is the best way of arriving at a...
How can I translate the following filename to a regular expression in Python?
0
0
0
987
310,199
2008-11-21T21:08:00.000
1
0
1
0
python,regex
310,267
6
false
0
0
Your question is a bit unclear. You say you want a regular expression, but could it be that you want a glob-style pattern you can use with commands like ls? glob expressions and regular expressions are similar in concept but different in practice (regular expressions are considerably more powerful, glob style patterns ...
2
3
0
I am battling regular expressions now as I type. I would like to determine a pattern for the following example file: b410cv11_test.ext. I want to be able to do a search for files that match the pattern of the example file aforementioned. Where do I start (so lost and confused) and what is the best way of arriving at a...
How can I translate the following filename to a regular expression in Python?
0.033321
0
0
987
310,224
2008-11-21T21:18:00.000
0
0
1
0
python,installation,wxpython,cygwin,compilation
4,467,468
4
false
0
1
Isn't the whole point of using wxPython being to use WxWidgets? Isn't the whole point of using THAT being to have a cross platform GUI library? In other words, forget about X11, and just use the native wxPython on windows. If you want to avoid requiring the user to install wxPython and its dependencies, consider writin...
3
4
0
I am using CYGWIN as a platform and would like to use wxPython. Is there a way to get the source compiled and working in cygwin?
How do you compile wxPython under cygwin?
0
0
0
3,640
310,224
2008-11-21T21:18:00.000
0
0
1
0
python,installation,wxpython,cygwin,compilation
11,237,925
4
false
0
1
I tried another solution for using wxPython in cygwin: I installed python27 and wxPython in Windows7 Did "echo 'export PATH=/cygdrive/c/Python27/:$PATH'>>~/.bashrc" Restart cygwin It works. Cheer! I don't know if any other Path should be added, but my program was executed on Fedora and it works on there.
3
4
0
I am using CYGWIN as a platform and would like to use wxPython. Is there a way to get the source compiled and working in cygwin?
How do you compile wxPython under cygwin?
0
0
0
3,640
310,224
2008-11-21T21:18:00.000
3
0
1
0
python,installation,wxpython,cygwin,compilation
310,365
4
false
0
1
You would need a full working X environment to get it to work. It would be much easier to just use Python and wxPython under plain vanilla Windows. Do you have a special case?
3
4
0
I am using CYGWIN as a platform and would like to use wxPython. Is there a way to get the source compiled and working in cygwin?
How do you compile wxPython under cygwin?
0.148885
0
0
3,640
310,759
2008-11-22T02:26:00.000
0
1
0
0
python,django,pylons,snmp,turbogears
541,516
2
false
1
0
or you can start building your own solution (like me), you will be surprised how much can you do with few lines of code using for instance cherryp for web server, pysnmp, and python rrd module.
1
1
0
Comparable to cacti or mrtg.
Does anyone know of a python based web ui for snmp monitoring?
0
0
1
1,942
312,928
2008-11-23T20:39:00.000
2
0
0
1
python,windows,apache,fastcgi
318,517
3
false
0
0
You might find it easier to ditch FastCGI altogether and just run a python webserver on a localhost port. Then just use mod_rewrite to map the apache urls to the internal webserver. (I started offering FastCGI at my hosting company and to my surprise, nearly everyone ditched it in favor of just running their own web se...
1
6
0
I need to run a simple request/response python module under an existing system with windows/apache/FastCGI. All the FastCGI wrappers for python I tried work for Linux only (they use socket.fromfd() and other such shticks). Is there a wrapper that runs under windows?
Python as FastCGI under windows and apache
0.132549
0
1
3,212
314,234
2008-11-24T14:17:00.000
1
0
0
0
python,django,jvm,jython
315,110
4
false
1
0
I have recently started working on an open source desktop project in my spare time. So this may not apply. I came to the same the question. I decided that I should write as much of the code as possible in python (and Django) and target all the platforms CPython, Jython, and IronPython. Then, I decided that I would w...
2
14
0
The background I'm building a fair-sized web application with a friend in my own time, and we've decided to go with the Django framework on Python. Django provides us with a lot of features we're going to need, so please don't suggest alternative frameworks. The only decision I'm having trouble with, is whether we us...
Are there problems developing Django on Jython?
0.049958
0
0
3,101
314,234
2008-11-24T14:17:00.000
3
0
0
0
python,django,jvm,jython
314,448
4
false
1
0
I'd say that if you like Django, you'll also like Python. Don't make the (far too common) mistake of mixing past language's experience while you learn a new one. Only after mastering Python, you'll have the experience to judge if a hybrid language is better than either one. It's true that very few cheap hostings offe...
2
14
0
The background I'm building a fair-sized web application with a friend in my own time, and we've decided to go with the Django framework on Python. Django provides us with a lot of features we're going to need, so please don't suggest alternative frameworks. The only decision I'm having trouble with, is whether we us...
Are there problems developing Django on Jython?
0.148885
0
0
3,101
315,165
2008-11-24T19:27:00.000
0
0
0
0
python,debugging,web2py
2,781,947
9
false
1
0
As Carl stated, it is as easy as: Installing PyDev in Eclipse Right Click on your Web2Py project, selecting Debug As > Python Run Selecting web2py.py as the file to run No other plugins or downloads are needed.
2
19
0
Is it possible? By debug I mean setting breakpoints, inspect values and advance step by step.
How to debug Web2py applications?
0
0
0
9,395
315,165
2008-11-24T19:27:00.000
8
0
0
0
python,debugging,web2py
806,233
9
false
1
0
One can debug applications built on Web2py using the following set-up: Eclipse IDE Install Pydev into Eclipse Set Breakpoints on your code as needed Within Eclipse right-click the file web2py.py and select Debug As -> Python Run When a breakpoint is hit Eclipse will jump to the breakpoint where you can inspect variabl...
2
19
0
Is it possible? By debug I mean setting breakpoints, inspect values and advance step by step.
How to debug Web2py applications?
1
0
0
9,395
315,363
2008-11-24T20:31:00.000
0
0
0
0
python,django,apache,spam-prevention
318,079
8
false
1
0
Yes, it should be a 404, not a 500. 500 indicates something is trying to deal with the URL and is failing in the process. You need to find and fix that. We have a similar problem. Since we are running Apache/mod_python, I chose to deal with it in .htaccess with mod_rewrite rules. I periodically look at the logs and add...
3
4
0
I have a nice and lovely Django site up and running, but have noticed that my error.log file was getting huge, over 150 MB after a couple of months of being live. Turns out a bunch of spambots are looking for well known URL vulnerabilities (or something) and hitting a bunch of sub-directories like http://mysite.com/ie ...
Spambots are cluttering my log file [Django]
0
0
0
821
315,363
2008-11-24T20:31:00.000
0
0
0
0
python,django,apache,spam-prevention
315,615
8
false
1
0
How about setting up a catch-all pattern as the last item in your urls file and directing it to a generic "no such page" or even your homepage? In other words, turn 500's into requests for your homepage.
3
4
0
I have a nice and lovely Django site up and running, but have noticed that my error.log file was getting huge, over 150 MB after a couple of months of being live. Turns out a bunch of spambots are looking for well known URL vulnerabilities (or something) and hitting a bunch of sub-directories like http://mysite.com/ie ...
Spambots are cluttering my log file [Django]
0
0
0
821
315,363
2008-11-24T20:31:00.000
-1
0
0
0
python,django,apache,spam-prevention
315,394
8
false
1
0
A programming solution would be to : open the log file read the lines in a buffer replace the lines that match the errors the bots caused seek to the beginning of the file write the new buffer truncate the file to current pointer position close Voila ! It's done !
3
4
0
I have a nice and lovely Django site up and running, but have noticed that my error.log file was getting huge, over 150 MB after a couple of months of being live. Turns out a bunch of spambots are looking for well known URL vulnerabilities (or something) and hitting a bunch of sub-directories like http://mysite.com/ie ...
Spambots are cluttering my log file [Django]
-0.024995
0
0
821
315,381
2008-11-24T20:38:00.000
1
0
1
0
python,regex
315,446
3
false
0
0
If the pattern you have to match is simple enough to grab with filesystem wildcards, I recommend you take a look at the glob module, which exists for this exact purpose.
1
3
0
I am having some difficulty writing a function that will search through a directory for a file that matches a specific regular expression (which I have compiled using 're.compile'). So my question is: How do I search through a directory (I plan to use os.walk) for a file that matches a specific regular expression? An e...
How do I search through a folder for the filename that matches a regular expression using Python?
0.066568
0
0
5,140
315,435
2008-11-24T20:53:00.000
0
0
1
0
python,reversi
527,064
6
false
0
0
You don't even need a linear array. Two 64-bit java long values suffice (one for the white pieces, one for the black. assert (white&black)==0 . You can make play stronger by counting not pieces that are joined to a corner, but pieces that cannot be taken.
3
3
0
I am trying to write Reversi game in Python. Can anyone give me some basic ideas and strategy which are simple, good and easy to use? I would appreciate for any help because I've gone to a little far but is stucked between codes and it became more complex too. I think I overdid in some part that should be fairly simple...
Need instructions for Reversi game
0
0
0
3,730