Available Count
int64
1
31
AnswerCount
int64
1
35
GUI and Desktop Applications
int64
0
1
Users Score
int64
-17
588
Q_Score
int64
0
6.79k
Python Basics and Environment
int64
0
1
Score
float64
-1
1.2
Networking and APIs
int64
0
1
Question
stringlengths
15
7.24k
Database and SQL
int64
0
1
Tags
stringlengths
6
76
CreationDate
stringlengths
23
23
System Administration and DevOps
int64
0
1
Q_Id
int64
469
38.2M
Answer
stringlengths
15
7k
Data Science and Machine Learning
int64
0
1
ViewCount
int64
13
1.88M
is_accepted
bool
2 classes
Web Development
int64
0
1
Other
int64
1
1
Title
stringlengths
15
142
A_Id
int64
518
72.2M
1
4
0
1
6
0
0.049958
0
I m using shutil.copy from python to copy a list of files. But when i copy the files to /usr/lib/ location, i m getting permission denied as i need to be an administrator to do that. So How could i copy files with admin permission or how could i get the admin password from the user to copy the files? Ideas would be appreciated
0
python,file-permissions
2010-09-28T09:04:00.000
1
3,811,197
Start your program with a user that is allowed to write there. For example login to root first (su) or run the script with sudo myscript.py.
0
7,772
false
0
1
Getting admin password while copy file using shutil.copy?
3,811,219
1
2
1
0
2
0
0
0
I have used Lua.NET on .NET platform and I could call the .NET class/object from Lua and I could call the Lua from .NET Lua API interface. I did the same with the IronPython. I knew the how the .NET binding works. Now I have a C++ project and I want to use the dynamic capabilities. I want to call C++ object which may not be possible from Lua so I may need to call some C API which makes call to C++. Meantime I want to call the Lua from C++. We have configuration data which is best described in table like format in Lua or List & Dict like in Python. We need to enumerate these data structures defined in Lua/Python in C++. When considering Lua to Python in C++ for two way calling, is Python have upper hand with Boost Python library? I don't have experience in Python/C++ binding. I don't have equal experience of using Python in C++ and calling Python from C++.
0
c++,python,boost,lua,embedding
2010-09-29T04:22:00.000
0
3,818,703
If you are planning to just use windows you could use C++/CLI a managed variant of C++. With C++/CLI you can easily mix managed and unmanaged code. You could call the managed classes from any .net language and the unmanaged (exported) functions from C.
0
3,491
false
0
1
Lua or Python binding with C++
3,819,333
1
2
0
2
3
0
0.197375
0
I am building Froyo, is it possible that during building, make/python can output the file and the command it is calling right now. For example, in one of the Android.mk, there is a line, says, echo build success. On the monitor it will show "build success", what I want is that in addition, it shows "Android.mk line 20: echo build success". Is it possible?
0
python,android,debugging,build,trace
2010-09-29T23:23:00.000
0
3,826,604
I've just experienced an odd effect of using $(info) when compiling a java+C++ Android application: I used $info) to output some informations about conditional compiling in the Android.mk of the main application and when trying to debug the native part of the program, using ndk-gdb, it failed because apparently the output of $(info) is read by the ndk-gdb script (using the get_build_var() and get_build_var_for_abi() functions). THe result is that the ndk-gdb script is not executed properly.
0
4,399
false
1
1
Android.mk debug output
9,443,567
1
4
0
1
5
0
0.049958
0
I would test via a python script whether a passwordless ssh login has been setup or not. If i run the normal ssh command then it will wait to accept the password for some amount of time. Is there a way where the ssh command should return an error as soon as ssh asks for a password. Is it possible to achieve this?
0
python,ssh,ssh-keys
2010-09-30T12:36:00.000
0
3,830,508
paramiko will raise an AuthenticationException if you don't pass a password to the SSHClient's .connect() method and a working key cannot be found.
0
3,677
false
0
1
Check if passwordless access has been setup
3,830,595
1
2
0
8
11
0
1
1
I just need to write a simple python CGI script to parse the contents of a POST request containing JSON. This is only test code so that I can test a client application until the actual server is ready (written by someone else). I can read the cgi.FieldStorage() and dump the keys() but the request body containing the JSON is nowhere to be found. I can also dump the os.environ() which provides lots of info except that I do not see a variable containing the request body. Any input appreciated. Chris
0
python,parsing,cgi,request
2010-10-01T05:49:00.000
0
3,836,828
notice that if you call cgi.FieldStorage() before in your code, you can't get the body data from stdin, because it just be read once.
0
8,362
false
0
1
How to parse the "request body" using python CGI?
39,910,366
1
2
0
8
2
1
1.2
0
I just want to know how I can call certian classes in design pattern here, like which type are they classified in OO design (1) I use a class that has just named constants , this class is used directly other classes to get values of constants in it.I dont instantiate the class. (2) I use a class with full of static methods, this class is basically used by other classes as a holder of methods that are used by them. So again i dont instantiate the class. What are these kinda classes classified under OOdesign? Can I do it in a more elegant way?
0
python,oop
2010-10-02T02:49:00.000
0
3,844,158
What are these kinda classes classified under OOdesign? Can I do it in a more elegant way? You do have better alternatives, IMHO. I use a class that has just named constants , this class is used directly other classes to get values of constants in it.I dont instantiate the class. For e.g. in this case you don't necessarily need a class. You can have a settings module that defines the various "constants". I put constants in quotes because there are no constants in Python the way there are in say, Java. (2) I use a class with full of static methods, this class is basically used by other classes as a holder of methods that are used by them. So again i dont instantiate the class. Again, no need for a class. You can have one or more modules that contain these methods or rather, functions. They can be logically grouped as you see fit. I'd like to add a note that you don't have to stick to (Java style?) "classes only" approach (for lack of a better phrase). Rather try to write code that doesn't go against the grain of the language. In Python's case I'd argue that such classes as you described above are best avoided. They seem to me like a carry over from Java.
0
705
true
0
1
Static or constant or what are they?
3,844,175
1
3
0
12
16
1
1
0
When an attribute is not found object.__getattr__ is called. Is there an equivalent way to intercept undefined methods?
0
python,object,methods,getattr
2010-10-04T12:02:00.000
0
3,855,015
There is no difference. A method is also an attribute. (If you want the method to have an implicit "self" argument, though, you'll have to do some more work to "bind" the method).
0
6,173
false
0
1
__getattr__ equivalent for methods
3,855,032
1
10
0
4
20
1
0.07983
0
What is the fastest way to sort an array of whole integers bigger than 0 and less than 100000 in Python? But not using the built in functions like sort. Im looking at the possibility to combine 2 sport functions depending on input size.
0
python,arrays,performance,sorting
2010-10-04T13:12:00.000
0
3,855,537
Radix sort theoretically runs in linear time (sort time grows roughly in direct proportion to array size ), but in practice Quicksort is probably more suited, unless you're sorting absolutely massive arrays. If you want to make quicksort a bit faster, you can use insertion sort] when the array size becomes small. It would probably be helpful to understand the concepts of algorithmic complexity and Big-O notation too.
1
57,933
false
0
1
Fastest way to sort in Python
3,859,736
3
4
0
2
0
0
0.099668
0
We have an in house developed web-based admin console that uses a combination of C CGI and Perl scripts to administer our mail server stack. Of late we have been thinking of cleaning up the code (well, replacing most of it), making the implementation more secure, and improving the overall behavior. I don't have much programming knowledge, but I use Ruby on and off (mainly for writing erb templates), and hence was thinking of using ruby/rails for developing such an app (off-duty for now, I also need to learn stuff !). Before blindly picking up a language though, what would you folks suggest ? Please let me know if this is too vague a question, I'll try to supply more information, if needed.
0
python,ruby,migration,administration
2010-10-05T05:43:00.000
0
3,861,102
Have you considered writing your applications as Webmin modules? You get a lot of stuff for free when you do so (users and groups, tons of security features, a pretty big variety of helper functions related to config files, and tons of existing code for most aspects of a UNIX/Linux system). You also get a lot of stuff for nearly free, like action logging, packages and updates via wbm or apt or yum, an online help system, etc. There are some cons, as well. It's an old codebase, so it has some clunky bits in the API among other places. A lot of the old modules can be a bit hard to grok if you're not an old-school Perl programmer. But, it's a well-maintained codebase, and it's been banged on by millions of users for over a dozen years. It's pretty robust. The UI isn't beautiful, but it is relatively theme-able, and if you're distributing a minimized version it becomes easier to customize the UI. I suspect you can be up and running a lot faster than starting from scratch or using most existing frameworks that aren't targeted specifically to building systems management interfaces the way Webmin is. Also, it's BSD licensed, so you can do whatever you want with it, including building a custom commercial app with it (hundreds of companies have done so over the years).
0
155
false
1
1
Which language to use for writing an admin console à la webmin?
3,868,363
3
4
0
0
0
0
0
0
We have an in house developed web-based admin console that uses a combination of C CGI and Perl scripts to administer our mail server stack. Of late we have been thinking of cleaning up the code (well, replacing most of it), making the implementation more secure, and improving the overall behavior. I don't have much programming knowledge, but I use Ruby on and off (mainly for writing erb templates), and hence was thinking of using ruby/rails for developing such an app (off-duty for now, I also need to learn stuff !). Before blindly picking up a language though, what would you folks suggest ? Please let me know if this is too vague a question, I'll try to supply more information, if needed.
0
python,ruby,migration,administration
2010-10-05T05:43:00.000
0
3,861,102
django has a nice admin interface
0
155
false
1
1
Which language to use for writing an admin console à la webmin?
3,897,721
3
4
0
0
0
0
1.2
0
We have an in house developed web-based admin console that uses a combination of C CGI and Perl scripts to administer our mail server stack. Of late we have been thinking of cleaning up the code (well, replacing most of it), making the implementation more secure, and improving the overall behavior. I don't have much programming knowledge, but I use Ruby on and off (mainly for writing erb templates), and hence was thinking of using ruby/rails for developing such an app (off-duty for now, I also need to learn stuff !). Before blindly picking up a language though, what would you folks suggest ? Please let me know if this is too vague a question, I'll try to supply more information, if needed.
0
python,ruby,migration,administration
2010-10-05T05:43:00.000
0
3,861,102
If you already know a bit of ruby, then there's no reason not to use that. If you're interested specifically in learning another language, then what you're trying to do could be done in pretty much any language/framework, it's just a matter of which one you want to learn.
0
155
true
1
1
Which language to use for writing an admin console à la webmin?
3,861,123
3
3
0
1
15
0
0.066568
0
I am using PyDev/Eclipse for several monthes and I get ever and ever the same bugs with imports: PyDev underline in red an import and say Unresolved import xxx ; Found at yyy. When I click on yyy eclispe find and open the implementation of the module. (PyDev just inform me that it can't find the module xxx and in the same message that it can find it !) The module xxx is in the PYTHONPATH of eclipse. When I "explore" the interpreter of the project, I can find it without any problems. When I try to execute (from eclipse), I don't get any error and it works fine. Sometimes, the error message will stay for several days and will disappear. Sometimes, it won't. I've tried to refresh the projects but it has not impact on that. Somtimes, it works well on a project and I can use autocompletion and it don't work in another project (same interpreter) ... I just can't understand what is happenning ? So far, I have ignored these bugs because everything was fully fonctionnal but sometimes, it is a bit disturbing to have red markers "errors" when you are working. Did you find a way to avoid these bugs in PyDev ? Is it "normal" ? Is there a way to force PyDev to "refresh" ? Thank you. References : python 2.4.4 (built from sources) PyDev v 1.6.0 2010071813
0
python,eclipse,pydev
2010-10-05T11:55:00.000
0
3,863,369
You can try refreshing your PYTHONPATH in Preferences > Pydev > Interpreter - Python and selecting AutoConfig for your interpreter, then manually choosing the libraries for your PYTHONPATH. This is pretty radical solution though. Making an insignificant change (like adding a space) and saving file should work in most cases. If not, you can also try temporary delete and then re-add the imports in file that is causing problems.
0
6,201
false
0
1
PyDev bugs with imports
3,863,743
3
3
0
16
15
0
1.2
0
I am using PyDev/Eclipse for several monthes and I get ever and ever the same bugs with imports: PyDev underline in red an import and say Unresolved import xxx ; Found at yyy. When I click on yyy eclispe find and open the implementation of the module. (PyDev just inform me that it can't find the module xxx and in the same message that it can find it !) The module xxx is in the PYTHONPATH of eclipse. When I "explore" the interpreter of the project, I can find it without any problems. When I try to execute (from eclipse), I don't get any error and it works fine. Sometimes, the error message will stay for several days and will disappear. Sometimes, it won't. I've tried to refresh the projects but it has not impact on that. Somtimes, it works well on a project and I can use autocompletion and it don't work in another project (same interpreter) ... I just can't understand what is happenning ? So far, I have ignored these bugs because everything was fully fonctionnal but sometimes, it is a bit disturbing to have red markers "errors" when you are working. Did you find a way to avoid these bugs in PyDev ? Is it "normal" ? Is there a way to force PyDev to "refresh" ? Thank you. References : python 2.4.4 (built from sources) PyDev v 1.6.0 2010071813
0
python,eclipse,pydev
2010-10-05T11:55:00.000
0
3,863,369
This can happen if new modules are not cached by PyDev. For example, on my new laptop I first set up PyDev/Eclipse and later installed the Django package. That's why Django imports were marked as unresolved. You can refresh it using Pydev > Interpreter - Python > Libraries > Apply. Select the interpreter you want to "restore" (they could have chosen a better word) and click OK. PyDev will then reparse all installed modules. I'm using the nightly version of PyDev, but any 1.6.x version should work correctly. If that doesn't help, remove the interpreter configure and create a new one.
0
6,201
true
0
1
PyDev bugs with imports
3,864,323
3
3
0
1
15
0
0.066568
0
I am using PyDev/Eclipse for several monthes and I get ever and ever the same bugs with imports: PyDev underline in red an import and say Unresolved import xxx ; Found at yyy. When I click on yyy eclispe find and open the implementation of the module. (PyDev just inform me that it can't find the module xxx and in the same message that it can find it !) The module xxx is in the PYTHONPATH of eclipse. When I "explore" the interpreter of the project, I can find it without any problems. When I try to execute (from eclipse), I don't get any error and it works fine. Sometimes, the error message will stay for several days and will disappear. Sometimes, it won't. I've tried to refresh the projects but it has not impact on that. Somtimes, it works well on a project and I can use autocompletion and it don't work in another project (same interpreter) ... I just can't understand what is happenning ? So far, I have ignored these bugs because everything was fully fonctionnal but sometimes, it is a bit disturbing to have red markers "errors" when you are working. Did you find a way to avoid these bugs in PyDev ? Is it "normal" ? Is there a way to force PyDev to "refresh" ? Thank you. References : python 2.4.4 (built from sources) PyDev v 1.6.0 2010071813
0
python,eclipse,pydev
2010-10-05T11:55:00.000
0
3,863,369
Just in case anyone else runs into this thread but above answers don't solve the issue, make sure that your script does not have the same name as the library that you are trying to import.
0
6,201
false
0
1
PyDev bugs with imports
38,688,200
1
1
0
3
2
1
1.2
0
While I'm familiar with making .net assemblies with the PythonModule assembly attribute, I'm a little curious as to how you could make submodules. Would this be a class within a class? i.e: if I have a class defined as an IronPython module such as: [assembly: PythonModule(mymodule),typeof(namespace.mymodule)] How could I define a submodule within mymodule, so that from python I could do: import mymodule.submodule Thanks in advance!
0
ironpython
2010-10-05T20:17:00.000
0
3,867,377
It's interesting, there's actually no support for this at all right now. For the most part this has been used to implement built-in modules that exist in CPython and there's simply been no need for submodules yet. You could have a nested static class in the class used for the module but it wouldn't import as a module - it'd show up as a type object in Python.
0
183
true
0
1
submodules in ironpython
3,869,625
1
6
0
1
1
1
0.033321
0
What is the best way to approach writing a program in Python to translate English words and/or phrases into other languages?
0
python,localization,linguistics
2010-10-05T21:24:00.000
0
3,867,860
the simplest way to do this is to make a dictionary that matches one language's words to another language's words. However, this is extremely silly and would not take into account grammar at all and it would literally take a very long time to create a translator, especially if you plan to use it for multiple languages. If grammar is not important to you (for example, if you were creating your own language for a game or story that doesn't have grammar different from english) than you could get away with using dictionaries and simply having a function look for a requested match in the dictionary
0
2,381
false
0
1
Python - English translator
3,868,983
7
11
1
0
3
1
0
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
0
python,c,decompiling
2010-10-06T04:07:00.000
0
3,869,435
Python scripts are analogous to a man looking at a to-do list written in English (or language he understands). The man has to do all the work, every time that list of things has to be done. If the man, instead of doing the steps on his own each time, creates and programs a robot which can carry out those steps again and again (and probably faster than him), that robot is analogous to the C program. The man in the python case is called the "interpreter" and in the C case is called the "compiler", and the C robot is called the compiled program/executable. When you look at the python program source, you see the to-do list. In case of the robot, you see the gears, motors and batteries, etc, which look very different from the to-do list. If you could get hold of the C "to-do" list, it looks somewhat like the python code, just in a different language.
0
801
false
0
1
Why do C programs require decompilers but python programs dont?
3,869,481
7
11
1
5
3
1
0.090659
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
0
python,c,decompiling
2010-10-06T04:07:00.000
0
3,869,435
This is sorta a big topic. You should look into your local friendly Computer Science curriculum, you'll find a lot of great stuff on this subject there. The short answer is the Python is an "interpreted" language, which means that it requires a machine language program (the python interpreter) to run the python program, adding a layer of indirection. C or C++ are different. They are compiled directly to machine code, which runs directly on your processor. There is a lot of additional voodoo to be learned here, however. Technically Python is compiled to a bytecode, and modern interpreters do more and more "Just in Time" compilation, so the boundaries between compiled and interpreted code are getting fuzzier all the time.
0
801
false
0
1
Why do C programs require decompilers but python programs dont?
3,869,458
7
11
1
1
3
1
0.01818
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
0
python,c,decompiling
2010-10-06T04:07:00.000
0
3,869,435
because C code is complied to object (machine) code and python code is compiled into an intermediate byte code. I am not sure if you are even referring to the byte code of python - you must be referring to the source file itself which is directly executable (hiding the byte code from you!). C needs to be compiled and linked.
0
801
false
0
1
Why do C programs require decompilers but python programs dont?
3,869,445
7
11
1
0
3
1
0
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
0
python,c,decompiling
2010-10-06T04:07:00.000
0
3,869,435
Python scripts are parsed and converted to binary only when they're run - i.e., they're text files and you can read them with an editor. C code is compiled and linked to an executable binary file before they can be run. Normally, only this executable binary file is distributed - hence you need a decompiler. You can always view the source code, if you've access to it.
0
801
false
0
1
Why do C programs require decompilers but python programs dont?
3,869,451
7
11
1
0
3
1
0
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
0
python,c,decompiling
2010-10-06T04:07:00.000
0
3,869,435
G-WAN executes ANSI C scripts on the fly -making it just like Python scripts. This can be server-side scripts (using G-WAN as a Web server) or any general-purpose C program and you can link any existing library. Oh, and G-WAN C scripts are much faster than Python, PHP or Java...
0
801
false
0
1
Why do C programs require decompilers but python programs dont?
3,874,099
7
11
1
10
3
1
1
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
0
python,c,decompiling
2010-10-06T04:07:00.000
0
3,869,435
Python is a script language, runs in a virtual machine through an interpeter. C is a compiled language, the code compiled to binary code which the computer can run without all that extra stuff Python needs.
0
801
false
0
1
Why do C programs require decompilers but python programs dont?
3,869,443
7
11
1
2
3
1
0.036348
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
0
python,c,decompiling
2010-10-06T04:07:00.000
0
3,869,435
Yes, you can - it's called disassembling, and allows you to look at the code of Safari perfectly well. The thing is, C, among other languages, compiles to native code, i.e. code that your CPU can "understand" and execute. More or less obviously, the level of abstraction present in the instruction set of your CPU is much smaller than that of a high level language like Python. The CPU instructions are not concerned with "downloading that URI", but more "check if that bit is set in a hardware register". So, in conclusion, the level of complexity present in a native application is much higher when looking at the machine code, so many people simply can't make any sense of what is going on there, it's hard to get the big picture. With experience and time at your hands, it is possible though - people do it all the time, reversing applications and all.
0
801
false
0
1
Why do C programs require decompilers but python programs dont?
3,869,460
1
3
0
0
4
0
0
0
What I'm trying to do: I want to give the user the ability to upload a picture that is any size. This image is then resized if it is over 1024 wide or over 768 high. It then resizes the image to be within those bounds, but keeping proportions. Then it adds a semi-transparent watermark to the lower right corner, and saves the file. Before it adds the watermark, it will create a copy of the image and resize it down to a thumbnail size (also keeping proportions) and saves it in a separate folder. The Problems with PIL: As far as resizing goes, I was hoping it would have a way to do smart resizing (keep proportions). Also, I didn't seem to have much control over the quality level when saving it as a JPEG. I had to save it as a PNG to keep full quality which was pretty heavy. For the thumbnail, it sounds that it might be pretty difficult, reading through the documentation of PIL, but I could be wrong. The Question Are there any other, more advanced image libraries for Python that may be a bit more up to date, or include some features that I am looking for? Are there any public functions that do what I'm looking for that I could use? I don't mind writing this stuff myself, but wanted to check first. Thanks!
0
python,image,python-imaging-library
2010-10-06T04:34:00.000
0
3,869,517
In a pinch, convert the Image to a numpy array, modify it as you please, and convert back.
0
5,217
false
0
1
Simple Image Manipulation with Python
3,869,781
1
3
0
2
0
0
0.132549
0
... or if not, can you provide me link or RFC number to full algorithm (from getting ASCII encoded Private key file/string to generation of ASCII encoded public key file/string). To show you a bigger picture - I started using a pylibssh2 library. This library has a method - userauth_publickey_fromfile (it raises NotImplementedException, but when you force launching python binding - it works). The problem is that this method wants private key (good) and public key (hell knows why). Of course, I can pass both of those keys as argumets to my functions, but I think it is unnecessary, and I don't want to expect one more variable just for that. So I want to generate public key from private one by myself. Maybe I'm missing something in pylibssh2 or even in libssh2 itself (I can write bindings for that as well) ? Thanks for any help!
0
python,ssh-keys
2010-10-06T19:20:00.000
0
3,876,114
Do you need the answer to be strictly python? You can do this with ssh-keygen -y -f privatekey
0
1,486
false
0
1
Is there any way to generate public SSH key from private one using Python?
3,876,193
1
1
0
0
0
0
1.2
0
In order to make the registration process on my website easy, I allow users to enter their email address which I will send a verification code to or alternatively they can solve a captcha. The problem is that in order to prevent robots from registering accounts (with fake emails) I limit the number of registrations allowed per IP address and if this limit is exceeded I trigger a warning in the logs. However ... what seems to be happening is that I am using os.environ['REMOTE_ADDR'] to check the remote address -- but it seems that I am triggering warnings on addresses that are owned by Google (66.249.65.XXX). It is possible that this is happening only after I change the version (but not confirmed). Does anyone know how/why this might be happening? Shouldn't the REMOTE_ADDR return the address of the client computer (and hopefully in all cases it would do this)? I am curious if there is some behind the scenes re-directions going on, and if this is a normal event or if it only happens when a new version is installed (perhaps when a new version is installed the original server then proxies the user to the new server, therefore creating the illusion that the IP address is an internal IP?)
0
python,google-app-engine,ip-address
2010-10-06T23:28:00.000
0
3,877,631
I believe that I have figured out the reason for seeing so many warnings from google server IP addresses. It seems that immediately after a new user registers, the google crawlers are going to the same (registration) webpage (which I send information to as a GET instead of a POST for reasons which I will not get into). Of course, since many users are registering, but there are only a few crawler computers that are checking periodic updates to my website, I am triggering warning messages that a particular (google) IP is accessing a registration area repeatedly.
0
438
true
1
1
Google App Engine (Python)- Strange behaviour of REMOTE_ADDR
3,877,766
2
3
1
2
1
0
0.132549
0
Is anybody familiar with Worldviz-Vizard's 3D engine for python? How does it compare to Panda3D? I have a feeling that it might be easier to learn but far more limited. They only support python 2.4 which also makes me not want to try it.
0
python,pygame,3d-engine,panda3d
2010-10-07T00:54:00.000
0
3,877,971
Been using Vizard for various VR and AR development for about 3 yrs now - it's NOT unity - i.e. a web enabled game engine (excellent though it is) - what Vizard provides is a highly optimized OpenGL engine, wrapped in user friendly python scripting environment BUT on top of this you get the ability to seamlessly distribute your simulations over a cluster or a network. Vizard keeps all things completely synched - invisible to the user. Connects to pretty much all known VR tracking equipment and display periphals and standard gaming equipment is also supported (Wiimote & Kinnect). Native support for frame sequential, side-by-side and anaglyph stereo, spatial sound engine and the ability to extend it with C and C++ plugins or GLSL shaders. Didn't actually mean to write that much and I don't want to come across as a Vizard evangelist, it is not perfect, BUT comparing it to Panda3D, Unity or other game engines I feel is an unfair comparison - not like-for-like :o)
0
1,459
false
0
1
How does Worldviz Vizard compares to Panda3D and Pygame?
6,589,557
2
3
1
0
1
0
0
0
Is anybody familiar with Worldviz-Vizard's 3D engine for python? How does it compare to Panda3D? I have a feeling that it might be easier to learn but far more limited. They only support python 2.4 which also makes me not want to try it.
0
python,pygame,3d-engine,panda3d
2010-10-07T00:54:00.000
0
3,877,971
I only used Vizard, and that for one small project. It was easy to use, well documented, and had a good set of examples.
0
1,459
false
0
1
How does Worldviz Vizard compares to Panda3D and Pygame?
4,122,231
1
2
0
0
33
1
0
0
I understand that when you import a module, that file is compiled into a .pyc file to make it faster? Why is the main file also not compiled to a .pyc? Does this slow things down? Would it be better to keep the main file as small as possible then, or does it not matter?
0
python
2010-10-07T03:33:00.000
0
3,878,479
Compiling the main script would be annoying for scripts in e.g. /usr/bin. The .pyc file is generated in the same directory, thus polluting the public location.
0
26,157
false
0
1
Why are main runnable Python scripts not compiled to pyc files like modules?
3,878,507
1
2
0
0
4
1
0
0
I want to create a gmail client with the ability to view emails as conversations (threads). In imaplib, there is a method: IMAP4.thread(threading_algorithm, charset, search_criterion[, ...]) I think it could be the solution. Anybody has experience using it? Please give an example. Thanks.
0
python,client,imaplib,gmail-imap,email-threading
2010-10-07T06:38:00.000
0
3,879,265
As far as i know, Gmail uses an algorithm that is private, and it's not stated in RFCs. They use a combination of headers (like in-reply-to and references) and considering subject (but in a different way that THREAD=references does).
0
1,250
false
0
1
How to use thread search method in imaplib?
34,061,867
2
2
0
0
5
1
0
0
I was wondering whether objects serialized using CPython's cPickle are readable by using IronPython's cPickle; the objects in question do not require any modules outside of the built-ins that both Cpython and IronPython include. Thank you!
0
python,ironpython,pickle
2010-10-07T14:35:00.000
0
3,882,750
It will work because when you unpickle objects during load() it will use the current definitions of whatever classes you have defined now, not back when the objects were pickled. IronPython is simply Python with the standard library implemented in C# so that everything emits IL. Both the CPython and the IronPython pickle modules have the same functionality, except one is implemented in C and the other in C#.
0
871
false
0
1
compatibility between CPython and IronPython cPickle
3,927,390
2
2
0
2
5
1
0.197375
0
I was wondering whether objects serialized using CPython's cPickle are readable by using IronPython's cPickle; the objects in question do not require any modules outside of the built-ins that both Cpython and IronPython include. Thank you!
0
python,ironpython,pickle
2010-10-07T14:35:00.000
0
3,882,750
If you use the default protocol (0) which is text based, then things should work. I'm not sure what will happen if you use a higher protocol. It's very easy to test this ...
0
871
false
0
1
compatibility between CPython and IronPython cPickle
3,883,735
3
3
0
9
8
1
1.2
0
My project targets a low-cost and low-resource embedded device. I am dependent on a relatively large and sprawling Python code base, of which my use of its APIs is quite specific. I am keen to prune the code of this library back to its bare minimum, by executing my test suite within a coverage tools like Ned Batchelder's coverage or figleaf, then scripting removal of unused code within the various modules/files. This will help not only with understanding the libraries' internals, but also make writing any patches easier. Ned actually refers to the use of coverage tools to "reverse engineer" complex code in one of his online talks. My question to the SO community is whether people have experience of using coverage tools in this way that they wouldn't mind sharing? What are the pitfalls if any? Is the coverage tool a good choice? Or would I be better off investing my time with figleaf? The end-game is to be able to automatically generate a new source tree for the library, based on the original tree, but only including the code actually used when I run nosetests. If anyone has developed a tool that does a similar job for their Python applications and libraries, it would be terrific to get a baseline from which to start development. Hopefully my description makes sense to readers...
0
python,code-coverage,reverse-engineering,code-analysis
2010-10-07T15:56:00.000
0
3,883,484
What you want isn't "test coverage", it is the transitive closure of "can call" from the root of the computation. (In threaded applications, you have to include "can fork"). You want to designate some small set (perhaps only 1) of functions that make up the entry points of your application, and want to trace through all possible callees (conditional or unconditional) of that small set. This is the set of functions you must have. Python makes this very hard in general (IIRC, I'm not a deep Python expert) because of dynamic dispatch and especially due to "eval". Reasoning about what function can get called can be pretty tricky for a static analyzers applied to highly dynamic languages. One might use test coverage as a way to seed the "can call" relation with specific "did call" facts; that could catch a lot of dynamic dispatches (dependent on your test suite coverage). Then the result you want is the transitive closure of "can or did" call. This can still be erroneous, but is likely to be less so. Once you get a set of "necessary" functions, the next problem will be removing the unnecessary functions from the source files you have. If the number of files you start with is large, the manual effort to remove the dead stuff may be pretty high. Worse, you're likely to revise your application, and then the answer as to what to keep changes. So for every change (release), you need to reliably recompute this answer. My company builds a tool that does this analysis for Java packages (with appropriate caveats regarding dynamic loads and reflection): the input is a set of Java files and (as above) a designated set of root functions. The tool computes the call graph, and also finds all dead member variables and produces two outputs: a) the list of purportedly dead methods and members, and b) a revised set of files with all the "dead" stuff removed. If you believe a), then you use b). If you think a) is wrong, then you add elements listed in a) to the set of roots and repeat the analysis until you think a) is right. To do this, you need a static analysis tool that parse Java, compute the call graph, and then revise the code modules to remove the dead entries. The basic idea applies to any language. You'd need a similar tool for Python, I'd expect. Maybe you can stick to just dropping files that are completely unused, although that may still be a lot of work.
0
2,137
true
0
1
Using Python code coverage tool for understanding and pruning back source code of a large library
3,886,403
3
3
0
0
8
1
0
0
My project targets a low-cost and low-resource embedded device. I am dependent on a relatively large and sprawling Python code base, of which my use of its APIs is quite specific. I am keen to prune the code of this library back to its bare minimum, by executing my test suite within a coverage tools like Ned Batchelder's coverage or figleaf, then scripting removal of unused code within the various modules/files. This will help not only with understanding the libraries' internals, but also make writing any patches easier. Ned actually refers to the use of coverage tools to "reverse engineer" complex code in one of his online talks. My question to the SO community is whether people have experience of using coverage tools in this way that they wouldn't mind sharing? What are the pitfalls if any? Is the coverage tool a good choice? Or would I be better off investing my time with figleaf? The end-game is to be able to automatically generate a new source tree for the library, based on the original tree, but only including the code actually used when I run nosetests. If anyone has developed a tool that does a similar job for their Python applications and libraries, it would be terrific to get a baseline from which to start development. Hopefully my description makes sense to readers...
0
python,code-coverage,reverse-engineering,code-analysis
2010-10-07T15:56:00.000
0
3,883,484
I haven't used coverage for pruning out, but it seems like it should do well. I've used the combination of nosetests + coverage, and it worked better for me than figleaf. In particular, I found the html report from nosetests+coverage to be helpful -- this should be helpful to you in understanding where the unused portions of the library are.
0
2,137
false
0
1
Using Python code coverage tool for understanding and pruning back source code of a large library
3,883,765
3
3
0
2
8
1
0.132549
0
My project targets a low-cost and low-resource embedded device. I am dependent on a relatively large and sprawling Python code base, of which my use of its APIs is quite specific. I am keen to prune the code of this library back to its bare minimum, by executing my test suite within a coverage tools like Ned Batchelder's coverage or figleaf, then scripting removal of unused code within the various modules/files. This will help not only with understanding the libraries' internals, but also make writing any patches easier. Ned actually refers to the use of coverage tools to "reverse engineer" complex code in one of his online talks. My question to the SO community is whether people have experience of using coverage tools in this way that they wouldn't mind sharing? What are the pitfalls if any? Is the coverage tool a good choice? Or would I be better off investing my time with figleaf? The end-game is to be able to automatically generate a new source tree for the library, based on the original tree, but only including the code actually used when I run nosetests. If anyone has developed a tool that does a similar job for their Python applications and libraries, it would be terrific to get a baseline from which to start development. Hopefully my description makes sense to readers...
0
python,code-coverage,reverse-engineering,code-analysis
2010-10-07T15:56:00.000
0
3,883,484
As others have pointed out, coverage can tell you what code has been executed. The trick for you is to be sure that your test suite truly exercises the code fully. The failure case here is over-pruning because your tests skipped some code that will really be needed in production. Be sure to get the latest version of coverage.py (v3.4): it adds a new feature to indicate files that are never executed at all. BTW:: for a first cut prune, Python provides a neat trick: remove all the .pyc files in your source tree, then run your tests. Files that still have no .pyc file were clearly not executed!
0
2,137
false
0
1
Using Python code coverage tool for understanding and pruning back source code of a large library
3,890,093
1
1
1
1
0
0
0.197375
0
Due to refactoring/reworking on a controller I've had to embed a Python Interpreter inside a C application. I can now call python functions and pass/get Objects into Python fine. The python code is a controller for a robot (currently simulated), this now needs make use of some C code for comparisons I'm making. Previously the Python code created objects, read sensors, ran control code and wrote the outputs to motors. All of this except the control code now needs to be done in C. The problem I have is that Objects which are created in an init function (in python) which, when I come to run the control code no longer exist. What is the best way to solve this? My idea was to return the controllers from the init function and store references to them in the C, passing the reference to the controller each time it is called. Thanks for any help.
0
python,c,embedded-language
2010-10-07T16:26:00.000
0
3,883,724
This may not be the answer you want, but there are ways of working with C and Python other than embedding an interpreter inside a C application. Namely, why don't you do the opposite? Create C libraries for Python? You can control the general flow of your application in Python, which is much more comfortable, and call C code whenever you see fit. Again, I'm not really addressing your actual question, so feel free to ignore me.
0
102
false
0
1
Maintaining a Python Object when embedding in C
3,884,055
4
5
0
5
6
0
0.197375
0
I'm wondering if there is a test framework that allows for tests to be declared as being dependent on other tests. This would imply that they should not be run, or that their results should not be prominently displayed, if the tests that they depend on do not pass. The point of such a setup would be to allow the root cause to be more readily determined in a situation where there are many test failures. As a bonus, it would be great if there some way to use an object created with one test as a fixture for other tests. Is this feature set provided by any of the Python testing frameworks? Or would such an approach be antithetical to unit testing's underlying philosophy?
0
python,unit-testing,testing
2010-10-07T20:09:00.000
0
3,885,489
Or would such an approach be antithetical to unit testing's underlying philosophy? Yep...if it is a unit test, it should be able to run on its own. Anytime I have found someone wanting to create dependencies on tests was due to the code being structured in a poor manner. I am not saying this is the instance in your case but it can often be a sign of code smell.
0
1,809
false
0
1
Test framework allowing tests to depend on other tests
3,885,518
4
5
0
0
6
0
0
0
I'm wondering if there is a test framework that allows for tests to be declared as being dependent on other tests. This would imply that they should not be run, or that their results should not be prominently displayed, if the tests that they depend on do not pass. The point of such a setup would be to allow the root cause to be more readily determined in a situation where there are many test failures. As a bonus, it would be great if there some way to use an object created with one test as a fixture for other tests. Is this feature set provided by any of the Python testing frameworks? Or would such an approach be antithetical to unit testing's underlying philosophy?
0
python,unit-testing,testing
2010-10-07T20:09:00.000
0
3,885,489
It looks like what you need is not to prevent the execution of your dependent tests but to report the results of your unit test in a more structured way that allows you to identify when an error in a test cascades onto other failed tests.
0
1,809
false
0
1
Test framework allowing tests to depend on other tests
3,891,628
4
5
0
1
6
0
0.039979
0
I'm wondering if there is a test framework that allows for tests to be declared as being dependent on other tests. This would imply that they should not be run, or that their results should not be prominently displayed, if the tests that they depend on do not pass. The point of such a setup would be to allow the root cause to be more readily determined in a situation where there are many test failures. As a bonus, it would be great if there some way to use an object created with one test as a fixture for other tests. Is this feature set provided by any of the Python testing frameworks? Or would such an approach be antithetical to unit testing's underlying philosophy?
0
python,unit-testing,testing
2010-10-07T20:09:00.000
0
3,885,489
This seems to be a recurring question - e.g. #3396055 It most probably isn't a unit-test, because they should be fast (and independent). So running them all isn't a big drag. I can see where this might help in short-circuiting integration/regression runs to save time. If this is a major need for you, I'd tag the setup tests with [Core] or some such attribute. I then proceed to write a build script which has two tasks Taskn : run all tests in X,Y,Z dlls marked with tag [Core] Taskn+1 depends on Taskn: run all tests in X,Y,Z dlls excluding those marked with tag [Core] (Taskn+1 shouldn't run if Taskn didn't succeed.) It isn't a perfect solution - e.g. it would just bail out if any one [Core] test failed. But I guess you should be fixing the Core ones instead of proceeding with Non-Core tests.
0
1,809
false
0
1
Test framework allowing tests to depend on other tests
3,895,868
4
5
0
0
6
0
0
0
I'm wondering if there is a test framework that allows for tests to be declared as being dependent on other tests. This would imply that they should not be run, or that their results should not be prominently displayed, if the tests that they depend on do not pass. The point of such a setup would be to allow the root cause to be more readily determined in a situation where there are many test failures. As a bonus, it would be great if there some way to use an object created with one test as a fixture for other tests. Is this feature set provided by any of the Python testing frameworks? Or would such an approach be antithetical to unit testing's underlying philosophy?
0
python,unit-testing,testing
2010-10-07T20:09:00.000
0
3,885,489
The test runners py.test, Nosetests and unit2/unittest2 all support the notion of "exiting after the first failure". py.test more generally allows to specify "--maxfail=NUM" to stop running and reporting after NUM failures. This may already help your case especially since maintaining and updating dependencies for tests may not be that interesting a task.
0
1,809
false
0
1
Test framework allowing tests to depend on other tests
3,897,462
1
2
0
0
4
1
0
0
Little question concerning app architecture: I have a python script, running as a daemon. Inside i have many objects, all inheriting from one class (let's name it 'entity') I have also one main object, let it be 'topsys' Entities are identified by pair (id, type (= class, roughly)), and they are connected in many wicked ways. They are also created and deleted all the time, and they are need to access other entities. So, i need a kind of storage, basically dictionary of dictionaries (one for each type), holding all entities. And the question is, what is better: attach this dictionary to 'topsys' as a object property or to class entity, as a property of the class? I would opt for the second (so entities does not need to know of existence of 'topsys'), but i am not feeling good about using properties directly in classes. Or maybe there is another way?
0
python,design-patterns,global-variables,class-design
2010-10-09T01:48:00.000
0
3,895,359
There is no problem with using properties on classes. Classes are just objects, too. In your case, with this little information available, I would go for a class property, too, because not creating dependencies ist great and will be one worry less sometimes later.
0
3,257
false
0
1
python global object cache
3,895,385
2
2
0
0
0
0
0
0
I have a CGI script (pwyky) that I called index.cgi, put in directory wiki/, and setup Apache to call localhost/wiki/index.cgi when I access localhost/wiki. I'm getting errors when I'm trying to use this application -- it creates a page with links like "http://localhost/wiki/@edit/index", but when I click that link, Apace is trying to serve "wiki/@edit/index" as a file. I suspect that I need to get Apache to pass /@edit/index into index.cgi. In particular, looking through index.cgi, its looking for strings like "@edit" in REQUEST_URI environment variable. Any idea how to fix this?
0
python,apache
2010-10-09T17:31:00.000
1
3,897,140
You'd need to show your apache configuration to say for certain, but it seems that Apache isn't actually using mod_cgi to serve the index.cgi script. In your configuration there should be something like 'LoadModule mod_cgi'. It should be uncommented (i.e., it shouldn't have a '#' at the beginning of the line). If you want to test this, then write a 'Hello World' cgi script and put it (temporarily) in place of index.cgi and see if you can get that to run. Let us know the results.
0
762
false
1
1
URL rewriting question
3,898,807
2
2
0
0
0
0
1.2
0
I have a CGI script (pwyky) that I called index.cgi, put in directory wiki/, and setup Apache to call localhost/wiki/index.cgi when I access localhost/wiki. I'm getting errors when I'm trying to use this application -- it creates a page with links like "http://localhost/wiki/@edit/index", but when I click that link, Apace is trying to serve "wiki/@edit/index" as a file. I suspect that I need to get Apache to pass /@edit/index into index.cgi. In particular, looking through index.cgi, its looking for strings like "@edit" in REQUEST_URI environment variable. Any idea how to fix this?
0
python,apache
2010-10-09T17:31:00.000
1
3,897,140
I found the problem, it turned out this is done through RewriteEngine. Pwyky puts .htaccess file in the directory with all the settings for RewriteEngine, but because AllowOverride is "None" by default on MacOS, they were ignored. The solution was to change all "AllowOverride" directives to "All"
0
762
true
1
1
URL rewriting question
3,908,016
2
2
0
2
2
0
0.197375
0
I have a Python daemon running in production. It employs between 7 and 120 threads. Recently the smallest instance (7 threads) started to show hangs while all other instances never showed this kind of problem. Attaching strace to the python process shows that all threads are calling futex FUTEX_WAIT_PRIVATE, so they are probably trying to lock something. How would you debug such a problem? Note that this is a production system running from flash memory, so disk writes are constrained, too.
0
python,multithreading,debugging,deadlock,futex
2010-10-11T11:48:00.000
0
3,905,883
Dear Helmut, I've the same problem with one thread hanging on FUTEXT_WAIT_PRIVATE. It seems you have solved the issue. Can you share more information about the solution? UPD: The reason for the lock was finally found (at least for my case): it was due to import lock in Python. Consider following situation: file1.py: import file2 file2.py: create thread "thread2" run "thread2" wait until "thread2" finish with some function (let's say go Go()) def Go(): import some_module .... Here the import in Go() would hang up since the import is locked in the main thread (by import file2) which will not be released until Go() finishes. The user will see in strace hang on FUTEX_WAIT_PRIVATE. To work around this place the code executed during the import of file2 into Do() function and run it after importing file2: import file2 file2.Do()
0
7,410
false
1
1
Python hangs in futex calls
4,533,967
2
2
0
4
2
0
1.2
0
I have a Python daemon running in production. It employs between 7 and 120 threads. Recently the smallest instance (7 threads) started to show hangs while all other instances never showed this kind of problem. Attaching strace to the python process shows that all threads are calling futex FUTEX_WAIT_PRIVATE, so they are probably trying to lock something. How would you debug such a problem? Note that this is a production system running from flash memory, so disk writes are constrained, too.
0
python,multithreading,debugging,deadlock,futex
2010-10-11T11:48:00.000
0
3,905,883
The observation was slightly incorrect. One thread wasn't calling futex, but instead swapping while holding the gil. Since the machine in question is low hardware this swapping took very long and seemed to be a deadlock. The underlying problem is a memory leak. :-(
0
7,410
true
1
1
Python hangs in futex calls
3,913,056
2
8
0
1
3
1
0.024995
0
I now primarily write in python, however I am looking for a language that is more thread friendly (not JAVA,C#,C or C++). Python's threads are good when they are IO bound but it's coming up short when I am doing something CPU intensive. Any ideas? Thanks, James
0
python,multithreading,multiprocessing,concurrency
2010-10-12T05:26:00.000
0
3,911,897
Take the hint. CPU intensive programs can also be made into multiple processes. Multiple processes and a pipeline to pass status around can often have outstanding performance. Rather than fish around randomly for other languages, do this. Decompose the problem into a pipeline of steps that can be done concurrently. In the shell, the top-level script is this: a.py | b.py | c.py | d.py... Write each step as a very small Python loop that reads from sys.stdin and writes to sys.stdout. Interesting, this is the default for raw_input() and print() making things simple. Measure the performance. You'll -- correctly -- spend all your time designing your algorithm. You'll spend little time coding or learning a new language. You'll trivially tie up every core on every CPU available to you. You'll spend no time on thread synchronization or other foolishness. This kind of thing works very, very well for "CPU Intensive" applications.
0
457
false
0
1
"Pythonic" multithreaded (Concurrent) language
3,913,601
2
8
0
1
3
1
0.024995
0
I now primarily write in python, however I am looking for a language that is more thread friendly (not JAVA,C#,C or C++). Python's threads are good when they are IO bound but it's coming up short when I am doing something CPU intensive. Any ideas? Thanks, James
0
python,multithreading,multiprocessing,concurrency
2010-10-12T05:26:00.000
0
3,911,897
to overcome GIL, you can try interpreting python language with jython instead of cpython
0
457
false
0
1
"Pythonic" multithreaded (Concurrent) language
3,911,913
2
6
0
-1
47
1
-0.033321
0
I have just started learning Python & have come across "namespaces" concept in Python. While I got the jist of what it is, but am unable to appreciate the gravity of this concept. Some browsing on the net revealed that one of the reasons going against PHP is that it has no native support for namespaces. Could someone explain how to use namespaces & how this feature makes programming better (not just in Python, as I assume namespaces in not a concept limited to a particular language). I am predominantly coming from Java and C programming backgrounds.
0
python,programming-languages,namespaces
2010-10-12T09:30:00.000
0
3,913,217
If you make a big program with someone else, you could write your own part of the program as you want. All variables in the file will be private, there will be no collisions. When you write PHP programs, it is easy to rewrite global variables by mistake. In python you can import other modules variables if you want, and they will be "global" on your module. You could think one file one object in Python. When you write PHP programs you can achieve the same by writing classes with instance variables.
0
29,735
false
0
1
What are Python namespaces all about
3,913,281
2
6
0
49
47
1
1.2
0
I have just started learning Python & have come across "namespaces" concept in Python. While I got the jist of what it is, but am unable to appreciate the gravity of this concept. Some browsing on the net revealed that one of the reasons going against PHP is that it has no native support for namespaces. Could someone explain how to use namespaces & how this feature makes programming better (not just in Python, as I assume namespaces in not a concept limited to a particular language). I am predominantly coming from Java and C programming backgrounds.
0
python,programming-languages,namespaces
2010-10-12T09:30:00.000
0
3,913,217
Namespace is a way to implement scope. In Java (or C) the compiler determines where a variable is visible through static scope analysis. In C, scope is either the body of a function or it's global or it's external. The compiler reasons this out for you and resolves each variable name based on scope rules. External names are resolved by the linker after all the modules are compiled. In Java, scope is the body of a method function, or all the methods of a class. Some class names have a module-level scope, also. Again, the compiler figures this out at compile time and resolves each name based on the scope rules. In Python, each package, module, class, function and method function owns a "namespace" in which variable names are resolved. Plus there's a global namespace that's used if the name isn't in the local namespace. Each variable name is checked in the local namespace (the body of the function, the module, etc.), and then checked in the global namespace. Variables are generally created only in a local namespace. The global and nonlocal statements can create variables in other than the local namespace. When a function, method function, module or package is evaluated (that is, starts execution) a namespace is created. Think of it as an "evaluation context". When a function or method function, etc., finishes execution, the namespace is dropped. The variables are dropped. The objects may be dropped, also.
0
29,735
true
0
1
What are Python namespaces all about
3,913,488
1
3
0
0
2
1
0
0
I'm developing a Python utility module to help with file downloads, archives, etc. I have a project set up in a virtual environment along with my unit tests. When I want to use this module on the same computer (essentially as "Production"), I move the files to the mymodule directory in the ~/dev/modules/mymodule I keep all 3rd-party modules under ~/dev/modules/contrib. This contrib path is on my PYTHONPATH, but mymodule is NOT because I've noticed that if mymodule is on my PYTHONPATH, my unit tests cannot distinguish between the "Development" version and the "Production" version. But now if I want to use this common utility module, I have to manually add it to the PYTHONPATH. This works, but I'm sure there's a better, more automated way. What is the best way to have a Development and Production module on the same computer? For instance, is there a way to set PYTHONPATH dynamically?
0
python,module,packaging,pythonpath
2010-10-12T11:47:00.000
0
3,914,289
You could set the PYTHONPATH as a global environment variable pointing to your Production code, and then in any shell in which you want to use the Development code, change the PYTHONPATH to point to that code. (Is that too simplistic? Have I missed something?)
0
209
false
0
1
Developing and using the same Python on the same computer
3,914,361
1
3
1
-5
18
0
-1
0
I have a problem with my python application, and I think it's related to the python garbage collection, even if I'm not sure... The problem is that my application takes a lot of time to exit and to switch to one function to the next one. In my application I handle very large dictionaries, containing thousands of large objects which are instantiated from wrapped C++ classes. I put some timestamp outputs in my program, and I saw that at the end of each function, when objects created inside the function should go out of scope, a lot of time is spent by the interpreter before calling the next function. And I observe the same problem at the end of the application, when the program should exit: a lot of time (~ hours!) is spent between the last timestamp on screen and the appearance of the fresh prompt. The memory usage is stable, so I don't really have memory leaks. Any suggestions? Can be the garbage collection of thousands of large C++ objects that slow? Is there a method to speed up that? UPDATE: Thanks a lot for all your answers, you gave me a lot of hints to debug my code :-) I use Python 2.6.5 on Scientific Linux 5, a customized distribution based on Red Hat Enterprise 5. And actually I'm not using SWIG to get Python bindings for our C++ code, but the Reflex/PyROOT framework. I know, it's not very known outside particle physics (but still open source and freely available) and I have to use it because it's the default for our main framework. And in this context the DEL command from the Python side does not work, I had already tried it. DEL only deletes the python variable linked to the C++ object, not the object itself in memory, which is still owned by the C++ side... ...I know, it's not-standard I guess, and a bit complicated, sorry :-P But following your hints, I'll profile my code and I'll come back to you with more details, as you suggested. ADDITIONAL UPDATE: Ok, following your suggestions, I instrumented my code with cProfile, and I discovered that actually the gc.collect() function is the function taking the most of the running time!! Here the output from cProfile + pstats print_stats(): >>> p.sort_stats("time").print_stats(20) Wed Oct 20 17:46:02 2010 mainProgram.profile 547303 function calls (542629 primitive calls) in 548.060 CPU seconds Ordered by: internal time List reduced from 727 to 20 due to restriction ncalls tottime percall cumtime percall filename:lineno(function) 4 345.701 86.425 345.704 86.426 {gc.collect} 1 167.115 167.115 200.946 200.946 PlotD3PD_v3.2.py:2041(PlotSamplesBranches) 28 12.817 0.458 13.345 0.477 PlotROOTUtils.py:205(SaveItems) 9900 10.425 0.001 10.426 0.001 PlotD3PD_v3.2.py:1973(HistoStyle) 6622 5.188 0.001 5.278 0.001 PlotROOTUtils.py:403(__init__) 57 0.625 0.011 0.625 0.011 {built-in method load} 103 0.625 0.006 0.792 0.008 dbutils.py:41(DeadlockWrap) 14 0.475 0.034 0.475 0.034 {method 'dump' of 'cPickle.Pickler' objects} 6622 0.453 0.000 5.908 0.001 PlotROOTUtils.py:421(CreateCanvas) 26455 0.434 0.000 0.508 0.000 /opt/root/lib/ROOT.py:215(__getattr__) [...] >>> p.sort_stats("cumulative").print_stats(20) Wed Oct 20 17:46:02 2010 mainProgram.profile 547303 function calls (542629 primitive calls) in 548.060 CPU seconds Ordered by: cumulative time List reduced from 727 to 20 due to restriction ncalls tottime percall cumtime percall filename:lineno(function) 1 0.001 0.001 548.068 548.068 PlotD3PD_v3.2.py:2492(main) 4 0.000 0.000 346.756 86.689 /usr/lib//lib/python2.5/site-packages/guppy/heapy/Use.py:171(heap) 4 0.005 0.001 346.752 86.688 /usr/lib//lib/python2.5/site-packages/guppy/heapy/View.py:344(heap) 1 0.002 0.002 346.147 346.147 PlotD3PD_v3.2.py:2537(LogAndFinalize) 4 345.701 86.425 345.704 86.426 {gc.collect} 1 167.115 167.115 200.946 200.946 PlotD3PD_v3.2.py:2041(PlotBranches) 28 12.817 0.458 13.345 0.477 PlotROOTUtils.py:205(SaveItems) 9900 10.425 0.001 10.426 0.001 PlotD3PD_v3.2.py:1973(HistoStyle) 13202 0.336 0.000 6.818 0.001 PlotROOTUtils.py:431(PlottingCanvases) 6622 0.453 0.000 5.908 0.001 /root/svn_co/rbianchi/SoftwareDevelopment [...] >>> So, in both outputs, sorted by "time" and by "cumulative" time respectively, gc.collect() is the function consuming the most of the running time of my program! :-P And this is the output of the memory profiler Heapy, just before returning the main() program. memory usage before return: Partition of a set of 65901 objects. Total size = 4765572 bytes. Index Count % Size % Cumulative % Kind (class / dict of class) 0 25437 39 1452444 30 1452444 30 str 1 6622 10 900592 19 2353036 49 dict of PlotROOTUtils.Canvas 2 109 0 567016 12 2920052 61 dict of module 3 7312 11 280644 6 3200696 67 tuple 4 6622 10 238392 5 3439088 72 0xa4ab74c 5 6622 10 185416 4 3624504 76 PlotROOTUtils.Canvas 6 2024 3 137632 3 3762136 79 types.CodeType 7 263 0 129080 3 3891216 82 dict (no owner) 8 254 0 119024 2 4010240 84 dict of type 9 254 0 109728 2 4119968 86 type Index Count % Size % Cumulative % Kind (class / dict of class) 10 1917 3 107352 2 4264012 88 function 11 3647 5 102116 2 4366128 90 ROOT.MethodProxy 12 148 0 80800 2 4446928 92 dict of class 13 1109 2 39924 1 4486852 93 __builtin__.wrapper_descriptor 14 239 0 23136 0 4509988 93 list 15 87 0 22968 0 4532956 94 dict of guppy.etc.Glue.Interface 16 644 1 20608 0 4553564 94 types.BuiltinFunctionType 17 495 1 19800 0 4573364 94 __builtin__.weakref 18 23 0 11960 0 4585324 95 dict of guppy.etc.Glue.Share 19 367 1 11744 0 4597068 95 __builtin__.method_descriptor Any idea why, or how to optimize the garbage collection? Is there any more detailed check I can do?
0
python,garbage-collection,root,performance
2010-10-12T15:50:00.000
0
3,916,553
If your problem really is the garbage collection, try explicitly freeing your objects when you're done with them using del(). In general, this doesn't sound like a garbage collection problem, unless we're talking about terabytes of memory. I agree with S.Lott... profile your app, then bring code snippets and the results of that back and we can be much more helpful.
0
13,216
false
0
1
Python garbage collection can be that slow?
3,919,321
2
10
0
53
183
1
1
0
Google won't let me search |= so I'm having trouble finding relevant documentation. Anybody know?
0
python
2010-10-14T01:00:00.000
0
3,929,278
When used with sets it performs union operation.
0
124,921
false
0
1
What does |= (ior) do in Python?
43,015,990
2
10
0
2
183
1
0.039979
0
Google won't let me search |= so I'm having trouble finding relevant documentation. Anybody know?
0
python
2010-10-14T01:00:00.000
0
3,929,278
In Python,|=(ior) works like union operation. like if x=5 and x|=5 then both the value will first convert in binary value then the union operation will perform and we get the answer 5.
0
124,921
false
0
1
What does |= (ior) do in Python?
51,221,579
2
3
0
41
30
1
1.2
0
How do you execute nosetest from pycharm to run all unit tests? I know that pycharm supports python's unittest and py.test and that they will properly support nosetests in pycharm 1.1 but I was wondering if there was a work around.
0
python,unit-testing,nose,nosetests,pycharm
2010-10-14T05:45:00.000
0
3,930,422
In the current version of Pycharm (2.6) there should be a context menu "run Nosetests in ..." on a test file. If this is missing, go to file->settings->Project Settings->python integrated tools and ensure the Default Test Runner is Nosetests. You do of course need to have Nosetests installed - pycharm will offer this if you do not. This does have a limitation. If the file in question does not have a class derived from unittest.TestCase it will not automatically show this. If you are using nose.tools or simple assertions it will not automatically offer this. This is probably a bug.
0
20,545
true
0
1
How do you run nosetest from pycharm?
13,359,250
2
3
0
2
30
1
0.132549
0
How do you execute nosetest from pycharm to run all unit tests? I know that pycharm supports python's unittest and py.test and that they will properly support nosetests in pycharm 1.1 but I was wondering if there was a work around.
0
python,unit-testing,nose,nosetests,pycharm
2010-10-14T05:45:00.000
0
3,930,422
If you can live without the graphical test runner, you can simply create a "Python Script" run configuration and run the tests as you run them from the command line. The only way to get nose tests working with the graphical test runner, I'm afraid, is to hack on helpers/pycharm/utrunner.py from the PyCharm distribution.
0
20,545
false
0
1
How do you run nosetest from pycharm?
3,931,985
1
1
0
1
1
0
1.2
0
I'm trying to create automated integration tests for this hardware+software test subject which runs a SNMP agent as it's command interface. Our test setup looks like this: We're using Fitnesse as a test runner and PyFit to be able to write the tests in Python. We then use netsnmp with Python bindings to send SNMP commands. This works pretty well. However, when I try to run a suite the SNMP agent (the test subject) is restarted (and usually at a different simulated time) which makes the internals of netsnmp get all sorts of interesting errors. Turns out there is a lot of global state stored inside the netsnmp library like community and context names and problematically EngineTime and EngineBootCnt, which is used to prevent replay attacks in SNMP v3. This causes the agent to reject my snmp commands. My problems is how do I reinitialise the netsnmp library (from the Python bindings) in a way that the internal global state are reset? The netsnmp.Session object in the Python bindings do take the parameter EngineTime and EngineBoots and setting them to 0 should reset them, but actually it doesn't seem to do that. I also do not know if there is other global state in there which needs to be reset. I'm at a point where I think I need to rewrite the tests to use the pure python snmp library pysnmp, but I was hoping to avoid it.
0
python,snmp,fitnesse,net-snmp,pysnmp
2010-10-15T06:45:00.000
0
3,940,057
The engineTime and engineBoots values are probably what is messing you up because SNMPv3 requires they not go backwards. If you have an agent that is restarting from scratch and not incrementing it's boots count (which is illegal, but under tests I could see why you'd be doing that) then you'd need to reset the internal notion of boots and time. However, setting them to 0 and 0 won't help because it'll assume those are defaults. You should, instead, change one of them to '1' which should trigger the override clause to actually use the values. Set the time to 1 and try it and I think it'll work (and if it doesn't, set them both to 1 instead and try that).
0
731
true
0
1
Resetting all global internal state of the net-snmp library from the Python bindings
3,968,271
2
2
0
1
1
0
1.2
1
I'm unfamiliar with the new oauth system. I wanted to crawl the status updates of my friends, and their friends' (if permissions allow) with my specified account credentials using the python-twitter api. With the new oauth authentication, does it means that I have to first register an application with twitter before I can use api?
0
python,oauth,twitter
2010-10-15T08:53:00.000
0
3,940,774
Yes, thats right. You need to register it and connect "grant access" it with your twitter id, if you want, for example, post something on your twitter wall. Also see "connections" in your twitter id.
0
206
true
0
1
noob question regarding twitter oauth
3,940,860
2
2
0
0
1
0
0
1
I'm unfamiliar with the new oauth system. I wanted to crawl the status updates of my friends, and their friends' (if permissions allow) with my specified account credentials using the python-twitter api. With the new oauth authentication, does it means that I have to first register an application with twitter before I can use api?
0
python,oauth,twitter
2010-10-15T08:53:00.000
0
3,940,774
For use api you must register your aplication or use GET methods to post into twi through web interface.
0
206
false
0
1
noob question regarding twitter oauth
3,940,840
1
3
0
5
3
0
0.321513
0
I was going through a few tests written in Java using JUnit and I could'nt help noticing the emphasis which is laid on checking the "type" of objects. This is something I have never seen in Python test-suites. Java being statically-typed and Python being dynamically-typed, should'nt the reverse be the case?
0
java,python,unit-testing
2010-10-15T15:43:00.000
0
3,943,808
Python unit tests do check types. All the time. In fact, that's the only thing they are doing. Python is duck-typed. Duck typing means that the type of an object is defined by its behavior. Unit tests test behavior. Ergo, they test types.
0
187
false
1
1
Python unittests almost never check types
3,944,260
1
2
0
0
1
0
0
0
I am preparing to develop a web application that will (hopefully) be used by an audience with many different native languages. What should I do to prepare my software project to have the user interface be almost entirely internationalized? Are there any software stacks that make this easier?
0
python,django,internationalization,project-planning
2010-10-16T21:21:00.000
0
3,950,851
One big change in your project: you need to build in time to localize your strings. Depending on your schedules, you may have to rearrange work so that all the string-changing work is at the front so that you have time to get the translations done before launching. Or, alternately, you have to build in a buffer at the end to account for it.
0
98
false
1
1
Preparing a web site for international usage
3,970,432
2
3
0
2
2
0
0.132549
1
So I have 16 GB worth of XML files to process (about 700 files total), and I already have a functional PHP script to do that (With XMLReader) but it's taking forever. I was wondering if parsing in Python would be faster (Python being the only other language I'm proficient in, I'm sure something in C would be faster).
0
php,python,xml
2010-10-17T14:07:00.000
0
3,953,563
I think that both of them can rely over wrappers for fast C libraries (mostly libxml2) so there's shouldn't be too much difference in parsing per se. You could try if there are differences caused by overhead, then it depends what are you gonna do over that XML. Parsing it for what?
0
1,714
false
0
1
Is XML parsing in PHP as fast as Python or other alternatives?
3,953,576
2
3
0
2
2
0
0.132549
1
So I have 16 GB worth of XML files to process (about 700 files total), and I already have a functional PHP script to do that (With XMLReader) but it's taking forever. I was wondering if parsing in Python would be faster (Python being the only other language I'm proficient in, I'm sure something in C would be faster).
0
php,python,xml
2010-10-17T14:07:00.000
0
3,953,563
There's actually three differing performance problems here: The time it takes to parse a file, which depends on the size of individual files. The time it takes to handle the files and directories in the filesystem, if there's a lot of them. Writing the data into your databases. Where you should look for performance improvements depends on which one of these is the biggest bottleneck. My guess is that the last one is the biggest problem because writes is almost always the slowest: writes can't be cached, they requires writing to disk and if the data is sorted it can take a considerable time to find the right spot to write it. You presume that the bottleneck is the first alternative, the XML parsing. If that is the case, changing language is not the first thing to do. Instead you should see if there's some sort of SAX parser for your language. SAX parsing is much faster and memory effective than DOM parsing.
0
1,714
false
0
1
Is XML parsing in PHP as fast as Python or other alternatives?
3,953,874
4
4
0
6
23
1
1
0
I'm doing some research on how to compare sound files(wave). Basically, I want to compare stored soundfiles (wav) with sound from a microphone. So in the end I would like to pre-store some voice commands of my own and then when I'm running my app I would like to compare the pre-stored files with input from the microphone. My thought was to put in some margin when comparing because saying something two times in a row in the exactly same way would be difficult I guess. So after some googling I see that Python has this module named wave and the Wave_read object. That object has a function named readframes(n): Reads and returns at most n frames of audio, as a string of bytes. What do these bytes contain? I'm thinking of looping thru the wave files one frame at the time comparing them frame by frame.
0
python,wav
2010-10-18T06:38:00.000
0
3,957,025
The first thing you should do is a fourier transformation to transform the data into its frequencies. It is rather complex however. I wouldn't use voice recognition libraries here as it sounds like you don't record voices only. You would then try different time shifts (in case the sounds are not exactly aligned) and use the one that gives you the best similarity - where you have to define a similarity function. Oh and you should normalize both signals (same maximum loudness).
0
39,854
false
1
1
What does a audio frame contain?
9,184,327
4
4
0
7
23
1
1
0
I'm doing some research on how to compare sound files(wave). Basically, I want to compare stored soundfiles (wav) with sound from a microphone. So in the end I would like to pre-store some voice commands of my own and then when I'm running my app I would like to compare the pre-stored files with input from the microphone. My thought was to put in some margin when comparing because saying something two times in a row in the exactly same way would be difficult I guess. So after some googling I see that Python has this module named wave and the Wave_read object. That object has a function named readframes(n): Reads and returns at most n frames of audio, as a string of bytes. What do these bytes contain? I'm thinking of looping thru the wave files one frame at the time comparing them frame by frame.
0
python,wav
2010-10-18T06:38:00.000
0
3,957,025
I believe the accepted description to be slightly incorrect. A frame appears to be somewhat like stride in graphics formats. For interleaved stereo @ 16 bits/sample, the frame size is 2*sizeof(short)=4 bytes. For non-interleaved stereo @ 16 bits/sample, the samples of the left channel are all one after another, so the frame size is just sizeof(short).
0
39,854
false
1
1
What does a audio frame contain?
20,810,191
4
4
0
8
23
1
1
0
I'm doing some research on how to compare sound files(wave). Basically, I want to compare stored soundfiles (wav) with sound from a microphone. So in the end I would like to pre-store some voice commands of my own and then when I'm running my app I would like to compare the pre-stored files with input from the microphone. My thought was to put in some margin when comparing because saying something two times in a row in the exactly same way would be difficult I guess. So after some googling I see that Python has this module named wave and the Wave_read object. That object has a function named readframes(n): Reads and returns at most n frames of audio, as a string of bytes. What do these bytes contain? I'm thinking of looping thru the wave files one frame at the time comparing them frame by frame.
0
python,wav
2010-10-18T06:38:00.000
0
3,957,025
A simple byte-by-byte comparison has almost no chance of a successful match, even with some tolerance thrown in. Voice-pattern recognition is a very complex and subtle problem that is still the subject of much research.
0
39,854
false
1
1
What does a audio frame contain?
3,957,097
4
4
0
47
23
1
1.2
0
I'm doing some research on how to compare sound files(wave). Basically, I want to compare stored soundfiles (wav) with sound from a microphone. So in the end I would like to pre-store some voice commands of my own and then when I'm running my app I would like to compare the pre-stored files with input from the microphone. My thought was to put in some margin when comparing because saying something two times in a row in the exactly same way would be difficult I guess. So after some googling I see that Python has this module named wave and the Wave_read object. That object has a function named readframes(n): Reads and returns at most n frames of audio, as a string of bytes. What do these bytes contain? I'm thinking of looping thru the wave files one frame at the time comparing them frame by frame.
0
python,wav
2010-10-18T06:38:00.000
0
3,957,025
An audio frame, or sample, contains amplitude (loudness) information at that particular point in time. To produce sound, tens of thousands of frames are played in sequence to produce frequencies. In the case of CD quality audio or uncompressed wave audio, there are around 44,100 frames/samples per second. Each of those frames contains 16-bits of resolution, allowing for fairly precise representations of the sound levels. Also, because CD audio is stereo, there is actually twice as much information, 16-bits for the left channel, 16-bits for the right. When you use the sound module in python to get a frame, it will be returned as a series of hexadecimal characters: One character for an 8-bit mono signal. Two characters for 8-bit stereo. Two characters for 16-bit mono. Four characters for 16-bit stereo. In order to convert and compare these values you'll have to first use the python wave module's functions to check the bit depth and number of channels. Otherwise, you'll be comparing mismatched quality settings.
0
39,854
true
1
1
What does a audio frame contain?
3,957,230
1
2
0
1
2
0
1.2
0
How to get UID of mail in All Maill folder if I have UID of this mail in inbox using imaplib? As you know the google store mails in the two instances in All Mail and in inbox I whant to move this to mail in trash folder using imaplib
0
python,gmail,imaplib
2010-10-18T09:48:00.000
0
3,958,019
You can do it using any of the 2 following ways. You can use Message-Id field of the mail header.Message-Id field for both the mail will be same. Apply SEARCH command on All Mail Folder. i.e search on title --> it will give you uid for that mail.
0
2,438
true
0
1
How to get UID of mail in All Maill folder if I have UID of this mail in inbox using imaplib? (GMail)
3,984,960
4
6
0
0
5
1
0
0
I'm going to reveal my ignorance here, but in my defense, I'm an accounting major, and I've never taken a computer science class. I'm about to start a new project, and I'm considering using Python instead of PHP, even though I am much more adept with PHP, because I have heard that Python is a more powerful language. That got me wondering, what makes one programming language more powerful than another? I figure javascript isn't very powerful because it (generally) runs inside a browser. But, why is Python more powerful than PHP? In each case, I'm giving instructions to the computer, so why are some languages better at interpreting and executing these instructions? How do I know how much "power" I actually need for a specific project?
0
python,programming-languages
2010-10-18T21:12:00.000
0
3,963,438
The stock answer is the only features that make certain languages more powerful than others are language features that cannot be easily replaced by adding libraries. This definition will almost always list LISP on the top, but has the odd side effect of listing assembly near the top unless special care is taken to exclude it.
0
6,357
false
0
1
What makes some programming languages more powerful than others?
3,963,524
4
6
0
1
5
1
0.033321
0
I'm going to reveal my ignorance here, but in my defense, I'm an accounting major, and I've never taken a computer science class. I'm about to start a new project, and I'm considering using Python instead of PHP, even though I am much more adept with PHP, because I have heard that Python is a more powerful language. That got me wondering, what makes one programming language more powerful than another? I figure javascript isn't very powerful because it (generally) runs inside a browser. But, why is Python more powerful than PHP? In each case, I'm giving instructions to the computer, so why are some languages better at interpreting and executing these instructions? How do I know how much "power" I actually need for a specific project?
0
python,programming-languages
2010-10-18T21:12:00.000
0
3,963,438
I would not say that there are computer languages "more powerful", just languages more suited for your specific problem domain. That said, PHP is a language that evolved from a hack and tailored for a very specific problem domain; this shows up in several places, like for example inconsistent parameter order across database interfaces. IMHO PHP community has made some very sad decisions for new syntax enhancements over the time. IMHO Python is much more general, well designed and elegant, but your question is one that usually starts flamewars.
0
6,357
false
0
1
What makes some programming languages more powerful than others?
3,963,547
4
6
0
0
5
1
0
0
I'm going to reveal my ignorance here, but in my defense, I'm an accounting major, and I've never taken a computer science class. I'm about to start a new project, and I'm considering using Python instead of PHP, even though I am much more adept with PHP, because I have heard that Python is a more powerful language. That got me wondering, what makes one programming language more powerful than another? I figure javascript isn't very powerful because it (generally) runs inside a browser. But, why is Python more powerful than PHP? In each case, I'm giving instructions to the computer, so why are some languages better at interpreting and executing these instructions? How do I know how much "power" I actually need for a specific project?
0
python,programming-languages
2010-10-18T21:12:00.000
0
3,963,438
Its an interesting topic and in my line of word I come across this a lot. But I've discovered 'power' in the literal sense no longer has value when it comes to the language. What I fear those telling you 'python is more' powerful are getting mixed up with the language and the implementation. I'm a recent convert to python (last 2 weeks) previously I was a PHP coder. The libraries made on top of the language of python - namely django -help make the language more powerful - as its faster to use and build upon. PHP has the fable 'if you want to do something. there is a function for it' and the documentation is brilliant - therefore powerful in that sense. And in regards to interpreting the language - again dependant upon who has been coding it - its no matter. By general consensus python may be considered quicker and less CPU intensive, is it creates compiled versions of your code. But PHP can have a good caching system. In short - Pick you favorite.
0
6,357
false
0
1
What makes some programming languages more powerful than others?
3,963,564
4
6
0
4
5
1
0.132549
0
I'm going to reveal my ignorance here, but in my defense, I'm an accounting major, and I've never taken a computer science class. I'm about to start a new project, and I'm considering using Python instead of PHP, even though I am much more adept with PHP, because I have heard that Python is a more powerful language. That got me wondering, what makes one programming language more powerful than another? I figure javascript isn't very powerful because it (generally) runs inside a browser. But, why is Python more powerful than PHP? In each case, I'm giving instructions to the computer, so why are some languages better at interpreting and executing these instructions? How do I know how much "power" I actually need for a specific project?
0
python,programming-languages
2010-10-18T21:12:00.000
0
3,963,438
I hate statements of the sort "language X is more powerful than Y." The real question is which language makes you more powerful. If language X allows you to write better code (that works) faster than Y does then, yes, X is more "powerful". If you are looking for an objective explanation of language powerful-ness ... well, good luck with that.
0
6,357
false
0
1
What makes some programming languages more powerful than others?
3,963,482
2
3
1
2
0
1
0.132549
0
I have a python dictionary stored in a file which I need to access from a c++ program. What is the best way of doing this? Thanks
0
c++,python,dictionary
2010-10-19T07:47:00.000
0
3,966,227
There are umpteen Python/C++ bindings (including the one in Boost) but I suggest KISS: not a Python/C++ binding but the principle "Keep It Simple, Stupid". Use a Python program to access the dictionary. :-) You can access the Python program(s) from C++ by running them, or you can do more fancy things such as communicating between Python and C++ via sockets or e.g. Windows "mailslots" or even some more full-fledged interprocess communication scheme. Cheers & hth.
0
2,650
false
0
1
Read python dictionary using c++
3,966,356
2
3
1
0
0
1
0
0
I have a python dictionary stored in a file which I need to access from a c++ program. What is the best way of doing this? Thanks
0
c++,python,dictionary
2010-10-19T07:47:00.000
0
3,966,227
I assume your Python dict is using simple data types and no objects (so strings/numbers/lists/nested dicts), since you want to use it in C++. I would suggest using json library (http://docs.python.org/library/json.html) to deserialize it and then use a C++ equivalent to serialize it to a C++ object.
0
2,650
false
0
1
Read python dictionary using c++
3,967,560
1
2
0
0
1
0
0
0
i saw a javascript implementation of sha-256. i waana ask if it is safe (pros/cons wathever) to use sha-256 (using javascript implementation or maybe python standard modules) alogrithm as a password generator: i remember one password, put it in followed(etc) by the website address and use the generated text as the password for that website. repeat process every time i need password same for other websites
0
javascript,python,sha256
2010-10-20T02:01:00.000
0
3,974,211
SHA-256 generates very long strings. You're better off using random.choice() with a string a fixed number of times.
0
1,380
false
1
1
SHA-256 password generator
3,974,224
1
3
0
7
9
0
1.2
0
Say you want to schedule recurring tasks, such as: Send email every wednesday at 10am Create summary on the first day of every month And you want to do this for a reasonable number of users in a web app - ie. 100k users each user can decide what they want scheduled when. And you want to ensure that the scheduled items run, even if they were missed originally - eg. for some reason the email didn't get sent on wednesday at 10am, it should get sent out at the next checking interval, say wednesday at 11am. How would you design that? If you use cron to trigger your scheduling app every x minutes, what's a good way to implement the part that decides what should run at each point in time? The cron-like implementations I've seen compare the current time to the trigger time for all specified items, but I'd like to deal with missed items as well. I have a feeling there's a more clever design than the one I'm cooking up, so please enlighten me.
0
python,cron,scheduling
2010-10-20T17:50:00.000
1
3,980,782
There's 2 designs, basically. One runs regularly and compares the current time to the scheduling spec (i.e. "Does this run now?"), and executes those that qualify. The other technique takes the current scheduling spec and finds the NEXT time that the item should fire. Then, it compares the current time to all of those items who's "next time" is less than "current time", and fires those. Then, when an item is complete, it is rescheduled for the new "next time". The first technique can not handle "missed" items, the second technique can only handle those items that were previously scheduled. Specifically consider you you have a schedule that runs once every hour, at the top of the hour. So, say, 1pm, 2pm, 3pm, 4pm. At 1:30pm, the run task is down and not executing any processes. It does not start again until 3:20pm. Using the first technique, the scheduler will have fired the 1pm task, but not fired the 2pm, and 3pm tasks, as it was not running when those times passed. The next job to run will be the 4pm job, at, well, 4pm. Using the second technique, the scheduler will have fired the 1pm task, and scheduled the next task at 2pm. Since the system was down, the 2pm task did not run, nor did the 3pm task. But when the system restarted at 3:20, it saw that it "missed" the 2pm task, and fired it off at 3:20, and then scheduled it again for 4pm. Each technique has it's ups and downs. With the first technique, you miss jobs. With the second technique you can still miss jobs, but it can "catch up" (to a point), but it may also run a job "at the wrong time" (maybe it's supposed to run at the top of the hour for a reason). A benefit of the second technique is that if you reschedule at the END of the executing job, you don't have to worry about a cascading job problem. Consider that you have a job that runs every minute. With the first technique, the job gets fired each minute. However, typically, if the job is not FINISHED within it's minute, then you can potentially have 2 jobs running (one late in the process, the other starting up). This can be a problem if the job is not designed to run more than once simultaneously. And it can exacerbate (if there's a real problem, after 10 minutes you have 10 jobs all fighting each other). With the second technique, if you schedule at the end of the job, then if a job happens to run just over a minute, then you'll "skip" a minute" and start up the following minute rather than run on top of itself. So, you can have a job scheduled for every minute actually run at 1:01pm, 1:03pm, 1:05pm, etc. Depending on your job design, either of these can be "good" or "bad". There's no right answer here. Finally, implementing the first technique is really, quite trivial compared to implementing the second. The code to determine if a cron string (say) matches a given time is simple compared to deriving what time a cron string will be valid NEXT. I know, and I have a couple hundred lines of code to prove it. It's not pretty.
0
3,985
true
0
1
cron-like recurring task scheduler design
3,980,935
1
3
0
9
37
1
1
0
I have Python extensions implemented on C++ classes. I don't have a C++ target to run valgrind with. I want to use valgrind for memory check. Can I use valgrind with Python?
0
c++,python,valgrind
2010-10-20T20:32:00.000
0
3,982,036
In Python 2.7 and 3.2 there is now a --with-valgrind compile-time flag that allows the Python interpreter to detect when it runs under valgrind and disables PyMalloc. This should allow you to more accurately monitor your memory allocations than otherwise, as PyMalloc just allocates memory in big chunks.
0
14,762
false
0
1
How can I use valgrind with Python C++ extensions?
7,856,043
2
2
0
2
3
1
1.2
0
My question was not specific enough last time, and so this is second question about this topic. I'm running some experiments and I need to precisely measure participants' response time to questions in millisecond unit. I know how to do this with the time module, but I was wondering if this is reliable enough or I should be careful using it. I was wondering if there are possibilities of some other random CPU load will interfere with the measuring of time. So my question is, will the response time measure with time module be very accurate or there will be some noise associate with it? Thank you, Joon
0
python,time
2010-10-21T16:55:00.000
0
3,989,952
CPU load will affect timing. If your application is startved of a slice of CPU time, then timing would get affected. You can not help that much. You can be as precise and no more. Ensure that your program gets a health slice of cpu time and the result will be accurate. In most cases, the results should be accurate to milliseconds.
0
533
true
0
1
Is python time module reliable enough to use to measure response time?
3,990,021
2
2
0
1
3
1
0.099668
0
My question was not specific enough last time, and so this is second question about this topic. I'm running some experiments and I need to precisely measure participants' response time to questions in millisecond unit. I know how to do this with the time module, but I was wondering if this is reliable enough or I should be careful using it. I was wondering if there are possibilities of some other random CPU load will interfere with the measuring of time. So my question is, will the response time measure with time module be very accurate or there will be some noise associate with it? Thank you, Joon
0
python,time
2010-10-21T16:55:00.000
0
3,989,952
If you benchmark on a *nix system (Linux most probably), time.clock() will return CPU time in seconds. On its own, it's not very informative, but as a difference of results (i.e. t0 = time.clock(); some_process(); t = time.clock() - t0), you'd have a much more load-independent timing than with time.time().
0
533
false
0
1
Is python time module reliable enough to use to measure response time?
3,990,976
2
3
0
1
4
1
0.066568
0
Is there a way to globally trap MemoryError exceptions so that a library can clear out caches instead of letting a MemoryError be seen by user code? I'm developing a memory caching library in Python that stores very large objects, to the point where it's common for users to want to use all available RAM to simplify their scripts and/or speed them up. I'd like to be able to have a hook where the python interpreter asks a callback function to release some RAM as a way of avoiding a MemoryError being invoked in user code. OS: Solaris and/or Linux Python: cPython 2.6.* EDIT: I'm looking for a mechanism that wouldn't be handled by an except block. If there would be a memory error in any code for any reason, I'd like to have the Python interpreter first try to use a callback to release some RAM and never have the MemoryError exception ever generated. I don't control the code that would generate the errors and I'd like my cache to be able to aggressively use as much RAM as it wants, automatically freeing up RAM as it's needed by the user code.
0
python,memory-management,caching
2010-10-21T19:41:00.000
0
3,991,257
A MemoryError is an exception, you should be able to catch it in an except block.
0
1,774
false
0
1
MemoryError hook in Python?
3,991,307
2
3
0
4
4
1
1.2
0
Is there a way to globally trap MemoryError exceptions so that a library can clear out caches instead of letting a MemoryError be seen by user code? I'm developing a memory caching library in Python that stores very large objects, to the point where it's common for users to want to use all available RAM to simplify their scripts and/or speed them up. I'd like to be able to have a hook where the python interpreter asks a callback function to release some RAM as a way of avoiding a MemoryError being invoked in user code. OS: Solaris and/or Linux Python: cPython 2.6.* EDIT: I'm looking for a mechanism that wouldn't be handled by an except block. If there would be a memory error in any code for any reason, I'd like to have the Python interpreter first try to use a callback to release some RAM and never have the MemoryError exception ever generated. I don't control the code that would generate the errors and I'd like my cache to be able to aggressively use as much RAM as it wants, automatically freeing up RAM as it's needed by the user code.
0
python,memory-management,caching
2010-10-21T19:41:00.000
0
3,991,257
This is not a good way of handling memory management. By the time you see MemoryError, you're already in a critical state where the kernel is probably close to killing processes to free up memory, and on many systems you'll never see it because it'll go to swap or just OOM-kill your process rather than fail allocations. The only recoverable case you're likely to see MemoryError is after trying to make a very large allocation that doesn't fit in available address space, only common on 32-bit systems. If you want to have a cache that frees memory as needed for other allocations, it needs to not interface with errors, but with the allocator itself. This way, when you need to release memory for an allocation you'll know how much contiguous memory is needed, or else you'll be guessing blindly. It also means you can track memory allocations as they happen, so you can keep memory usage at a specific level, rather than letting it grow unfettered and then trying to recover when it gets too high. I'd strongly suggest that for most applications this sort of caching behavior is overcomplicated, though--you're usually better off just using a set amount of memory for cache.
0
1,774
true
0
1
MemoryError hook in Python?
3,991,666
1
1
0
1
0
0
1.2
0
How can I make a Python script which checks if I have logged in the Facebook? If I haven't, it should log me in.
0
python,facebook
2010-10-22T15:53:00.000
0
3,998,586
Being "logged in" to Facebook (or any system for that matter) is generally a contract between the server and the client - and not just a "flipped bit" on the server. As an example, if you log into Facebook on you phone - you can't then pull up Facebook on your desktop machine and be logged in. In short - no, I don't think so.
0
1,207
true
0
1
Python Facebook login
3,998,919
1
2
0
2
2
0
1.2
0
My current web host allows for up to 25 processes running at once. From what I can figure, Python scripts take up a spot in processes, but PHP doesn't? I get a 500 error if more than 25 processes are running at once (unlikely, but still a hassle), so I was wondering if it would be easier on the server if I were to port my site over to PHP? Thanks!
0
php,python,resources
2010-10-22T18:09:00.000
0
3,999,679
You are using HostGator. Switch hosts. Their shared server offerings should be used by very low traffic, brochure sites as they cram 100's of vhosts onto each server. If you can't switch, ensure you're setup to use mod_php (not suPHP or cgi) or Python equivalent. Otherwise, new processes will be spawned on each request and you'll be serving up blank pages in no time.
0
591
true
0
1
What's more resource intensive? PHP or Python?
3,999,983
1
2
0
1
0
0
0.099668
0
Say I let users upload files to my server, and I let users download them. I'd like to set the mime type to something other than just application/octet-stream, so that if the browser can just open them, it does (say, for images, pdf files, plain text files, etc.) Of course, since the files are uploaded by users, I can't trust the file extension, etc. Is there a good library for figuring out what mime type goes with an arbitrary blob? Preferably usable from Python :-) Thanks!
0
python,web-applications,mime,mime-types
2010-10-23T01:33:00.000
0
4,002,015
Beware of text files: there's no way of knowing what encoding they're in, and there's no reliable way of guessing, especially since most ones created in Windows are in 8-bit MBCS encodings which are indistinguishable without language heuristics. You need to know the encoding--not just the MIME type--to set the complete Content-Type for a file to be viewable in a browser. If you want to allow uploading and displaying text, it's much safer to use an HTML text form than a raw file upload. Also, note that a file can be multiple file types; for example, self-extracting ZIPs are both valid Windows executables and ZIP files, and can be treated as either.
0
203
false
1
1
Can I reliably figure out the correct mime type to serve untrusted content?
4,002,237
2
3
0
2
2
1
1.2
0
In my organization, we have a couple of internally developed Python packages. For sake of example, let's call them Foo and Bar. Both are developed in separate Git repositories. Foo is a Pylons application that uses certain library functions from Bar. Neither is publicly distributed. When we deploy Foo, we typically export the latest revision from source control and run setup.py develop within our virtualenv. This works okay. The problem is that we'll need some way of distributing Bar for every environment where we deploy Foo. We obviously can't put 'Bar' in setup.py's install_requires (as easy_install won't find be able to find it on any website). I can't find any way of automatically obtaining/installing privately developed dependencies. Is there an easier to way to manage this? I feel like I'm missing the point of Python packaging and distribution.
0
python,deployment,setuptools,distutils
2010-10-23T16:40:00.000
0
4,005,009
You can create a package repository. The steps are basically: Create an egg with setup.py bdist_egg Copy the created egg from dist to a directory served by Apache Add the url to the directory exposed by Apache to the easy_install command with the -f switch Note that Apache is not necessarily required, but it automatically generates a directory listing that easy_install can deal with. If you are using buildout, there are config options to do the same thing as -f and I am pretty sure there is something you can use in pip as well.
0
163
true
0
1
Pylons app deployment with privately developed dependencies
4,005,069
2
3
0
0
2
1
0
0
In my organization, we have a couple of internally developed Python packages. For sake of example, let's call them Foo and Bar. Both are developed in separate Git repositories. Foo is a Pylons application that uses certain library functions from Bar. Neither is publicly distributed. When we deploy Foo, we typically export the latest revision from source control and run setup.py develop within our virtualenv. This works okay. The problem is that we'll need some way of distributing Bar for every environment where we deploy Foo. We obviously can't put 'Bar' in setup.py's install_requires (as easy_install won't find be able to find it on any website). I can't find any way of automatically obtaining/installing privately developed dependencies. Is there an easier to way to manage this? I feel like I'm missing the point of Python packaging and distribution.
0
python,deployment,setuptools,distutils
2010-10-23T16:40:00.000
0
4,005,009
At my work we use setuptools to create packages specific to the OS. We happen to use RedHat so we call bdist_rpm to create rpm package. We find that works better than eggs because we can do dependency management in the packages for both python and non-python libs. We create the rpms on our continuous integration machine and the move them to a YUM repo where they can be pushed out via a YUM update or upgrade.
0
163
false
0
1
Pylons app deployment with privately developed dependencies
4,057,725
1
8
0
2
35
1
0.049958
0
How can I make it so unit tests in Python (using unittest) are run in the order in which they are specified in the file?
0
python,unit-testing
2010-10-23T19:32:00.000
0
4,005,695
There are also test runners which do that by themselves – I think py.test does it.
0
18,462
false
0
1
changing order of unit tests in Python
4,005,931
1
2
0
-1
2
1
-0.099668
0
How can I tell the encoding of the source file from inside a running python process, if it is even possible?
0
python,encoding
2010-10-23T20:30:00.000
0
4,005,928
If you examine __file__, it will give you the file name of the running code. If it ends in ".pyc" or ".pyo", clip off the last character. This is the source file of the running code. Read that file, looking for the encoding header. Note that this is a simplification, and it can get much harder to find the real source file, but this will work in many cases. BTW: Why do you need to know the encoding of the source file? It should be irrelevant, I would have thought.
0
1,318
false
0
1
Get CURRENT_FILE_ENCODING for a python file or environment
4,005,965
1
4
0
1
1
1
0.049958
0
It seems like just adding a package path to your PYTHONPATH gives you access to all of its modules and functions, similar to installing an egg. Is the difference just that the egg is zip compressed?
0
python
2010-10-24T18:44:00.000
0
4,009,781
yes, and zip egg files are decompressed on the fly when you reference them making them slower than when you install it.
0
1,047
false
0
1
How is a python egg different from a regular package?
4,009,829
2
2
0
2
0
0
0.197375
1
I am solving a problem of transferring images from a camera in a loop from a client (a robot with camera) to a server (PC). I am trying to come up with ideas how to maximize the transfer speed so I can get the best possible FPS (that is because I want to create a live video stream out of the transferred images). Disregarding the physical limitations of WIFI stick on the robot, what would you suggest? So far I have decided: to use YUV colorspace instead of RGB to use UDP protocol instead of TCP/IP Is there anything else I could do to get the maximum fps possible?
0
c#,c++,python,algorithm,performance
2010-10-25T08:49:00.000
0
4,013,046
Compress the difference between successive images. Add some checksum. Provide some way for the receiver to request full image data for the case where things get out of synch. There are probably a host of protocols doing that already. So, search for live video stream protocols. Cheers & hth.,
0
375
false
0
1
How to speed up transfer of images from client to server
4,013,104
2
2
0
4
0
0
1.2
1
I am solving a problem of transferring images from a camera in a loop from a client (a robot with camera) to a server (PC). I am trying to come up with ideas how to maximize the transfer speed so I can get the best possible FPS (that is because I want to create a live video stream out of the transferred images). Disregarding the physical limitations of WIFI stick on the robot, what would you suggest? So far I have decided: to use YUV colorspace instead of RGB to use UDP protocol instead of TCP/IP Is there anything else I could do to get the maximum fps possible?
0
c#,c++,python,algorithm,performance
2010-10-25T08:49:00.000
0
4,013,046
This might be quite a bit of work but if your client can handle the computations in real time you could use the same method that video encoders use. Send a key frame every say 5 frames and in between only send the information that changed not the whole frame. I don't know the details of how this is done, but try Googling p-frames or video compression.
0
375
true
0
1
How to speed up transfer of images from client to server
4,013,112
3
6
0
1
3
0
0.033321
1
I wish to control my computer (and usb devices attached to the computer) at home with any computer that is connected to the internet. The computer at home must have a program installed that receives commands from any other computer that is connected to the internet. I thought it would be best if I do this with a web interface as it would not be necessary to install software on that computer. For obvious reasons it would require log in details. Extra details: The main part of the project is actually a device that I will develop that connects to the computer's usb port. Sorry if it was a bit vague in my original question. This device will perform simple functions such as turning lights on etc. At first I will just attempt to switch the lights remotely using the internet. Later on I will add commands that can control certain aspects of the computer such as the music player. I think doing a full remote desktop connection to control my device is therefore not quite necessary. Does anybody know of any open source projects that can perform these functions? So basically the problem is sending encrypted commands from a web interface to my computer at home. What would be the best method to achieve this and what programming languages should I use? I know Java, Python and C quite well, but have very little experience with web applications, such as Javascript and PHP. I have looked at web chat examples as it is sort of similar concept to what I wish to achieve, except the text can be replaced with commands. Is this a viable solution or are there better alternatives? Thank you
0
java,php,javascript,python
2010-10-25T12:48:00.000
1
4,014,670
You can write a WEB APPLICATION. The encryption part is solved by simple HTTPS usage. On the server side (your home computer with USB devices attached to it) you should use Python (since you're quite experienced with it) and a Python Web Framework you want (I.E. Django).
0
1,907
false
0
1
Send commands between two computers over the internet
4,014,696
3
6
0
0
3
0
0
1
I wish to control my computer (and usb devices attached to the computer) at home with any computer that is connected to the internet. The computer at home must have a program installed that receives commands from any other computer that is connected to the internet. I thought it would be best if I do this with a web interface as it would not be necessary to install software on that computer. For obvious reasons it would require log in details. Extra details: The main part of the project is actually a device that I will develop that connects to the computer's usb port. Sorry if it was a bit vague in my original question. This device will perform simple functions such as turning lights on etc. At first I will just attempt to switch the lights remotely using the internet. Later on I will add commands that can control certain aspects of the computer such as the music player. I think doing a full remote desktop connection to control my device is therefore not quite necessary. Does anybody know of any open source projects that can perform these functions? So basically the problem is sending encrypted commands from a web interface to my computer at home. What would be the best method to achieve this and what programming languages should I use? I know Java, Python and C quite well, but have very little experience with web applications, such as Javascript and PHP. I have looked at web chat examples as it is sort of similar concept to what I wish to achieve, except the text can be replaced with commands. Is this a viable solution or are there better alternatives? Thank you
0
java,php,javascript,python
2010-10-25T12:48:00.000
1
4,014,670
Well, I think that java can work well, in fact you have to deal with system calls to manage usb devices and things like that (and as far as I know, PHP is not the best language to do this). Also shouldn't be so hard to create a basic server/client program, just use good encryption mechanism to not show commands around web.
0
1,907
false
0
1
Send commands between two computers over the internet
4,014,765
3
6
0
0
3
0
0
1
I wish to control my computer (and usb devices attached to the computer) at home with any computer that is connected to the internet. The computer at home must have a program installed that receives commands from any other computer that is connected to the internet. I thought it would be best if I do this with a web interface as it would not be necessary to install software on that computer. For obvious reasons it would require log in details. Extra details: The main part of the project is actually a device that I will develop that connects to the computer's usb port. Sorry if it was a bit vague in my original question. This device will perform simple functions such as turning lights on etc. At first I will just attempt to switch the lights remotely using the internet. Later on I will add commands that can control certain aspects of the computer such as the music player. I think doing a full remote desktop connection to control my device is therefore not quite necessary. Does anybody know of any open source projects that can perform these functions? So basically the problem is sending encrypted commands from a web interface to my computer at home. What would be the best method to achieve this and what programming languages should I use? I know Java, Python and C quite well, but have very little experience with web applications, such as Javascript and PHP. I have looked at web chat examples as it is sort of similar concept to what I wish to achieve, except the text can be replaced with commands. Is this a viable solution or are there better alternatives? Thank you
0
java,php,javascript,python
2010-10-25T12:48:00.000
1
4,014,670
I you are looking for solution you could use from any computer anywhere in the worls without the need to install any software on client pc, try logmein.com (http://secure.logmein.com). It is free, reliable, works in any modern browser, you don't have to remmeber IPs and hope they won't change, ... Or if this is a "for fun project" why not write a php script, open port 80 in your router so you can access you script from outside, possibly dynamically link some domain to your IP (http://www.dyndns.com/). In the script you would just login and then for example type the orders in textfield in some form in your script. Lets just say you want to do some command prompt stuf, so you will basically remotely construst a *.bat file for example. Then the script stores this a fromtheinternets.bat to a folder on your desktop that is being constantly monitored for changes. And when such a change is found you just activate the bat file. Insecure? Yes (It could be made secureER) Fun to write? Definitely PS: I am new here, hope it's not "illegal" to post link to actual services, instead of wiki lists. This is by no means and advertisement, I am just a happy user. :)
0
1,907
false
0
1
Send commands between two computers over the internet
4,015,151
1
5
0
1
63
0
0.039979
0
After installing Python 2.7 on Windows XP, then manually setting the %PATH% to python.exe (why won't the python installer do this?), then installing setuptools 0.6c11 (why doesn't the python installer do this?), then manually setting the %PATH% to easy_install.exe (why doesn't the installer do this?), I finally tried to install a python package with easy_install, but easy_install failed when it couldn't install the pywin32 package, which is a dependency. How can I make easy_install work properly on Windows XP? The failure follows: C:\>easy_install winpexpect Searching for winpexpect Best match: winpexpect 1.4 Processing winpexpect-1.4-py2.7.egg winpexpect 1.4 is already the active version in easy-install.pth Using c:\python27\lib\site-packages\winpexpect-1.4-py2.7.egg Processing dependencies for winpexpect Searching for pywin32>=214 Reading http://pypi.python.org/simple/pywin32/ Reading http://sf.net/projects/pywin32 Reading http://sourceforge.net/project/showfiles.php?group_id=78018 No local packages or download links found for pywin32>=214 Best match: None Traceback (most recent call last): File "C:\python27\scripts\easy_install-script.py", line 8, in load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')() File "C:\python27\lib\site-packages\setuptools\command\easy_install.py", line 1712, in main with_ei_usage(lambda: File "C:\python27\lib\site-packages\setuptools\command\easy_install.py", line 1700, in with_ei_usage return f() File "C:\python27\lib\site-packages\setuptools\command\easy_install.py", line 1716, in distclass=DistributionWithoutHelpCommands, **kw File "C:\python27\lib\distutils\core.py", line 152, in setup dist.run_commands() File "C:\python27\lib\distutils\dist.py", line 953, in run_commands self.run_command(cmd) File "C:\python27\lib\distutils\dist.py", line 972, in run_command cmd_obj.run() File "C:\python27\lib\site-packages\setuptools\command\easy_install.py", line 211, in run self.easy_install(spec, not self.no_deps) File "C:\python27\lib\site-packages\setuptools\command\easy_install.py", line 446, in easy_install return self.install_item(spec, dist.location, tmpdir, deps) File "C:\python27\lib\site-packages\setuptools\command\easy_install.py", line 481, in install_item self.process_distribution(spec, dists[0], deps, "Using") File "C:\python27\lib\site-packages\setuptools\command\easy_install.py", line 519, in process_distribution [requirement], self.local_index, self.easy_install File "C:\python27\lib\site-packages\pkg_resources.py", line 563, in resolve dist = best[req.key] = env.best_match(req, self, installer) File "C:\python27\lib\site-packages\pkg_resources.py", line 799, in best_match return self.obtain(req, installer) # try and download/install File "C:\python27\lib\site-packages\pkg_resources.py", line 811, in obtain return installer(requirement) File "C:\python27\lib\site-packages\setuptools\command\easy_install.py", line 434, in easy_install self.local_index File "C:\python27\lib\site-packages\setuptools\package_index.py", line 475, in fetch_distribution return dist.clone(location=self.download(dist.location, tmpdir)) AttributeError: 'NoneType' object has no attribute 'clone'
0
python,windows,easy-install
2010-10-25T15:31:00.000
1
4,016,151
For one thing, it says you already have that module installed. If you need to upgrade it, you should do something like this: easy_install -U packageName Of course, easy_install doesn't work very well if the package has some C headers that need to be compiled and you don't have the right version of Visual Studio installed. You might try using pip or distribute instead of easy_install and see if they work better.
0
152,491
false
0
1
How to use Python's "easy_install" on Windows ... it's not so easy
4,016,275
1
2
0
0
1
0
1.2
0
We're having problems when trying to deploy a number of projects which use zc.buildout - specifically we're finding that they want to put their PYTHON_EGG_CACHE directories all over the show. We'd like to somehow set this directory to one at the same level as the built-out project, where eggs can be found. There is some mention online that this can be done for Plone projects, but is it possible to do this without Plone? Are there some recipes that can set up an environment variable so we can set the PYTHON_EGG_CACHE executable files in ./bin?
0
buildout,python-egg-cache
2010-10-26T15:49:00.000
1
4,025,412
I'm not sure what you mean. Three options that you normally have: Buildout, by default, stores the eggs in a directory called eggs/ inside your buildout directory. You can set the eggs-dir variable inside your buildout.cfg's [buildout] section to some directory. Just tell it where to place them. You can also set that very same option in .buildout/defaults.cfg inside your home directory. That way you can set a default for all your projects. Handy for storing all your eggs in one place: that can save a lot of download time, for instance. Does one of those (especially the last one) accomplish what you want? And: don't muck around with eggs in the generated bin/* files. Let buldout pick the eggs, that's its purpose.
0
1,434
true
0
1
Specify a custom PYTHON_EGG_CACHE dir with zc.buildout?
4,026,496
2
2
1
0
3
0
0
0
My needs : I need to develop an GUI application that is cross platform the chosen solution must be the fastest to implement it should be easy to extend The application is just a database front-end, mainly for CRUD operations, listing, filtering, exporting, charts and graphs etc. After reading about some solutions (Python Card, PyGUI, DABO, pygtkhelpers, kiwi, pyjamas, pure-mvc, PyQt/PySide, Wax, Tk-based frameworks, AVC, Fox etc.), I found myself interrested in two particular solutions, one of them is Camelot. Before jumping into it, I would like to have some opinions about Camelot users vs skeptics. Thanks for sharing :)
0
python,user-interface,sqlalchemy,cross-platform,python-elixir
2010-10-26T17:02:00.000
0
4,026,026
In my opinion the best option for this would be to make a CGI program to run through a browser so that you do not have to worry about platform issues. Granted it might take a little bit more work, it may be better suited for cross platform deployment. :)
0
593
false
0
1
Feedback for Camelot
9,863,280
2
2
1
1
3
0
0.099668
0
My needs : I need to develop an GUI application that is cross platform the chosen solution must be the fastest to implement it should be easy to extend The application is just a database front-end, mainly for CRUD operations, listing, filtering, exporting, charts and graphs etc. After reading about some solutions (Python Card, PyGUI, DABO, pygtkhelpers, kiwi, pyjamas, pure-mvc, PyQt/PySide, Wax, Tk-based frameworks, AVC, Fox etc.), I found myself interrested in two particular solutions, one of them is Camelot. Before jumping into it, I would like to have some opinions about Camelot users vs skeptics. Thanks for sharing :)
0
python,user-interface,sqlalchemy,cross-platform,python-elixir
2010-10-26T17:02:00.000
0
4,026,026
Disclaimer: I am a Camelot committer. If the question has been raised on the Programmers Stack Exchange, please link to it. This question is kind of old, but for any reference, i'll chime in. Camelot was and is developed for exactly the reasons you stated. It has matured a lot since this questions was asked and is about feature complete. Latest efforts have been made to use Declarative instead of Elixir. Stability and speed are strongpoints as well.
0
593
false
0
1
Feedback for Camelot
14,327,581
2
2
0
1
1
0
0.099668
0
I am developing a social networking website in the facebook/foursquare-ish space. I have gotten such varied feedback on what platform I should develop in. Of course it will be heavily influenced by who I hire, but i was hoping for a little additional feedback from the larger community. Thanks.
0
php,.net,python,ruby-on-rails
2010-10-27T13:26:00.000
0
4,033,735
Write in assembler if you're comfortable with that. :) Some questions you should ask yourself: Are there hosting restrictions? No point in coding ASP.net when you have a PHP-only host/server. Are there technical restrictions? E.g. if you want to use SQL Server as a back-end, going with ASP.net may make your life easier. What other requirements do you have? Does it have to run on the JVM? Do you want to compile stuff all the time or do you want an interpreted language? etc. etc. What experience do you have? If you're already familiar with Python, why switch to Ruby? My best tip is: use what's best for the job at hand according to the above questions. For me, I'd use Ruby on Rails for the project you described. Rails offers all the tools I need for a large project like that. Please let us know when and what you've decided :)
0
156
false
1
1
What do i build my alpha platform on, PHP, Ruby, Python, .NET, etc?
4,034,000
2
2
0
7
1
0
1
0
I am developing a social networking website in the facebook/foursquare-ish space. I have gotten such varied feedback on what platform I should develop in. Of course it will be heavily influenced by who I hire, but i was hoping for a little additional feedback from the larger community. Thanks.
0
php,.net,python,ruby-on-rails
2010-10-27T13:26:00.000
0
4,033,735
It doesn't matter. StackOverflow was written in ASP .NET MVC and it's awesome. Twitter was written in Rails and it's super popular. Facebook was written in PHP and half a billion people use it. It's not the technology, it's the community. That's the hard part. Just pick one and go. Your best bet might actually be to find the technology that the most smart people are using while still working for the least amount of money.
0
156
false
1
1
What do i build my alpha platform on, PHP, Ruby, Python, .NET, etc?
4,033,788
1
11
0
-3
114
1
-0.054491
0
I'm writing a class in python and I have an attribute that will take a relatively long time to compute, so I only want to do it once. Also, it will not be needed by every instance of the class, so I don't want to do it by default in __init__. I'm new to Python, but not to programming. I can come up with a way to do this pretty easily, but I've found over and over again that the 'Pythonic' way of doing something is often much simpler than what I come up with using my experience in other languages. Is there a 'right' way to do this in Python?
0
python,memoization
2010-10-27T20:36:00.000
0
4,037,481
The most simple way of doing this would probably be to just write a method (instead of using an attribute) that wraps around the attribute (getter method). On the first call, this methods calculates, saves and returns the value; later it just returns the saved value.
0
54,820
false
0
1
Caching class attributes in Python
4,037,504