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
904,928
2009-05-25T00:11:00.000
-2
0
1
0
python,padding,strftime
72,106,318
21
false
0
0
Use simply strftime("%Y/%-m/%-d") in place of strftime("%Y/%m/%d") to remove zero : strftime("%Y/%-m/%-d") ==> 2022/5/3 strftime("%Y/%-m/%-d") =>2022/05/03
5
369
0
When using Python strftime, is there a way to remove the first 0 of the date if it's before the 10th, ie. so 01 is 1? Can't find a %thingy for that? Thanks!
Python strftime - date without leading 0?
-0.019045
0
0
188,421
904,928
2009-05-25T00:11:00.000
2
0
1
0
python,padding,strftime
38,662,476
21
false
0
0
Old question, but %l (lower-case L) worked for me in strftime: this may not work for everyone, though, as it's not listed in the Python documentation I found
5
369
0
When using Python strftime, is there a way to remove the first 0 of the date if it's before the 10th, ie. so 01 is 1? Can't find a %thingy for that? Thanks!
Python strftime - date without leading 0?
0.019045
0
0
188,421
905,005
2009-05-25T01:02:00.000
0
0
1
0
python,ide,intellisense
14,027,081
16
false
0
0
IronPython is the way to go. Visual Studio has the best intellisense support and you can utilize that using IronPython
1
70
0
Is there an equivalent to 'intellisense' for Python? Perhaps i shouldn't admit it but I find having intellisense really speeds up the 'discovery phase' of learning a new language. For instance switching from VB.net to C# was a breeze due to snippets and intellisense helping me along.
Python and Intellisense
0
0
0
43,902
905,221
2009-05-25T03:30:00.000
5
0
0
1
python,linux,shell
905,294
4
true
0
0
os.system() just calls the system() system call ("man 3 system"). On most *nixes this means you get /bin/sh. Note that export VAR=val is technically not standard syntax (though bash understands it, and I think ksh does too). It will not work on systems where /bin/sh is actually the Bourne shell. On those systems you ne...
1
9
0
I am using /bin/tcsh as my default shell. However, the tcsh style command os.system('setenv VAR val') doesn't work for me. But os.system('export VAR=val') works. So my question is how can I know the os.system() run command under which shell?
os.system() execute command under which linux shell?
1.2
0
0
35,436
905,403
2009-05-25T05:07:00.000
0
0
0
0
python,download,flv
905,451
2
false
1
0
if the embed player makes use of some variable where the flv path is set then you can download it, if not.. I doubt you find something to do it "automaticly" since every site make it's own player and identify the file by id not by path, which makes hard to know where the flv file is.
1
1
0
I'm trying to write a script which can automatically download gameplay videos. The webpages look like dota.sgamer.com/Video/Detail/402 and www.wfbrood.com/movie/spl2009/movie_38214.html, they have flv player embedded in the flash plugin. Is there any library to help me find out the exact flv urls? or any other ideas to...
Is there any library to find out urls of embedded flvs in a webpage?
0
0
1
382
905,902
2009-05-25T08:42:00.000
0
1
0
0
python,hosting
905,924
2
false
0
0
Usually python is already installed, but it depends on your hoster. Ask them.
2
0
0
Following on my previous question, if I have some hosting how can I put a python script on their that I can then run from there? Do I need to do something special to run it/install something? EDIT-Clarification-I would like to be able to upload the script which does stuff on the internet-no data is stored on my comput...
Storing Python scripts on a webserver
0
0
0
243
905,902
2009-05-25T08:42:00.000
1
1
0
0
python,hosting
906,016
2
false
0
0
You have to ensure your hoster system supports Python. You can ask them about that. To run the script once it is there, you can act in several ways, depending on what you want to do. You can have your server side language to invoke it (i.e. from the backend of a web page), or if you have a shell access to the machine y...
2
0
0
Following on my previous question, if I have some hosting how can I put a python script on their that I can then run from there? Do I need to do something special to run it/install something? EDIT-Clarification-I would like to be able to upload the script which does stuff on the internet-no data is stored on my comput...
Storing Python scripts on a webserver
0.099668
0
0
243
906,509
2009-05-25T12:16:00.000
2
0
0
1
python,plugins,gnome,rhythmbox
1,450,802
2
false
0
0
You can't import rhythmbox "built-in" modules from a standard python console. As far as I know they aren't real modules, they are just objects from the rhythmbox process exposed to plugins. So you can access them only if you are running your script from the rhythmbox process.
2
0
0
I'm writing a little script for Ubuntu. My intention is to call rhythmbox lyrics plug-in with a global short-cut (configuring gnome) . I can call it from rhythmbox python console, but I don't know how to import rhythmbox built-in modules (eg. rhythmdb). Any ideas?
show lyrics on ubuntu
0.197375
0
0
1,143
906,509
2009-05-25T12:16:00.000
0
0
0
1
python,plugins,gnome,rhythmbox
4,594,514
2
false
0
0
in this case i guess you'll have to write the whole plugin yourself and , then listen to dbus for change of songs in rhythmbox , to detect which song is being played .
2
0
0
I'm writing a little script for Ubuntu. My intention is to call rhythmbox lyrics plug-in with a global short-cut (configuring gnome) . I can call it from rhythmbox python console, but I don't know how to import rhythmbox built-in modules (eg. rhythmdb). Any ideas?
show lyrics on ubuntu
0
0
0
1,143
907,579
2009-05-25T18:05:00.000
0
0
0
1
python,hosting
907,605
5
false
0
0
In addition to the other fine answers here, you should be aware that most FTP clients have a chmod command to allow you to set permissions on files at the server. You may not need this if permissions come across properly, but there's a good chance they do not.
1
4
0
My hosting provider says my python script must be made to be executable(chmod755). What does this mean & how do I do it? Cheers!
Making a Python script executable chmod755?
0
0
0
3,729
908,285
2009-05-25T22:39:00.000
3
1
0
0
python,plugins,signing
908,846
2
false
0
0
Is there a way to secure this system? The answer is "that depends". The two questions you should ask is "what are people supposed to be able to do" and "what are people able to do (for a given implementation)". If there exists an implementation where the latter is a subset of the former, the system can be secured. On...
1
2
0
I have an application written in python. I created a plugin system for the application that uses egg files. Egg files contain compiled python files and can be easily decompiled and used to hack the application. Is there a way to secure this system? I'd like to use digital signature for this - sign these egg files and c...
Secure plugin system for python application
0.291313
0
0
1,311
909,929
2009-05-26T10:11:00.000
0
0
0
0
python,forms,post,get
909,975
3
false
0
0
Since your sample is in PHP, use $_REQUEST, this holds the contents of both $_GET and $_POST.
1
0
0
I have this- en.wikipedia.org/w/api.php?action=login&lgname=user&lgpassword=password But it doesn't work because it is a get request. What would the the post request version of this? Cheers!
Changing a get request to a post in python?
0
0
1
276
911,089
2009-05-26T14:46:00.000
3
1
0
0
python,pyserial
911,772
2
true
0
0
For general tips on working with pyserial, look at the search S.Lott suggested in the comment. Regarding the best strategy to implement your application - it all depends on how your protocols are defined. Do the devices immediately respond to queries? Or do they continually send data that must be monitored? This is imp...
1
2
0
Good afternoon, I would ask some suggestion about the best way to monitor events over the serial port. I'm using PySerial to write "commands" over the serial port towards some devices and I would like to receive feedback about the status of this devices. Wich is the best way: 1) fullfill a pipe and read into, 2) a new ...
python monitoring over serial port
1.2
0
0
6,847
911,905
2009-05-26T17:53:00.000
1
0
1
0
python,python-datamodel
911,953
7
false
0
0
I don't think you can. __getattribute__ doesn't intercept the method call, it only intercepts the method name lookup. So it should return a function (or callable object), which will then be called with whatever parameters specified at the call site. In particular, if it returns a function which takes (*args, **kwargs),...
1
4
0
It seems as though __getattribute__ has only 2 parameters (self, name). However, in the actual code, the method I am intercepting actually takes arguments. Is there anyway to access those arguments? Thanks, Charlie
Is there a way to access the formal parameters if you implement __getattribute__
0.028564
0
0
2,507
912,025
2009-05-26T18:25:00.000
1
1
1
0
python,module,package,python-import
7,338,242
6
false
0
0
The solution above traversing the filesystem for finding submodules is ok as long as you implement every plugin as a filesystem based module. A more flexible way would be an explicit plugin list in your main module, and have every plugin (whether a module created by file, dynamically, or even instance of a class) addin...
1
13
0
While it is fairly trivial in Python to import a "child" module into another module and list its attributes, it becomes slightly more difficult when you want to import all child modules. I'm building a library of tools for an existing 3D application. Each tool has its own menu item and sub menus. I'd like the tool to ...
How to find all child modules in Python?
0.033321
0
0
6,221
913,204
2009-05-26T23:02:00.000
1
0
1
0
python,python-3.x
913,212
7
false
0
1
I would assume it'd be the same as running two versions of 2.x; as long as they're each in their own directory you should be OK.
6
3
0
How would I do this? The reason being I wanted to try some pygame out, but I have python 3 installed currently and have been learning with that. I'm also interested in trying out wxpython or something like that, but I haven't looked at their compatibilities yet. EDIT:: im on a windows vista 64-bit
Is it possible to install python 3 and 2.6 on same PC?
0.028564
0
0
1,819
913,204
2009-05-26T23:02:00.000
1
0
1
0
python,python-3.x
913,222
7
false
0
1
You certainly can. On Mac Ports, there's a tool called python_select that lets you switch among python versions; if nothing like it exists on Windows (momentary googling didn't reveal one), it could certainly be written.
6
3
0
How would I do this? The reason being I wanted to try some pygame out, but I have python 3 installed currently and have been learning with that. I'm also interested in trying out wxpython or something like that, but I haven't looked at their compatibilities yet. EDIT:: im on a windows vista 64-bit
Is it possible to install python 3 and 2.6 on same PC?
0.028564
0
0
1,819
913,204
2009-05-26T23:02:00.000
3
0
1
0
python,python-3.x
913,225
7
false
0
1
Typically python is installed with a name like python2.6, so you can have more than one. There may be a symlink from python to one of the numbered files. Quite workable.
6
3
0
How would I do this? The reason being I wanted to try some pygame out, but I have python 3 installed currently and have been learning with that. I'm also interested in trying out wxpython or something like that, but I haven't looked at their compatibilities yet. EDIT:: im on a windows vista 64-bit
Is it possible to install python 3 and 2.6 on same PC?
0.085505
0
0
1,819
913,204
2009-05-26T23:02:00.000
2
0
1
0
python,python-3.x
913,269
7
false
0
1
Yes, it is possible. I maintain 3 python installations (2.5, 2.6, 3.0). The only issue that could be confusing is figuring out which Python version takes precedence in PATH variable (if any) . To execute a script for a specific version, you would go into the python directory for that version C:\Python25\ , C:\Python26...
6
3
0
How would I do this? The reason being I wanted to try some pygame out, but I have python 3 installed currently and have been learning with that. I'm also interested in trying out wxpython or something like that, but I haven't looked at their compatibilities yet. EDIT:: im on a windows vista 64-bit
Is it possible to install python 3 and 2.6 on same PC?
0.057081
0
0
1,819
913,204
2009-05-26T23:02:00.000
3
0
1
0
python,python-3.x
913,223
7
false
0
1
Erm... yes. I just installed Python 3.0 on this computer to test it. You haven't specified your operating system, but I'm running Ubuntu 9.04 and I can explicitly specify the version of Python I want to run by typing python2.5 myscript.py or python3.0 myscript.py, depending on my needs.
6
3
0
How would I do this? The reason being I wanted to try some pygame out, but I have python 3 installed currently and have been learning with that. I'm also interested in trying out wxpython or something like that, but I haven't looked at their compatibilities yet. EDIT:: im on a windows vista 64-bit
Is it possible to install python 3 and 2.6 on same PC?
0.085505
0
0
1,819
913,204
2009-05-26T23:02:00.000
9
0
1
0
python,python-3.x
913,216
7
true
0
1
If you are on Windows, then just install another version of Python using the installer. It would be installed into another directory. Then if you install other packages using the installer, it would ask you for which python installation to apply. If you use installation from source or easy_install, then just make sure ...
6
3
0
How would I do this? The reason being I wanted to try some pygame out, but I have python 3 installed currently and have been learning with that. I'm also interested in trying out wxpython or something like that, but I haven't looked at their compatibilities yet. EDIT:: im on a windows vista 64-bit
Is it possible to install python 3 and 2.6 on same PC?
1.2
0
0
1,819
915,135
2009-05-27T11:03:00.000
5
1
1
0
python
915,195
2
true
0
0
Read the Python 3.0 changes. The point of 2.6 is to aim for 3.0. From 2.4 to 2.6 you gained a lot of things. These are the the most important. I'm making this answer community wiki so other folks can edit it. Generator functions and the yield statement. More consistent use of various types like list and dict -- they...
1
4
0
I'm migrating a legacy codebase at work from python 2.4 to python 2.6. This is being done as part of a push to remove the 'legacy' tag and make a maintainable, extensible foundation for active development, so I'm getting a chance to "do things right", including refactoring to use new 2.6 features if that leads to clean...
Migrating from python 2.4 to python 2.6
1.2
0
0
3,565
915,726
2009-05-27T13:34:00.000
2
0
0
0
python,web-services,scripting,reporting,ms-office
921,061
2
true
0
0
I can only agree with Reef on the general concepts he presented: You will almost certainly prefer the data in a database than in a single large file You should not worry that the data is not directly manipulated by users because as Reef mentioned, it can only go wrong. And you would be suprised at how ugly it can get ...
2
2
0
We have lots of data and some charts repesenting one logical item. Charts and data is stored in various files. As a result, most users can easily access and re-use the information in their applications. However, this not exactly a good way of storing data. Amongst other reasons, charts belong to some data, the charts a...
Reporting charts and data for MS-Office users
1.2
1
0
325
915,726
2009-05-27T13:34:00.000
1
0
0
0
python,web-services,scripting,reporting,ms-office
920,669
2
false
0
0
Instead of using one big file, You should use a database. Yes, You can store various types of files like gifs in the database if You like to. The file would not be human readable or accessible by non-technical users, but this is good. The database would have a website that Your non-technical users would use to insert, ...
2
2
0
We have lots of data and some charts repesenting one logical item. Charts and data is stored in various files. As a result, most users can easily access and re-use the information in their applications. However, this not exactly a good way of storing data. Amongst other reasons, charts belong to some data, the charts a...
Reporting charts and data for MS-Office users
0.099668
1
0
325
916,663
2009-05-27T16:16:00.000
5
0
0
0
python,3d,direct3d
1,360,670
13
false
0
1
The answer to what I think your specific question is, "... in pure Python ..." the answer is NO. Python is not fast enough to call OpenGL or DirectX efficently enough to re-create World Of Warcraft at an exceptable frame rate. Like many others have answered, given some high level frame work, it would be possible to use...
9
12
0
Would it be possible to write a 3D game as large as World of Warcraft in pure Python? Assuming the use of DirectX / D3D bindings or OpenGL bindings. If not, what would be the largest hold-up to doing such a project in Python? I know games tend to fall into the realm of C and C++ but sometimes people do things out of ha...
Would it be possible to write a 3D game as large as World of Warcraft in pure Python?
0.076772
0
0
10,718
916,663
2009-05-27T16:16:00.000
2
0
0
0
python,3d,direct3d
1,656,715
13
false
0
1
As a technologist I know: If it can be written in C\C++ it can be written in assembly (though it will take longer). If it can be written in C\C++ and is not a low-level code - it can be written in any managed environment. WoW is a high-level program that is written in C\C++ python is a managed environment There for: Wo...
9
12
0
Would it be possible to write a 3D game as large as World of Warcraft in pure Python? Assuming the use of DirectX / D3D bindings or OpenGL bindings. If not, what would be the largest hold-up to doing such a project in Python? I know games tend to fall into the realm of C and C++ but sometimes people do things out of ha...
Would it be possible to write a 3D game as large as World of Warcraft in pure Python?
0.03076
0
0
10,718
916,663
2009-05-27T16:16:00.000
4
0
0
0
python,3d,direct3d
1,656,654
13
false
0
1
I have been trying my hand at writing 3D games in Python, and given a good rendering framework (my favourite is OGRE) and decent bindings, it is amazing what you can get away with. However, especially with games, you are always trying to squeeze as much as you can out of the hardware. The performance disadvantage of py...
9
12
0
Would it be possible to write a 3D game as large as World of Warcraft in pure Python? Assuming the use of DirectX / D3D bindings or OpenGL bindings. If not, what would be the largest hold-up to doing such a project in Python? I know games tend to fall into the realm of C and C++ but sometimes people do things out of ha...
Would it be possible to write a 3D game as large as World of Warcraft in pure Python?
0.061461
0
0
10,718
916,663
2009-05-27T16:16:00.000
2
0
0
0
python,3d,direct3d
930,968
13
false
0
1
Just because it might give an interesting read, Civilization is partly written using Python. A google on it returns interesting reading material.
9
12
0
Would it be possible to write a 3D game as large as World of Warcraft in pure Python? Assuming the use of DirectX / D3D bindings or OpenGL bindings. If not, what would be the largest hold-up to doing such a project in Python? I know games tend to fall into the realm of C and C++ but sometimes people do things out of ha...
Would it be possible to write a 3D game as large as World of Warcraft in pure Python?
0.03076
0
0
10,718
916,663
2009-05-27T16:16:00.000
0
0
0
0
python,3d,direct3d
916,693
13
false
0
1
Because Python is interpreted there would be a performance hit, as opposed to C/C++, but, you would want to use something like PyOpenGL instead of DirectX though, to run on more operating systems. But, I don't see why you couldn't write such a game in Python.
9
12
0
Would it be possible to write a 3D game as large as World of Warcraft in pure Python? Assuming the use of DirectX / D3D bindings or OpenGL bindings. If not, what would be the largest hold-up to doing such a project in Python? I know games tend to fall into the realm of C and C++ but sometimes people do things out of ha...
Would it be possible to write a 3D game as large as World of Warcraft in pure Python?
0
0
0
10,718
916,663
2009-05-27T16:16:00.000
6
0
0
0
python,3d,direct3d
916,704
13
false
0
1
Yes, you could write it in assembly, or Java, or Python, or brainfuck. It's just how much time you are willing to put into it. Language performance's aren't a major issue anymore, it's more about which algorithms you use, not what language you use.
9
12
0
Would it be possible to write a 3D game as large as World of Warcraft in pure Python? Assuming the use of DirectX / D3D bindings or OpenGL bindings. If not, what would be the largest hold-up to doing such a project in Python? I know games tend to fall into the realm of C and C++ but sometimes people do things out of ha...
Would it be possible to write a 3D game as large as World of Warcraft in pure Python?
1
0
0
10,718
916,663
2009-05-27T16:16:00.000
9
0
0
0
python,3d,direct3d
916,701
13
false
0
1
Technically, anything is possible in any Turing Complete programming language. Practically though, you will run into trouble making the networking stack out of a high level language, because the server will have to be VERY fast to handle so many players. The gaming side of things on the client, there should be no pro...
9
12
0
Would it be possible to write a 3D game as large as World of Warcraft in pure Python? Assuming the use of DirectX / D3D bindings or OpenGL bindings. If not, what would be the largest hold-up to doing such a project in Python? I know games tend to fall into the realm of C and C++ but sometimes people do things out of ha...
Would it be possible to write a 3D game as large as World of Warcraft in pure Python?
1
0
0
10,718
916,663
2009-05-27T16:16:00.000
17
0
0
0
python,3d,direct3d
916,686
13
false
0
1
Yes. How it will perform is another question. A good development pattern would be to develop it in pure python, and then profile it, and rewrite performance-critical bottlenecks, either in C/C++/Cython or even python itself but with more efficient code.
9
12
0
Would it be possible to write a 3D game as large as World of Warcraft in pure Python? Assuming the use of DirectX / D3D bindings or OpenGL bindings. If not, what would be the largest hold-up to doing such a project in Python? I know games tend to fall into the realm of C and C++ but sometimes people do things out of ha...
Would it be possible to write a 3D game as large as World of Warcraft in pure Python?
1
0
0
10,718
916,663
2009-05-27T16:16:00.000
0
0
0
0
python,3d,direct3d
1,316,198
13
false
0
1
Python is not interpreted - it is tokenized/'just in time' bytecode 'interpreted' and it doesn't have a VM like Java does. This means, in english, it can be daaaaaamnfast. Not all the time though, it depends on the problem and the libraries, but python is not slow, this is a common misconception even among knowledgab...
9
12
0
Would it be possible to write a 3D game as large as World of Warcraft in pure Python? Assuming the use of DirectX / D3D bindings or OpenGL bindings. If not, what would be the largest hold-up to doing such a project in Python? I know games tend to fall into the realm of C and C++ but sometimes people do things out of ha...
Would it be possible to write a 3D game as large as World of Warcraft in pure Python?
0
0
0
10,718
916,779
2009-05-27T16:39:00.000
2
0
1
0
python,xml,perl,configparser
916,939
6
false
0
0
ConfigParser is a fine way of doing it. There are other ways (the json and cPickle modules already mentioned may be useful) that are also good, depending on whether you want to have text files or binary files and if you want code to work simply in older versions of Python or not. You may want to have a thin abstraction...
2
2
0
I want to save a set of key, value pairs (string, int) between runs of a Python program, reload them on subsequent runs and write the changes to be available on the next run. I don't think of this data as a configuration file, but it would fit the ConfigParser capabilities quite well. I would only need two [sections]. ...
Is something like ConfigParser appropriate for saving state (key, value) between runs?
0.066568
0
0
2,055
916,779
2009-05-27T16:39:00.000
0
0
1
0
python,xml,perl,configparser
916,912
6
false
0
0
Re doing it in bash: If your strings are valid identifiers, you could use environment variables and env.
2
2
0
I want to save a set of key, value pairs (string, int) between runs of a Python program, reload them on subsequent runs and write the changes to be available on the next run. I don't think of this data as a configuration file, but it would fit the ConfigParser capabilities quite well. I would only need two [sections]. ...
Is something like ConfigParser appropriate for saving state (key, value) between runs?
0
0
0
2,055
916,962
2009-05-27T17:09:00.000
8
1
1
0
php,python,oop,comparison
917,005
6
false
0
0
Python's OOP support is very strong; it does allow multiple inheritance, and everything is manipulable as a first-class object (including classes, methods, etc). Polymorphism is expressed through duck typing. For example, you can iterate over a list, a tuple, a dictionary, a file, a web resource, and more all in the s...
4
17
0
I'm basically wondering if Python has any OOP shortcomings like PHP does. PHP has been developing their OOP practices for the last few versions. It's getting better in PHP but it's still not perfect. I'm new to Python and I'm just wondering if Python's OOP support is better or just comparable. If there are some issue...
How does Python OOP compare to PHP OOP?
1
0
0
3,813
916,962
2009-05-27T17:09:00.000
20
1
1
0
php,python,oop,comparison
916,974
6
true
0
0
I would say that Python's OOP support is much better given the fact that it was introduced into the language in its infancy as opposed to PHP which bolted OOP onto an existing procedural model.
4
17
0
I'm basically wondering if Python has any OOP shortcomings like PHP does. PHP has been developing their OOP practices for the last few versions. It's getting better in PHP but it's still not perfect. I'm new to Python and I'm just wondering if Python's OOP support is better or just comparable. If there are some issue...
How does Python OOP compare to PHP OOP?
1.2
0
0
3,813
916,962
2009-05-27T17:09:00.000
3
1
1
0
php,python,oop,comparison
917,052
6
false
0
0
Also: Python has native operator overloading, unlike PHP (although it does exist an extension). Love it or hate it, it's there.
4
17
0
I'm basically wondering if Python has any OOP shortcomings like PHP does. PHP has been developing their OOP practices for the last few versions. It's getting better in PHP but it's still not perfect. I'm new to Python and I'm just wondering if Python's OOP support is better or just comparable. If there are some issue...
How does Python OOP compare to PHP OOP?
0.099668
0
0
3,813
916,962
2009-05-27T17:09:00.000
1
1
1
0
php,python,oop,comparison
917,054
6
false
0
0
If you are looking for "more pure" OOP, you should be looking at SmallTalk and/or Ruby. PHP has grown considerably with it's support for OOP, but because of the way it works (reloads everything every time), things can get really slow if OOP best practices are followed. Which is one of the reasons you don't hear about P...
4
17
0
I'm basically wondering if Python has any OOP shortcomings like PHP does. PHP has been developing their OOP practices for the last few versions. It's getting better in PHP but it's still not perfect. I'm new to Python and I'm just wondering if Python's OOP support is better or just comparable. If there are some issue...
How does Python OOP compare to PHP OOP?
0.033321
0
0
3,813
916,987
2009-05-27T17:16:00.000
0
0
0
0
python,windows,linux,user-interface,wxpython
917,040
3
false
0
1
EDIT: I just remembered this: Does anybody know why when subclassing wx.App an OnInit() method is required, rather than the more logical __init__()? I use OnInit() for symmetry: there's also an OnExit() method. Edit: I may be wrong, but I don't think using OnInit() is required.
2
1
0
The tutorials I've found on WxPython all use examples from Linux, but there seem to be differences in some details. For example, in Windows a Panel behind the widgets is mandatory to show the background properly. Additionally, some examples that look fine in the tutorials don't work in my computer. So, do you know what...
WxPython differences between Windows and Linux
0
0
0
2,618
916,987
2009-05-27T17:16:00.000
0
0
0
0
python,windows,linux,user-interface,wxpython
935,519
3
false
0
1
I find a number of small differences, but don't remember all of them. Here are two: 1) The layout can be slightly different, for example, causing things to not completely fit in the window in one OS when the do in the other. I haven't investigated the reasons for this, but it happens most often when I use positions r...
2
1
0
The tutorials I've found on WxPython all use examples from Linux, but there seem to be differences in some details. For example, in Windows a Panel behind the widgets is mandatory to show the background properly. Additionally, some examples that look fine in the tutorials don't work in my computer. So, do you know what...
WxPython differences between Windows and Linux
0
0
0
2,618
917,876
2009-05-27T20:31:00.000
1
0
1
1
python,macos,osx-leopard,reinstall
917,897
3
true
0
0
/Library/Python contains your python site-packages, which is the local software you've installed using commands like python setup.py install. The pieces here are third-party packages, not items installed by Apple - your actual Python installation is still safe in /System/Library/etc... In other words, the default OS l...
2
0
0
I accidentally removed /Library/Python on OS X Leopard. How can I reinstall that?
Reinstall /Library/Python on OS X Leopard
1.2
0
0
2,889
917,876
2009-05-27T20:31:00.000
1
0
1
1
python,macos,osx-leopard,reinstall
917,890
3
false
0
0
If you'd like, I'll create a tarball from a pristine installation. I'm using MacOSX 10.5.7, and only 12K.
2
0
0
I accidentally removed /Library/Python on OS X Leopard. How can I reinstall that?
Reinstall /Library/Python on OS X Leopard
0.066568
0
0
2,889
918,154
2009-05-27T21:43:00.000
4
0
0
0
python,relative-path,path
20,437,590
21
false
0
0
Hi first of all you should understand functions os.path.abspath(path) and os.path.relpath(path) In short os.path.abspath(path) makes a relative path to absolute path. And if the path provided is itself a absolute path then the function returns the same path. similarly os.path.relpath(path) makes a absolute path to rel...
2
365
0
I'm building a simple helper script for work that will copy a couple of template files in our code base to the current directory. I don't, however, have the absolute path to the directory where the templates are stored. I do have a relative path from the script but when I call the script it treats that as a path relati...
Relative paths in Python
0.038077
0
0
684,930
918,154
2009-05-27T21:43:00.000
0
0
0
0
python,relative-path,path
69,999,696
21
false
0
0
Say the current archive named "Helper" and the upper directory named "Workshop", and the template files are in \Workshop\Templates, then the relative path in Python is "..\Templates".
2
365
0
I'm building a simple helper script for work that will copy a couple of template files in our code base to the current directory. I don't, however, have the absolute path to the directory where the templates are stored. I do have a relative path from the script but when I call the script it treats that as a path relati...
Relative paths in Python
0
0
0
684,930
919,857
2009-05-28T08:52:00.000
0
0
1
0
python,hardware
11,354,777
9
false
0
0
I'm not too sure anyone has mentioned the BASIC stamp. Again - it is very limited, but its SUPER simple to start working with. There are some other processors up there they make too, but as an introductory - I think its a great device. Arduino too is a good one, and you can probably get more bang for you buck with th...
2
14
0
I am starting to get a bit bored of programming little toys that I have been making recently, and I would love to starting programming and interacting with hardware. The only problem is that I am mostly a python guy who hasn't really learned or used any other language. Can I still interact with hardware with python? Al...
Programming with hardware in python
0
0
0
36,107
919,857
2009-05-28T08:52:00.000
1
0
1
0
python,hardware
5,507,016
9
false
0
0
The SNAP wireless nodes at www.synapse-wireless.com run a subset of Python called SNAPpy. You can use the peek() and poke() built-ins in the SNAPpy language to interact directly with hardware inside the chip (PWM for example). SNAPpy also has built-ins for I2C, SPI, and serial, so you can control external hardware. It ...
2
14
0
I am starting to get a bit bored of programming little toys that I have been making recently, and I would love to starting programming and interacting with hardware. The only problem is that I am mostly a python guy who hasn't really learned or used any other language. Can I still interact with hardware with python? Al...
Programming with hardware in python
0.022219
0
0
36,107
920,278
2009-05-28T10:57:00.000
1
0
0
0
python,cookies
920,727
2
false
0
0
Usually, we do the following. Use a framework. Establish a session. Ideally, ask for a username of some kind. If you don't want to ask for names or anything, you can try to the browser's IP address as the key for the session (this can turn into a nightmare, but you can try it.) Using the session identification (use...
1
0
0
Hey i have a webpage for searching a database. i would like to be able to implement cookies using python to store what a user searches for and provide them with a recently searched field when they return. is there a way to implement this using the python Cookie library??
Using cookies with python to store searches
0.099668
0
1
1,329
920,645
2009-05-28T12:44:00.000
80
0
1
0
python,loops
920,692
10
true
0
0
Yes, there is a huge difference between while and for. The for statement iterates through a collection or iterable object or generator function. The while statement simply loops until a condition is False. It isn't preference. It's a question of what your data structures are. Often, we represent the values we want to ...
4
41
0
I am finding problems in when I should use a while loop or a for loop in Python. It looks like people prefer using a for loop (less code lines?). Is there any specific situation which I should use one or the other? Is it a matter of personal preference? The codes I have read so far made me think there are big differenc...
When to use "while" or "for" in Python
1.2
0
0
133,264
920,645
2009-05-28T12:44:00.000
-1
0
1
0
python,loops
68,777,278
10
false
0
0
For me if your problem demands multiple pointers to be used to keep track of some boundary I would always prefer While loop. In other cases it's simply for loop.
4
41
0
I am finding problems in when I should use a while loop or a for loop in Python. It looks like people prefer using a for loop (less code lines?). Is there any specific situation which I should use one or the other? Is it a matter of personal preference? The codes I have read so far made me think there are big differenc...
When to use "while" or "for" in Python
-0.019997
0
0
133,264
920,645
2009-05-28T12:44:00.000
0
0
1
0
python,loops
67,131,941
10
false
0
0
If your data is dirty and it won't work with a for loop, you need to clean your data.
4
41
0
I am finding problems in when I should use a while loop or a for loop in Python. It looks like people prefer using a for loop (less code lines?). Is there any specific situation which I should use one or the other? Is it a matter of personal preference? The codes I have read so far made me think there are big differenc...
When to use "while" or "for" in Python
0
0
0
133,264
920,645
2009-05-28T12:44:00.000
0
0
1
0
python,loops
63,624,000
10
false
0
0
while loop is better for normal loops for loop is much better than while loop while working with strings, like lists, strings etc.
4
41
0
I am finding problems in when I should use a while loop or a for loop in Python. It looks like people prefer using a for loop (less code lines?). Is there any specific situation which I should use one or the other? Is it a matter of personal preference? The codes I have read so far made me think there are big differenc...
When to use "while" or "for" in Python
0
0
0
133,264
920,938
2009-05-28T13:49:00.000
0
0
1
0
python,formatting,ms-word,ms-office,openoffice.org
921,046
7
false
0
0
I think OpenOffice has some Python bindings - you should be able to write OO macros in Python. But I would use HTML instead - Word and OO.org are rather good at editing it and you can write it from Python easily (although Word saves a lot of mess which could complicate parsing it by your Python app).
2
6
0
I am working on a project (in Python) that needs formatted, editable output. Since the end-user isn't going to be technically proficient, the output needs to be in a word processor editable format. The formatting is complex (bullet points, paragraphs, bold face, etc). Is there a way to generate such a report using Pyth...
Formatted output in OpenOffice/Microsoft Word with Python
0
0
0
5,281
920,938
2009-05-28T13:49:00.000
3
0
1
0
python,formatting,ms-word,ms-office,openoffice.org
922,117
7
false
0
0
A little known, and slightly evil fact: If you create an HTML file, and stick a .doc extension on it, Word will open it as a Word document, and most users will be none the wiser. Except maybe a very technical person will say, my this is a small Word file! :)
2
6
0
I am working on a project (in Python) that needs formatted, editable output. Since the end-user isn't going to be technically proficient, the output needs to be in a word processor editable format. The formatting is complex (bullet points, paragraphs, bold face, etc). Is there a way to generate such a report using Pyth...
Formatted output in OpenOffice/Microsoft Word with Python
0.085505
0
0
5,281
921,268
2009-05-28T14:55:00.000
2
0
0
0
.net,ssis,ironpython
1,233,648
1
false
0
0
Set up a column which holds a CHECKSUM() of each row. Do a left outer join between the two tables . If you have any nulls for the right side, you have problems.
1
0
0
A table has been ETLed to another table. My task is to verify the data between two tables programmatically. One of the difficulties I m facing rite now is: how to use the expression that I can get from, let s say, derived column task and verify with the source and destination. or in other words, how can I use the expr...
How to compare data of two tables transformed in SSIS package
0.379949
1
0
1,102
921,532
2009-05-28T15:35:00.000
4
1
1
0
python,cookies
921,544
4
false
0
0
Look at the Cookie: headers in the HTTP response you get, parse their contents with module Cookie in the standard library.
1
20
0
How do I read back all of the cookies in Python without knowing their names?
Retrieving all Cookies in Python
0.197375
0
0
43,214
922,319
2009-05-28T17:55:00.000
0
0
0
0
python,zope
1,022,056
3
false
0
0
If you really move everything you could probably just move the Data.fs instead. But otherwise the import/export above is a good way.
1
5
0
We have two zope servers running our company's internal site. One is the live site and one is the dev site. I'm working on writing a python script that moves everything from the dev server to the live server. Right now the process involves a bunch of steps that are done in the zope management interface. I need to m...
Exporting a zope folder with python
0
0
0
1,260
922,351
2009-05-28T18:01:00.000
0
1
0
0
python,pylons,paster
980,897
2
false
0
0
If you set the environment variable PYTHONSTARTUP to the name of a file, it will execute that file on opening the interactive prompt. I don't know anything about paster shell, but I assume it works similarly. Alternatively you could look into iPython, which has much more powerful features (particularly when installed w...
1
5
0
Is it possible to run "paster shell blah.ini" (or a variant thereof) and have it automatically load certain libraries? I hate having to always type "from foo.bar import mystuff" as the first command in every paster shell, and would like the computer to do it for me.
Is it possible to launch a Paster shell with some modules pre-imported?
0
0
0
1,107
922,681
2009-05-28T19:14:00.000
0
1
0
0
c#,.net,scripting,ironpython
922,701
2
false
0
1
If you right click your project and go to Properties theres a Publish tab, that allows you to specify prerequisite installs for your application. Presumably you can supply a path to the IronPython install executable here.
2
2
0
I'm am trying to roll out a test application to test the feasibility of righting a Click Once Smart Client app that also uses a rules engine customizable by embedding IronPython. So far all users but me get this error (below) when invoking the script engine. Do I need to do something special to force deployment of the ...
IronPython, Click Once, .NET 2.0 Error - thoughts?
0
0
0
1,241
922,681
2009-05-28T19:14:00.000
4
1
0
0
c#,.net,scripting,ironpython
923,395
2
false
0
1
IronPython requiers .NET 2.0SP1 or later to run. This exception is happening due to an overload that was added in SP1.
2
2
0
I'm am trying to roll out a test application to test the feasibility of righting a Click Once Smart Client app that also uses a rules engine customizable by embedding IronPython. So far all users but me get this error (below) when invoking the script engine. Do I need to do something special to force deployment of the ...
IronPython, Click Once, .NET 2.0 Error - thoughts?
0.379949
0
0
1,241
922,771
2009-05-28T19:34:00.000
2
1
0
0
python,templates,mako
923,030
7
false
1
0
What I ended up doing was naming my Mako Templates with .html suffix and thus getting the usual HTML syntax highlighting etc. that I am used to. Alternatively I could have associated .mako suffix with the HTML handler. While this does not address Mako specifically, it was enough for me, since I find most of the templat...
3
12
0
Does anyone know of a syntax highlight for Mako templates for Eclipse or for TextMate? I know that there is a .mako syntax highlighter for the default text editor in Ubuntu.
Syntax Highlight for Mako in Eclipse or TextMate?
0.057081
0
0
5,178
922,771
2009-05-28T19:34:00.000
0
1
0
0
python,templates,mako
30,838,894
7
false
1
0
Windows (menu) > Preference > General > Editor > File Associations Add *.mako in File Types (upper box) and add Html editor in Associated editor (lower box) Windows (menu) > Preference > General > Editor > Content Types Under Text find HTML and add *.mako in File associations.
3
12
0
Does anyone know of a syntax highlight for Mako templates for Eclipse or for TextMate? I know that there is a .mako syntax highlighter for the default text editor in Ubuntu.
Syntax Highlight for Mako in Eclipse or TextMate?
0
0
0
5,178
922,771
2009-05-28T19:34:00.000
1
1
0
0
python,templates,mako
8,544,623
7
false
1
0
You can go to: Preferences->General->Editors->File Associations. Click to add a new file type and type *.mak and click OK. In File types click on *.mak and under Associated editors add HTML editor(default), Text Editor, Text Editor(studio) and Web Browser. This colors the text, works OK for me :) P.S. Be sure to have...
3
12
0
Does anyone know of a syntax highlight for Mako templates for Eclipse or for TextMate? I know that there is a .mako syntax highlighter for the default text editor in Ubuntu.
Syntax Highlight for Mako in Eclipse or TextMate?
0.028564
0
0
5,178
922,774
2009-05-28T19:35:00.000
3
0
1
0
python,typechecking,python-2.5
922,799
9
false
0
0
Check the type with isinstance(arg, basestring)
1
66
0
I've a method that I want to be able to accept either a single string (a path, but not necessarily one that exists on the machine running the code) or a list/tuple of strings. Given that strings act as lists of characters, how can I tell which kind the method has received? I'd like to be able to accept either standard ...
Check if input is a list/tuple of strings or a single string
0.066568
0
0
83,961
922,788
2009-05-28T19:37:00.000
7
0
1
1
python,kernel
922,814
4
true
0
0
It's going to be very difficult to do the process monitoring part in Python, since the python interpreter doesn't run in the kernel. I suspect there are two easy approaches to this: use the /proc filesystem if you have one (you don't mention your OS) Use dtrace if you have dtrace (again, without the OS, who knows.) ...
1
2
0
I would like seek some guidance in writing a "process profiler" which runs in kernel mode. I am asking for a kernel mode profiler is because I run loads of applications and I do not want my profiler to be swapped out. When I said "process profiler" I mean to something that would monitor resource usage by the process. i...
Writing a kernel mode profiler for processes in python
1.2
0
0
2,476
923,586
2009-05-28T22:48:00.000
0
0
1
1
python,windows,testing,environment-variables
2,318,893
3
false
0
0
You cannot use environment variables in this way. As you have discovered it is not persistent after the setting application completes
1
0
0
I'm developing a script that runs a program with other scripts over and over for testing purposes. How it currently works is I have one Python script which I launch. That script calls the program and loads the other scripts. It kills the program after 60 seconds to launch the program again with the next script. For som...
Python Environment Variables in Windows?
0
0
0
1,306
923,680
2009-05-28T23:21:00.000
1
1
0
0
php,python,linux
924,481
3
false
0
0
A permission problem is most likely the case. If apache is running as apache, then it will not have access to write to a file unless The file is owned by apache The file is in the group apache and group writable The file is world writable This is a "sticky" problem on a multi-user machine, as different people have ac...
2
1
0
Scenario: I have a php page in which I call a python script. Python script when run on the command line (Linux) shows output on the command line, as well as writes the output to a file. Python script when run through php, doesn't do either. Elaboration: I use a simple system command in PHP to run the python script as:...
When calling a Python script from a PHP script, temporary file that is created on a console run, is not created via the PHP invocation
0.066568
0
0
1,882
923,680
2009-05-28T23:21:00.000
0
1
0
0
php,python,linux
923,761
3
false
0
0
Check that the user the python script is running is has write permissions in CWD. Also, try shell_exec() or passthru() to call the script, rather than system().
2
1
0
Scenario: I have a php page in which I call a python script. Python script when run on the command line (Linux) shows output on the command line, as well as writes the output to a file. Python script when run through php, doesn't do either. Elaboration: I use a simple system command in PHP to run the python script as:...
When calling a Python script from a PHP script, temporary file that is created on a console run, is not created via the PHP invocation
0
0
0
1,882
923,691
2009-05-28T23:25:00.000
0
1
0
1
python,testing,scripting
923,720
8
false
0
0
Most commercial products install an "Agent" on the remote machines. In the linux world, you have numerous such agents. rexec and rlogin and rsh all jump to mind. These are all clients that communication with daemons running on the remote hosts. If you don't want to use these agents, you can read about them and reinven...
4
2
0
I am writing automation code in python to test the behavior of a network application. As such, my code needs to be able to start a process/script (say, tcpdump or a python script) on a server in the network, disconnect, run other processes and then later return and shutdown/evaluate the process started earlier. My ne...
How to start a process on a remote server, disconnect, then later collect output?
0
0
0
2,588
923,691
2009-05-28T23:25:00.000
0
1
0
1
python,testing,scripting
923,719
8
false
0
0
As @Gandalf mentions, you'll need nohup in addition to the backgrounding &, or the process will be SIGKILLed when the login session terminates. If you redirect your output to a log file, you'll be able to look at it later easily (and not have to install screen on all your machines).
4
2
0
I am writing automation code in python to test the behavior of a network application. As such, my code needs to be able to start a process/script (say, tcpdump or a python script) on a server in the network, disconnect, run other processes and then later return and shutdown/evaluate the process started earlier. My ne...
How to start a process on a remote server, disconnect, then later collect output?
0
0
0
2,588
923,691
2009-05-28T23:25:00.000
3
1
0
1
python,testing,scripting
923,703
8
false
0
0
nohup for starters (at least on *nix boxes) - and redirect the output to some log file where you can come back and monitor it of course.
4
2
0
I am writing automation code in python to test the behavior of a network application. As such, my code needs to be able to start a process/script (say, tcpdump or a python script) on a server in the network, disconnect, run other processes and then later return and shutdown/evaluate the process started earlier. My ne...
How to start a process on a remote server, disconnect, then later collect output?
0.07486
0
0
2,588
923,691
2009-05-28T23:25:00.000
0
1
0
1
python,testing,scripting
20,889,031
8
false
0
0
If you are using python to run the automation... I would attempt to automate everything using paramiko. It's a versatile ssh library for python. Instead of going back to the output, you could collect multiple lines of output live and then disconnect when you no longer need the process and let ssh do the killing for y...
4
2
0
I am writing automation code in python to test the behavior of a network application. As such, my code needs to be able to start a process/script (say, tcpdump or a python script) on a server in the network, disconnect, run other processes and then later return and shutdown/evaluate the process started earlier. My ne...
How to start a process on a remote server, disconnect, then later collect output?
0
0
0
2,588
923,701
2009-05-28T23:28:00.000
5
0
0
0
python,qt4,pyqt
923,757
2
false
0
1
Widgets inside the GNOME panel are called applets, and to my knowledge it's not possible to write them with anything but Gtk, since you have to use the respective GNOME library libpanel-applet (in either C, C++ or Python). System tray icons are different, because they only allow icons to be displayed inside the notifi...
1
4
0
I want to code up a panel that will be used both in Linux and Windows. Ideally it will be written in Python using PyQT. What I've found so far is the QSystemTrayIcon widget, and while that is quite useful, that's not quite what I'm looking for. That widget lets you attach a menu to the left and right clicks of an icon ...
Python taskbar applet
0.462117
0
0
1,572
925,616
2009-05-29T11:42:00.000
0
0
0
0
django,stackless,python-stackless
925,645
2
false
1
0
I think the solution would be to point eclipse at your 2.5 stackless installation unless you have a very good reason to use 2.6 over 2.5? ...or recompile for 2.6 and add it to your 2.6 installation.
2
1
0
I am trying to run a DJango Command Extension which uses stackless. I have installed Stackless Python (compiled with python 2.5) so whenever I type python2.5 at the console it fires up indicating that the version is Python 2.5.2 Stackless 3.1b3 060516 (python-2.52:72942, May 26 2009, 23:07:34) [GCC 4.3.3] on linux2 B...
Stackless installation and configuration with DJango
0
0
0
1,142
925,616
2009-05-29T11:42:00.000
0
0
0
0
django,stackless,python-stackless
4,507,213
2
false
1
0
Choose Window->preferencess in eclipse menu pydev->interpeter-Python choose tab forsed biltins press new, type "stackless"
2
1
0
I am trying to run a DJango Command Extension which uses stackless. I have installed Stackless Python (compiled with python 2.5) so whenever I type python2.5 at the console it fires up indicating that the version is Python 2.5.2 Stackless 3.1b3 060516 (python-2.52:72942, May 26 2009, 23:07:34) [GCC 4.3.3] on linux2 B...
Stackless installation and configuration with DJango
0
0
0
1,142
925,716
2009-05-29T12:22:00.000
1
0
0
0
python,file,ftp,networking,nfs
926,044
2
false
0
0
Have a look at KDE IOSlaves. They can manage all the protocol you describe, plus a few others (samba, ssh, ...). You can instantiates IOSlaves through PyKDE or if that dependency is too big, you can probably manage the ioslave from python with the subprocess module.
1
3
0
I know there is ftplib for ftp, shutil for local files, what about NFS? I know urllib2 can get files via HTTP/HTTPS/FTP/FTPS, but it can't put files. If there is a uniform library that automatically detects the protocol (FTP/NFS/LOCAL) with URI and deals with file transfer (get/put) transparently, it's even better, doe...
Is there a uniform python library to transfer files using different protocols
0.099668
0
1
1,426
925,832
2009-05-29T12:58:00.000
-2
0
1
0
python,eclipse,debugging,breakpoints,pydev
926,190
5
false
0
0
If you are already running in debug mode you can set an additional breakpoint if the program execution is currently paused (e.g. because you are already at a breakpoint). I just tried it out now with the latest Pydev - it works just fine. If you are running normally (i.e. not in debug mode) all breakpoints will be ign...
1
13
0
Hey I was wondering... I am using the pydev with eclipse and I'm really enjoying the powerful debugging features, but I was wondering: Is it possible to set a breakpoint in eclipse and jump into the interactive python interpreter during execution? I think that would be pretty handy ;) edit: I want to emphasize that my ...
Jump into a Python Interactive Session mid-program?
-0.07983
0
0
3,161
925,965
2009-05-29T13:29:00.000
2
1
0
1
python,fedora,easy-install
926,006
3
false
0
0
I suggest you create a virtualenv (or several) for installing packages into.
2
0
0
Fedora Core 9 includes Python 2.5.1. I can use YUM to get latest and greatest releases. To get ready for 2.6 official testing, I wanted to start with 2.5.4. It appears that there's no Fedora 9 YUM package, because 2.5.4 isn't an official part of FC9. I downloaded 2.5.4, did ./configure; make; make install and wound u...
Fedora Python Upgrade broke easy_install
0.132549
0
0
1,989
925,965
2009-05-29T13:29:00.000
2
1
0
1
python,fedora,easy-install
926,636
3
false
0
0
I've had similar experiences and issues when installing Python 2.5 on an older release of ubuntu that supplied 2.4 out of the box. I first tried to patch easy_install, but this led to problems with anything that wanted to use the os-supplied version of python. I was often fiddling with the tool chain to fix different e...
2
0
0
Fedora Core 9 includes Python 2.5.1. I can use YUM to get latest and greatest releases. To get ready for 2.6 official testing, I wanted to start with 2.5.4. It appears that there's no Fedora 9 YUM package, because 2.5.4 isn't an official part of FC9. I downloaded 2.5.4, did ./configure; make; make install and wound u...
Fedora Python Upgrade broke easy_install
0.132549
0
0
1,989
926,579
2009-05-29T15:23:00.000
1
0
0
0
python,django,apache,mod-python
928,519
1
false
1
0
As a workaround, and assuming you are free to install new Apache modules on the server, you might try one of mod_scgi mod_fastcgi mod_wsgi instead. I use SCGI to connect an nginx frontend webserver to my Django apps, which highlights a major benefit (decoupling from the webserver). All of these packages are availabl...
1
0
0
I am hosting a Django app on Apache using mod_python. Occasionally, I get some cryptic mod_python errors, usually of the ImportError variety, although not usually referring to the same module. The thing is, these seem to come up for a single forked subprocess, while the others operate fine, even when I force behavior...
Configure Apache to recover from mod_python errors
0.197375
0
0
281
926,814
2009-05-29T16:07:00.000
2
0
1
0
python,memcached
927,081
2
true
0
0
From a quick view into the source code: No it does not. It uses server = hash_key % len(servers) and round-robin if offline/full servers are encountered.
1
1
0
I'm using the python-memcache library, and I'm wondering if anyone knows if consistent hashing is used by that client as of 1.44.
Does python-memcache use consistent hashing?
1.2
0
0
1,100
927,866
2009-05-29T20:04:00.000
0
1
0
1
python,linux,directory,owner
927,888
6
false
0
0
Use the os.stat function.
2
25
0
How can I get the owner and group IDs of a directory using Python under Linux?
How to get the owner and group of a folder with Python on a Linux machine?
0
0
0
26,467
927,866
2009-05-29T20:04:00.000
0
1
0
1
python,linux,directory,owner
71,426,599
6
false
0
0
If you are using Linux, it is much easier. Install tree with the command yum install tree. Then execute the command 'tree -a -u -g'
2
25
0
How can I get the owner and group IDs of a directory using Python under Linux?
How to get the owner and group of a folder with Python on a Linux machine?
0
0
0
26,467
929,029
2009-05-30T04:52:00.000
0
0
0
0
python,django,many-to-many
929,073
8
false
1
0
You can achieve this looking for all the fields in the parent that are an instance of django.db.models.fields.related.RelatedManager. From your example it seems that the child classes you are talking about are not subclasses. Right?
2
84
0
In Django, when you have a parent class and multiple child classes that inherit from it you would normally access a child through parentclass.childclass1_set or parentclass.childclass2_set, but what if I don't know the name of the specific child class I want? Is there a way to get the related objects in the parent->chi...
How do I access the child classes of an object in django without knowing the name of the child class?
0
0
0
34,203
929,029
2009-05-30T04:52:00.000
24
0
0
0
python,django,many-to-many
929,128
8
false
1
0
In Python, given a ("new-style") class X, you can get its (direct) subclasses with X.__subclasses__(), which returns a list of class objects. (If you want "further descendants", you'll also have to call __subclasses__ on each of the direct subclasses, etc etc -- if you need help on how to do that effectively in Python,...
2
84
0
In Django, when you have a parent class and multiple child classes that inherit from it you would normally access a child through parentclass.childclass1_set or parentclass.childclass2_set, but what if I don't know the name of the specific child class I want? Is there a way to get the related objects in the parent->chi...
How do I access the child classes of an object in django without knowing the name of the child class?
1
0
0
34,203
929,141
2009-05-30T06:13:00.000
1
0
1
0
.net,.net-2.0,ironpython
951,508
3
true
1
0
i have found the way.... .NET 2.0 and .Net 3.0 do not have SP1. So either version of .Net with SP1 will make Ironpython work...yippee
3
0
0
I installed ironpython 2.0 in the windows xp professional box and it requires .Net framework 2.0 service pack 2 or later. The windows box has it. But still the console disappears. There is issue in either of them. Need help?
Ironpython console disappears instantly
1.2
0
0
218
929,141
2009-05-30T06:13:00.000
1
0
1
0
.net,.net-2.0,ironpython
930,888
3
false
1
0
The same result Iropython requires .NET 2.0 sp1 or later There is no error infact... I suppose Ironpython is not finding the .Net libraries where it is supposed to be. If the control panel\Add remove programs shows the .Net framework, does this mean they are installed. I am asking this question coz in forums no body h...
3
0
0
I installed ironpython 2.0 in the windows xp professional box and it requires .Net framework 2.0 service pack 2 or later. The windows box has it. But still the console disappears. There is issue in either of them. Need help?
Ironpython console disappears instantly
0.066568
0
0
218
929,141
2009-05-30T06:13:00.000
0
0
1
0
.net,.net-2.0,ironpython
929,197
3
false
1
0
What happens if you open a command prompt and run ipy from there? Run (From the command prompt) ipy -X:ExceptionDetail This will hopefully give more info. Also have a look in the Windows Event Log (Application) for any errors related to IPY. Update If you have no error recorded, try running another .Net program to see...
3
0
0
I installed ironpython 2.0 in the windows xp professional box and it requires .Net framework 2.0 service pack 2 or later. The windows box has it. But still the console disappears. There is issue in either of them. Need help?
Ironpython console disappears instantly
0
0
0
218
929,887
2009-05-30T15:05:00.000
2
0
1
0
python,file
930,010
10
false
0
0
I'd like too add to the other solutions that some of them (those who look for \n) will not work with files with OS 9-style line endings (\r only), and that they may contain an extra blank line at the end because lots of text editors append it for some curious reasons, so you might or might not want to add a check for i...
1
2
0
I have 2 simple questions about python: 1.How to get number of lines of a file in python? 2.How to locate the position in a file object to the last line easily?
Two simple questions about python
0.039979
0
0
436
929,988
2009-05-30T15:49:00.000
1
1
0
0
java,python,function,lambda
41,144,957
7
false
1
0
With the release of Java 8, lambda-expression is now available. And the lambda function in java is actually "more powerful" than the python ones. In Python, lambda-expression may only have a single expression for its body, and no return statement is permitted. In Java, you can do something like this: (int a, int b) ->...
1
23
0
Can someone please tell me if there is an equivalent for Python's lambda functions in Java?
Equivalent for Python's lambda functions in Java?
0.028564
0
0
12,221
930,397
2009-05-30T19:28:00.000
6
0
1
0
python,list,indexing
32,998,601
22
false
0
0
Ok, but what about common in almost every language way items[len(items) - 1]? This is IMO the easiest way to get last element, because it does not require anything pythonic knowledge.
4
2,574
0
How do I get the last element of a list?
How do I get the last element of a list?
1
0
0
2,809,696
930,397
2009-05-30T19:28:00.000
8
0
1
0
python,list,indexing
39,908,383
22
false
0
0
list[-1] will retrieve the last element of the list without changing the list. list.pop() will retrieve the last element of the list, but it will mutate/change the original list. Usually, mutating the original list is not recommended. Alternatively, if, for some reason, you're looking for something less pythonic, you c...
4
2,574
0
How do I get the last element of a list?
How do I get the last element of a list?
1
0
0
2,809,696
930,397
2009-05-30T19:28:00.000
0
0
1
0
python,list,indexing
68,104,450
22
false
0
0
Couldn't find any answer mentioning this. So adding. You could try some_list[~0] also. That's the tilde symbol
4
2,574
0
How do I get the last element of a list?
How do I get the last element of a list?
0
0
0
2,809,696
930,397
2009-05-30T19:28:00.000
1
0
1
0
python,list,indexing
65,459,111
22
false
0
0
If you do my_list[-1] this returns the last element of the list. Negative sequence indexes represent positions from the end of the array. Negative indexing means beginning from the end, -1 refers to the last item, -2 refers to the second-last item, etc.
4
2,574
0
How do I get the last element of a list?
How do I get the last element of a list?
0.009091
0
0
2,809,696
930,857
2009-05-30T23:28:00.000
0
0
1
0
python
72,213,695
3
false
0
0
Not sure if this will help but I had a similar problem. My problem was the main accessor file was not in the root folder. I had it inside another folder. The reference worked as soon and I moved it to the root folder.
1
2
0
In a simple program I made, I wanted to get a list from another project and access the elements from it. Since I'm new to python, I don't really have any idea what to do. In my project, I checked the box for the project name I wanted to reference and... I don't know what to do. A few google searched did me no good, so ...
Referencing another project
0
0
0
400
931,092
2009-05-31T02:10:00.000
0
0
1
0
python,string
71,039,840
26
false
0
0
my_str = "hello Fast Option: my_str[::-1] Slow Option: "".join(reversed(my_str))
2
1,553
0
There is no built in reverse function for Python's str object. What is the best way of implementing this method? If supplying a very concise answer, please elaborate on its efficiency. For example, whether the str object is converted to a different object, etc.
Reverse a string in Python
0
0
0
1,488,644
931,092
2009-05-31T02:10:00.000
298
0
1
0
python,string
931,099
26
false
0
0
@Paolo's s[::-1] is fastest; a slower approach (maybe more readable, but that's debatable) is ''.join(reversed(s)).
2
1,553
0
There is no built in reverse function for Python's str object. What is the best way of implementing this method? If supplying a very concise answer, please elaborate on its efficiency. For example, whether the str object is converted to a different object, etc.
Reverse a string in Python
1
0
0
1,488,644
931,423
2009-05-31T05:58:00.000
-1
1
1
0
php,python,html-entities,htmlspecialchars
931,442
8
false
1
0
If you are using django 1.0 then your template variables will already be encoded and ready for display. You also use the safe operator {{ var|safe }} if you don't want it globally turned on.
1
20
0
Is there a similar or equivalent function in Python to the PHP function htmlspecialchars()? The closest thing I've found so far is htmlentitydefs.entitydefs().
Is there a Python equivalent to the PHP function htmlspecialchars()?
-0.024995
0
0
12,591
931,580
2009-05-31T07:44:00.000
0
0
0
0
winforms,ironpython
931,629
2
false
1
1
As an interface designer, it's important to use an many standard windows controls as possible. The more your app looks like the microsoft ones users are used to, they will become more comfortable with it quicker. A good example is how out of place iTunes and Safari look in windows. My tip is to just keep it with the w...
1
0
0
I want to change the look of my Ironpython windows forms, Is it possible to change the style of the form and for example make it more like a Mac? thank you
Different styles for Windows forms in Ironpython
0
0
0
706
931,995
2009-05-31T12:48:00.000
18
0
1
0
python,math,floating-point
932,007
9
false
0
0
Always assume that floating point operations will have some error in them and check for equality taking that error into account (either a percentage value like 0.00001% or a fixed value like 0.00000000001). This inaccuracy is a given since not all decimal numbers can be represented in binary with a fixed number of bits...
2
15
0
I work daily with Python 2.4 at my company. I used the versatile logarithm function 'log' from the standard math library, and when I entered log(2**31, 2) it returned 31.000000000000004, which struck me as a bit odd. I did the same thing with other powers of 2, and it worked perfectly. I ran 'log10(2**31) / log10(2)' a...
Inaccurate Logarithm in Python
1
0
0
10,703