Q_Id
int64
337
49.3M
CreationDate
stringlengths
23
23
Users Score
int64
-42
1.15k
Other
int64
0
1
Python Basics and Environment
int64
0
1
System Administration and DevOps
int64
0
1
Tags
stringlengths
6
105
A_Id
int64
518
72.5M
AnswerCount
int64
1
64
is_accepted
bool
2 classes
Web Development
int64
0
1
GUI and Desktop Applications
int64
0
1
Answer
stringlengths
6
11.6k
Available Count
int64
1
31
Q_Score
int64
0
6.79k
Data Science and Machine Learning
int64
0
1
Question
stringlengths
15
29k
Title
stringlengths
11
150
Score
float64
-1
1.2
Database and SQL
int64
0
1
Networking and APIs
int64
0
1
ViewCount
int64
8
6.81M
7,039,200
2011-08-12T11:04:00.000
1
0
0
1
python,google-app-engine
7,063,139
13
false
1
0
Tried to upload to the app this morning (first time i've tried since Friday) and it just worked (first time...!) No idea what the issue was as I haven't done any work on this over the weekend so everything should have been the same as it was on Friday.
9
24
0
I was unable to upload to an AppEngine as appcfg was telling me : This application does not exist (app_id=u'xxx'). I was only a developer on the AppEngine, so as I was just testing I created a new AppEngine where I was the owner but I still get the same message on a newly created AppEngine.
This application does not exist (app_id=xxx)
0.015383
0
0
19,079
7,039,200
2011-08-12T11:04:00.000
0
0
0
1
python,google-app-engine
32,418,665
13
false
1
0
Posting Ric Moore's comment in the selected answer because that is a valid answer and it worked in my case (and hopefully it helps someone else having the same issue spot it quickly). I have an alternation solution - in the Google App Engine Launcher select from the menu Control > Clear Deployment Credential. Then ...
9
24
0
I was unable to upload to an AppEngine as appcfg was telling me : This application does not exist (app_id=u'xxx'). I was only a developer on the AppEngine, so as I was just testing I created a new AppEngine where I was the owner but I still get the same message on a newly created AppEngine.
This application does not exist (app_id=xxx)
0
0
0
19,079
7,039,200
2011-08-12T11:04:00.000
1
0
0
1
python,google-app-engine
8,974,660
13
false
1
0
I got the same error message trying to make the first deployment of a Python Application using a Google Apps account. In my case the problem was caused by the fact that my 2-way authentication is enabled. With 2-way authentication enabled you need to generate an authentication password in your Google Account Management...
9
24
0
I was unable to upload to an AppEngine as appcfg was telling me : This application does not exist (app_id=u'xxx'). I was only a developer on the AppEngine, so as I was just testing I created a new AppEngine where I was the owner but I still get the same message on a newly created AppEngine.
This application does not exist (app_id=xxx)
0.015383
0
0
19,079
7,039,200
2011-08-12T11:04:00.000
1
0
0
1
python,google-app-engine
26,124,268
13
false
1
0
If you are using --oauth2 make sure that you are logged into the correct account when generating the token.
9
24
0
I was unable to upload to an AppEngine as appcfg was telling me : This application does not exist (app_id=u'xxx'). I was only a developer on the AppEngine, so as I was just testing I created a new AppEngine where I was the owner but I still get the same message on a newly created AppEngine.
This application does not exist (app_id=xxx)
0.015383
0
0
19,079
7,039,200
2011-08-12T11:04:00.000
5
0
0
1
python,google-app-engine
10,004,722
13
false
1
0
The same problem occurs with the Java/Eclipse plugin version of App Engine. The 404 happens when you're logged in to the wrong Google account from within the plugin. In that case, look at the bottom-left of Eclipse to see what account you're currently using. Regarding the Python command line updater, if your cookies in...
9
24
0
I was unable to upload to an AppEngine as appcfg was telling me : This application does not exist (app_id=u'xxx'). I was only a developer on the AppEngine, so as I was just testing I created a new AppEngine where I was the owner but I still get the same message on a newly created AppEngine.
This application does not exist (app_id=xxx)
0.076772
0
0
19,079
7,039,200
2011-08-12T11:04:00.000
1
0
0
1
python,google-app-engine
13,440,444
13
false
1
0
this way worked: modified the app.yaml to specify the application: some_id python appcfg.py update ../some_application/server/python
9
24
0
I was unable to upload to an AppEngine as appcfg was telling me : This application does not exist (app_id=u'xxx'). I was only a developer on the AppEngine, so as I was just testing I created a new AppEngine where I was the owner but I still get the same message on a newly created AppEngine.
This application does not exist (app_id=xxx)
0.015383
0
0
19,079
7,039,200
2011-08-12T11:04:00.000
4
0
0
1
python,google-app-engine
13,757,124
13
false
1
0
This is really old, so I wouldn't be surprised if this isn't picked up by the poster, but I wanted to ensure that I have a reference for the next time I have the issue. I had this issue. My problem ended up being that I had not invited the user that I was authenticating as to be a developer on the project. In fact I ha...
9
24
0
I was unable to upload to an AppEngine as appcfg was telling me : This application does not exist (app_id=u'xxx'). I was only a developer on the AppEngine, so as I was just testing I created a new AppEngine where I was the owner but I still get the same message on a newly created AppEngine.
This application does not exist (app_id=xxx)
0.061461
0
0
19,079
7,039,200
2011-08-12T11:04:00.000
1
0
0
1
python,google-app-engine
25,898,433
13
false
1
0
I fixed this problem by editing my app.yaml file to have the correct application name. In the app.yaml file where it says 'application:[insert app name here]', I had to change the [insert app name here] part. I'm not sure why the name was wrong, but I do remember toying around with it before while attempting to fix a d...
9
24
0
I was unable to upload to an AppEngine as appcfg was telling me : This application does not exist (app_id=u'xxx'). I was only a developer on the AppEngine, so as I was just testing I created a new AppEngine where I was the owner but I still get the same message on a newly created AppEngine.
This application does not exist (app_id=xxx)
0.015383
0
0
19,079
7,039,200
2011-08-12T11:04:00.000
0
0
0
1
python,google-app-engine
32,109,147
13
false
1
0
What worked for me is to use the project id from the google app engine console instead of the project name in app.yaml
9
24
0
I was unable to upload to an AppEngine as appcfg was telling me : This application does not exist (app_id=u'xxx'). I was only a developer on the AppEngine, so as I was just testing I created a new AppEngine where I was the owner but I still get the same message on a newly created AppEngine.
This application does not exist (app_id=xxx)
0
0
0
19,079
7,039,343
2011-08-12T11:20:00.000
3
0
0
0
python,html,logging,format
7,039,432
2
false
1
0
I would not recommend storing logs as HTML, having logs easily onward processable is a very important and useful feature, and HTML is hard to parse, and it is also verbose - and logs get large fast :-) However if you really want to you can write your own formatter that will output to HTML - I am not aware of one alread...
1
6
0
I read in wikipedia that python logging module was inspired by log4j .In log4j ,there is an HTMLLayout with which one can create the log file as html.Is there any such facility in python logging? Or do anyone know how I can format the log output into an html file ?
python logging how to create logfile as html
0.291313
0
0
7,716
7,039,931
2011-08-12T12:16:00.000
1
0
1
0
python
7,039,951
4
false
0
0
\ is the escape character. \' means '. Think about it, how else would you represent ' in a single quoted string? To use a \ character, you need to have \\ in the string.
1
3
0
I'm newbie in Python. I'm trying to insert in a string a "\" character, but if i declare it like this, it takes \" as a " character. I also tried to declare, e.g. fname='\\' but it does not work. What I mean to do is to add to a path e:\\Others\Contacts the string \<filename>. May anyone help me?
Python - "\" character
0.049958
0
0
922
7,041,752
2011-08-12T14:40:00.000
11
0
1
0
coding-style,python
7,041,812
11
false
0
0
Well, there are a few reasons why I would not do that. If all your arguments are keyword arguments, it increases noise in the code and it might remove clarity about which arguments are required and which ones are optionnal. Also, if I have to use your code, I might want to kill you !! (Just kidding), but having to type...
5
66
0
Before jumping into python, I had started with some Objective-C / Cocoa books. As I recall, most functions required keyword arguments to be explicitly stated. Until recently I forgot all about this, and just used positional arguments in Python. But lately, I've ran into a few bugs which resulted from improper positions...
Any reason NOT to always use keyword arguments?
1
0
0
11,146
7,041,752
2011-08-12T14:40:00.000
64
0
1
0
coding-style,python
7,041,991
11
true
0
0
There isn't any reason not to use keyword arguments apart from the clarity and readability of the code. The choice of whether to use keywords should be based on whether the keyword adds additional useful information when reading the code or not. I follow the following general rule: If it is hard to infer the function ...
5
66
0
Before jumping into python, I had started with some Objective-C / Cocoa books. As I recall, most functions required keyword arguments to be explicitly stated. Until recently I forgot all about this, and just used positional arguments in Python. But lately, I've ran into a few bugs which resulted from improper positions...
Any reason NOT to always use keyword arguments?
1.2
0
0
11,146
7,041,752
2011-08-12T14:40:00.000
6
0
1
0
coding-style,python
7,041,999
11
false
0
0
I remember reading a very good explanation of "options" in UNIX programs: "Options are meant to be optional, a program should be able to run without any options at all". The same principle could be applied to keyword arguments in Python. These kind of arguments should allow a user to "customize" the function call, bu...
5
66
0
Before jumping into python, I had started with some Objective-C / Cocoa books. As I recall, most functions required keyword arguments to be explicitly stated. Until recently I forgot all about this, and just used positional arguments in Python. But lately, I've ran into a few bugs which resulted from improper positions...
Any reason NOT to always use keyword arguments?
1
0
0
11,146
7,041,752
2011-08-12T14:40:00.000
4
0
1
0
coding-style,python
7,041,969
11
false
0
0
Sometimes, things should be simple because they are simple. If you always enforce you to use keyword arguments on every function call, soon your code will be unreadable.
5
66
0
Before jumping into python, I had started with some Objective-C / Cocoa books. As I recall, most functions required keyword arguments to be explicitly stated. Until recently I forgot all about this, and just used positional arguments in Python. But lately, I've ran into a few bugs which resulted from improper positions...
Any reason NOT to always use keyword arguments?
0.072599
0
0
11,146
7,041,752
2011-08-12T14:40:00.000
3
0
1
0
coding-style,python
7,042,030
11
false
0
0
I don't see the purpose of using keyword arguments when the meaning of the arguments is obvious
5
66
0
Before jumping into python, I had started with some Objective-C / Cocoa books. As I recall, most functions required keyword arguments to be explicitly stated. Until recently I forgot all about this, and just used positional arguments in Python. But lately, I've ran into a few bugs which resulted from improper positions...
Any reason NOT to always use keyword arguments?
0.054491
0
0
11,146
7,044,319
2011-08-12T17:58:00.000
2
1
0
0
python,amazon-web-services,parallel-processing,boto,amazon-sqs
7,045,553
1
false
0
0
As far as I know there is no way of doing this. Seeing as your processing code should only take what it needs off the queue and nothing more it doesn't seem like you would ever need to do this. Do your jobs actually take 5hrs to complete? I assume based on "I'm working with large timeouts" they do but if not you can se...
1
3
0
Is it possible to retrieve messages from an SQS queue during their visibility timeout if you don't have the message id? I.e. something along the lines of "get invisible messages" or "get messages currently being processed". I'm working with large timeouts and sometimes I'd like to be able to inspect the queue to see wh...
Is it possible to retrieve messages from SQS while they're invisible?
0.379949
0
1
1,141
7,048,132
2011-08-13T01:11:00.000
12
0
1
0
python
7,048,133
2
false
0
0
I can't really tell why your code is broken because you haven't shown anybody what your code is. Please post samples and links next time. Python % is used in two places, one is mathematical (the modulo operator), and the other has to do with formatting text. I'm going to assume "counting eggs" means the math way. The ...
1
1
0
I'm working on the exercises in Learning Python the Hard Way and I am wondering what the % function does. I am getting the wrong answer when i count my eggs and hoping understanding this will help me understand what I'm doing wrong.
The % function in Python
1
0
0
1,222
7,049,637
2011-08-13T09:33:00.000
9
0
1
0
python,oop
7,049,703
2
true
0
0
Any Python project of any size will become unmanageable without objects. Is it possible to use modules as your objects instead of classes? Yes, if you really want to. (In Python, a module is what you call a single file.) However, even if you aren't creating user-defined classes, you still need to learn how to use objec...
1
0
0
OK to be short =) I'm noob yes. -.- but I'm convinced i don't need to learn everything.. and that a specific field of knowledge suited to my project may save me time..? I'm going to build a game that i have designed but not begun constructing. I'm going to learn everything i need to to get my project finished. however ...
Do I need to learn about objects, or can I save time and just learn dictionaries?
1.2
0
0
627
7,050,945
2011-08-13T14:14:00.000
2
0
0
0
python,django,facebook,user-input,anonymous
7,050,989
2
true
1
0
Don't rely on facebook login, as users without facebook will not be able to vote. As there is no real way to be sure that an unregistered user will not vote twice (he can connect himself from another computer, or whatever), you have to define yourself what is the criteria you want to use to check his identity. You have...
1
1
0
I'd like the users of my web application to not have to register a user account before they can vote. I've seen websites where I could freely vote up or down on what ever I want without having to register. How is this handled? How can I prevent the same person from voting infinite amounts of times? I'm using Python and...
How should I handle anonymous user input?
1.2
0
0
310
7,051,276
2011-08-13T15:12:00.000
3
1
0
1
python,node.js,npm,waf
7,057,283
1
true
1
0
To solve the path problem, I backed up and re-installed Node. To solve the version problem, at the suggestion of some bright soul on the #nodejs channel, I created a symbolic link at ~/bin/python that pointed to the right version (that solved a lot of my own problems too, starting up the wrong version from the command...
1
4
0
First, props to whoever did node.js. I've been using it for less than a day and I'm already thinking about using it for stuff I use Python for now. In fact, whoever did node.js should think about using it for stuff they use Python for now. There is apparently a tool called node-waf that is in Python and is necessar...
How do I get node-waf to install?
1.2
0
0
5,062
7,051,282
2011-08-13T12:46:00.000
0
1
0
0
php,python,ide
7,051,285
5
false
1
0
Eclipse and Visual Studio have plugins for just about everything. Eclipse is free, I think for Visual Studio though you'd have to get the professional version to run plugins...
2
6
0
I used to use netbeans for a while and really liked it. But now, I wan't to expand my toolbox with Python, and Netbeans dropped support for Django, also Python support seems to suck in NB 7.0. So I am looking for recommendations on IDE or Text Editor for Windows with support: Python (possibly with Django) PHP HTML, ...
IDE for PHP and Python Windows
0
0
0
3,567
7,051,282
2011-08-13T12:46:00.000
0
1
0
0
php,python,ide
7,051,283
5
false
1
0
Well Aptana is built upon eclipse, so you could just use the basic eclipse with all your necessary add ons. Obviously you'll need Pydev for the python stuff and that has Django integration. For some reason though I actually prefer netbeans for my php ide. Tbh just try out a few and see which one you like best.
2
6
0
I used to use netbeans for a while and really liked it. But now, I wan't to expand my toolbox with Python, and Netbeans dropped support for Django, also Python support seems to suck in NB 7.0. So I am looking for recommendations on IDE or Text Editor for Windows with support: Python (possibly with Django) PHP HTML, ...
IDE for PHP and Python Windows
0
0
0
3,567
7,052,169
2011-08-13T17:37:00.000
2
1
0
0
java,c++,python,audio,signal-processing
7,052,252
2
false
1
0
I'd start by computing the FFT spectrogram of both the haystack and needle files (so to speak). Then you could try and (fuzzily) match the spectrograms - if you format them as images, you could even use off-the-shelf algorithms for that. Not sure if that's the canonical or optimal way, but I feel like it should work.
1
2
0
I want to be able to identify an audio sample (that is provided by the user) in a audio file I've got (mp3). The mp3 file is a radio stream that I've kept for testing purposes, and I have the Pre-roll of the show. I want to identify it in the file and get the timestamp where it's playing in the file. Note: The solution...
Identify audio sample in a file
0.197375
0
1
573
7,052,259
2011-08-13T17:54:00.000
1
0
1
0
python,class,user-interface,wxpython
58,936,319
2
false
0
0
You will need to use a class to overwrite the behavior of an existing Widget. Many tutorials online start by using a custom extension of wx.Frame as the base window for the application, but in fact there is no real reason to do that. If you are satisfied with everything that widgets normally provide out of the box ther...
1
2
0
I'm very new to python and i have some stupid question, thank you for helping! when I search online about wxpython questions, I see almost 100% of the people use class for wxpython. From the book i learnt, the author didn't mention using class for wxpython, instead he gave us a few examples that didn't use class. I ju...
With WXPython when is it necessary to use classes?
0.099668
0
0
321
7,053,284
2011-08-13T21:06:00.000
5
0
1
0
python,multithreading,multiprocessing
7,053,307
2
false
0
0
The trouble with Python is that the most common interpreters contain a global lock -- commonly known as the GIL. This means that only one thread can execute python code at once, so a multi-process model can often make more efficient use of multiple cores than a multi-thread model.
1
1
0
I would like to run several receivers that will receive data in different ports, but are basically the same. What is more suitable in performance aspect - Multithreading or Multiprocessing?
What is more suitable in performance aspect - Multithreading or Multiprocessing?
0.462117
0
0
212
7,053,607
2011-08-13T22:09:00.000
1
0
1
0
python,string,subscript
7,053,632
4
false
0
0
You could add a [:-3] right after the name of the string. That would give you a string with all the characters from the start, up to the 3rd from last character. Alternatively, if you want the first 3 characters dropped, you could use [3:]. Likewise, [3:-3] would give you a string with the first 3, and the last 3 chara...
2
9
0
Very new to Python and have very simple question. I would like to trim the last 3 characters from string. What is the efficient way of doing this? Example I am going becomes I am go
How to trim characters in Python?
0.049958
0
0
14,875
7,053,607
2011-08-13T22:09:00.000
14
0
1
0
python,string,subscript
7,053,624
4
false
0
0
You can use new_str = old_str[:-3], that means all from the beginning to three characters before the end.
2
9
0
Very new to Python and have very simple question. I would like to trim the last 3 characters from string. What is the efficient way of doing this? Example I am going becomes I am go
How to trim characters in Python?
1
0
0
14,875
7,053,905
2011-08-13T23:19:00.000
1
0
1
0
java,c++,python,communication
7,053,927
3
false
0
0
Sockets, shared memory, events / signals, pipes, semaphores, message queues, mailslots. Just search the Internet for either.
1
6
0
I am very new to programming, and have had no formal training in it before so please bear with me if this is a vague question. I was just curious: how do different programs on the same computer communicate with each other? From my programming experience I believe it can be achieved by socket programming? Thanks
Communicating between applications?
0.066568
0
1
650
7,054,082
2011-08-14T00:04:00.000
3
0
0
0
python,django,localization,internationalization
7,056,068
2
true
1
0
Your templates folder either needs to be in an app that has been listed in INSTALLED_APPS or in a directory that has been listed in TEMPLATE_DIRS - in your settings.py file
1
6
0
I am trying to run the Django language localization on a project, but makemessages always ignores the html templates in my templates folder. I'm running python manage.py makemessages -a from the project root, and all of the strings that are marked for translation inside .py files anywhere in the project are successful...
Why would the makemessages function for Django language localization ignore html files?
1.2
0
0
3,604
7,054,379
2011-08-14T01:22:00.000
0
0
1
0
python,windows,python-3.x,python-2.6
7,268,787
2
false
0
0
Here's how to fix the registry settings, so double-clicking a .py file will work: Go into control panel, choose Add/Remove Programs. Find Python 2.6 and choose the option to repair it. Test to see if that fixed the problem. If it still doesn't work, then: Go into control panel, choose Add/Remove Programs. Find Pytho...
2
0
0
Hi I am running in windows XP. I have python2.6 and python 3.2 installed at the same time. My problem is when i uninstall python 3.2 and run a program with an error, the CMD does not return error message. But the program execute properly when it has no error. I've tried re installing python2.6 but it is still the same...
no error message in CMD after uninstalling python3.2
0
0
0
197
7,054,379
2011-08-14T01:22:00.000
2
0
1
0
python,windows,python-3.x,python-2.6
7,054,586
2
true
0
0
From the desktop, right-click My Computer and click Properties. In the System Properties window, click on the Advanced tab. In the Advanced section, click the Environment Variables button. In the Environment Variables window highlight the Path variable in the Systems Variable section and click the Edit button. Each dir...
2
0
0
Hi I am running in windows XP. I have python2.6 and python 3.2 installed at the same time. My problem is when i uninstall python 3.2 and run a program with an error, the CMD does not return error message. But the program execute properly when it has no error. I've tried re installing python2.6 but it is still the same...
no error message in CMD after uninstalling python3.2
1.2
0
0
197
7,054,424
2011-08-14T01:34:00.000
8
0
1
1
python,windows
34,164,041
14
false
0
0
I had the same problem for a long time. I just managed to resolve it. So, you need to select your Path, like the others said above. What I did: Open a command window. Write set path=C:\Python24 (put the location and the version for your python). Now type python, It should work. The annoying part with this is that you...
8
101
0
I just downloaded and installed Python 2.7.2 to my laptop and I am trying to run some sample programs. My laptop is running Windows XP. When I open a cmd window and type python I get: 'python' is not recognized as an internal or external command, operable program or batch file. I am not a Windows person (mostly mainf...
"python" not recognized as a command
1
0
0
308,763
7,054,424
2011-08-14T01:34:00.000
175
0
1
1
python,windows
7,054,429
14
false
0
0
You need to add the python executable path to your Window's PATH variable. From the desktop, right-click My Computer and click Properties. In the System Properties window, click on the Advanced tab. In the Advanced section, click the Environment Variables button. Highlight the Path variable in the Systems Variable sec...
8
101
0
I just downloaded and installed Python 2.7.2 to my laptop and I am trying to run some sample programs. My laptop is running Windows XP. When I open a cmd window and type python I get: 'python' is not recognized as an internal or external command, operable program or batch file. I am not a Windows person (mostly mainf...
"python" not recognized as a command
1
0
0
308,763
7,054,424
2011-08-14T01:34:00.000
8
0
1
1
python,windows
14,403,672
14
false
0
0
Just another clarification for those starting out. When you add C:\PythonXX to your path, make sure there are NO SPACES between variables e.g. This: SomeOtherDirectory;C:\Python27 Not this: SomeOtherDirectory; C:\Python27 That took me a good 15 minutes of headache to figure out (I'm on windows 7, might be OS dependent...
8
101
0
I just downloaded and installed Python 2.7.2 to my laptop and I am trying to run some sample programs. My laptop is running Windows XP. When I open a cmd window and type python I get: 'python' is not recognized as an internal or external command, operable program or batch file. I am not a Windows person (mostly mainf...
"python" not recognized as a command
1
0
0
308,763
7,054,424
2011-08-14T01:34:00.000
5
0
1
1
python,windows
7,054,442
14
false
0
0
Go to Control Panel / System / "Advanced" tab / Enviromental Variables Find variable called PATH in the lower list, and edit it. Add to the end C:\Python27 Open a new cmd window and try now.
8
101
0
I just downloaded and installed Python 2.7.2 to my laptop and I am trying to run some sample programs. My laptop is running Windows XP. When I open a cmd window and type python I get: 'python' is not recognized as an internal or external command, operable program or batch file. I am not a Windows person (mostly mainf...
"python" not recognized as a command
0.071307
0
0
308,763
7,054,424
2011-08-14T01:34:00.000
0
0
1
1
python,windows
23,728,520
14
false
0
0
Make sure you click on Add python.exe to path during install, and select: "Will be installed on local hard drive" It fixed my problem, hope it helps...
8
101
0
I just downloaded and installed Python 2.7.2 to my laptop and I am trying to run some sample programs. My laptop is running Windows XP. When I open a cmd window and type python I get: 'python' is not recognized as an internal or external command, operable program or batch file. I am not a Windows person (mostly mainf...
"python" not recognized as a command
0
0
0
308,763
7,054,424
2011-08-14T01:34:00.000
5
0
1
1
python,windows
57,314,543
14
false
0
0
emphasis: Remember to always RESTART the CMD WINDOW after setting the PATH environmental variable for it to take effect!
8
101
0
I just downloaded and installed Python 2.7.2 to my laptop and I am trying to run some sample programs. My laptop is running Windows XP. When I open a cmd window and type python I get: 'python' is not recognized as an internal or external command, operable program or batch file. I am not a Windows person (mostly mainf...
"python" not recognized as a command
0.071307
0
0
308,763
7,054,424
2011-08-14T01:34:00.000
0
0
1
1
python,windows
65,580,961
14
false
0
0
Easy. Won't need to get confused but paths and variables and what to click. Just follow my steps: Go to the python installer. Run it. Out of the 3 options choose modify. Check py launcher. Next. Check "Add python to environment variables" Install. Restart the cmd when finished and boom done
8
101
0
I just downloaded and installed Python 2.7.2 to my laptop and I am trying to run some sample programs. My laptop is running Windows XP. When I open a cmd window and type python I get: 'python' is not recognized as an internal or external command, operable program or batch file. I am not a Windows person (mostly mainf...
"python" not recognized as a command
0
0
0
308,763
7,054,424
2011-08-14T01:34:00.000
0
0
1
1
python,windows
45,619,442
14
false
0
0
Another helpful but simple solution might be restarting your computer after doing the download if Python is in the PATH variable. This has been a mistake I usually make when downloading Python onto a new machine. After restarting my machine then Windows will often recognize Python in the PATH variable.
8
101
0
I just downloaded and installed Python 2.7.2 to my laptop and I am trying to run some sample programs. My laptop is running Windows XP. When I open a cmd window and type python I get: 'python' is not recognized as an internal or external command, operable program or batch file. I am not a Windows person (mostly mainf...
"python" not recognized as a command
0
0
0
308,763
7,056,908
2011-08-14T12:54:00.000
7
0
1
0
python,syntax,operator-overloading,factorial
7,056,947
2
true
0
0
If you mean, "can I define the ! operator in my Python program?," the answer is no, Python doesn't have a bang operator that can be defined. If you mean, "could Python be extended to include a ! operator?," the answer is yes, though probably not as a postfix operator like x!. I very much doubt that the Python communit...
1
1
0
Can a working factorial function/operator be defined with a syntax like in mathematics? i.e. using the ! symbol. I can't think of any use cases of the existing symbol where things could be ambiguous ipython !shell_escape always has the bang at the start of a line something like 0!=1 would be True as usual because the...
use exclam (!) syntax for factorial in python
1.2
0
0
3,976
7,057,757
2011-08-14T15:34:00.000
13
0
1
0
python,tuples
7,057,768
2
true
0
0
tuples are immutable, you cannot change their content. EDIT - as commented on the question, and I'm not sure came clear from my answer - there are methods for tuples, but not methods that modify them.
2
4
0
Why does Python's tuple not have any method associated with it? e.g. tuple.append(), tuple.remove(), etc.? If the contents of tuple are accessed as we access list items, then why does tuple not have list-related methods?
Why does Python's tuple not have any method?
1.2
0
0
4,242
7,057,757
2011-08-14T15:34:00.000
7
0
1
0
python,tuples
7,058,091
2
false
0
0
Tuples are immutable, whereas lists can be modified. This in itself explains why tuples don't have any way of modifying them, but implies another question... why are they immutable? what good is an immutable list? why not just have a single list type? It comes down to a couple of subtle design considerations... To a de...
2
4
0
Why does Python's tuple not have any method associated with it? e.g. tuple.append(), tuple.remove(), etc.? If the contents of tuple are accessed as we access list items, then why does tuple not have list-related methods?
Why does Python's tuple not have any method?
1
0
0
4,242
7,060,245
2011-08-14T22:45:00.000
2
0
1
0
python
7,081,728
2
false
0
0
My code make heavy use of the pandas module. I wrote to its creator, Wes McKinney, and sent him profiles of code from Python2.6/Pandas0.3 and Python2.7/Pandas0.4. He found it was pandas that had changed (and slowed for my use, though perhaps not in general) and added some optimizations to help me out. Now my 2.7/0.4...
1
4
0
I just installed python 2.7 and find it to be 25-30% slower than 2.6 . When I run a program of mine under 2.7, it takes 1m17s, while under 2.6 that same prog takes 0m57s. Is this common? Included in the upgrade are numpy 1.6.1 (from 1.6.0), pandas 0.4 (from 0.3), and maybe other things.
python 2.7 vs 2.6 speed on Windows
0.197375
0
0
817
7,060,534
2011-08-14T23:47:00.000
7
0
0
0
c++,python,qt,events,pyqt
7,060,600
2
true
0
1
Sliders have a sliderMoved(int value) signal, where value is the new position of slider.
1
10
0
I need an event for detecting if an user has moved the scrollbar position to another one. In other words, if the user does scroll up/down, would it be possible to catch a signal so I can know the scroll has been changed its position? I think it's not important, but the scrollbar I refer to is inside a QGraphicsView. Re...
A scrollbar event when scrolling?
1.2
0
0
4,663
7,060,691
2011-08-15T00:25:00.000
1
0
1
0
python,parsing,pyparsing
7,060,777
1
true
0
0
"Suppress" is probably what you want. You can use the Suppress class explicitly, as in dont_care = Suppress(Word(alphas)) or call suppress() on any expression, dont_care = Word(alphas).suppress(). This will suppress the matched tokens from appearing in the parsed output.
1
2
0
I'm writing a parser for some marked-up data, and I'd like to get pyparsing to discard things like start and end tags in the final result, leaving just the data. Can I do this, or do I just have to name the value appropriately and pull them out manually?
How do I tell pyparsing to discard parts of the parsed string?
1.2
0
0
161
7,062,317
2011-08-15T06:46:00.000
2
0
0
0
python,sockets
7,062,480
1
true
0
0
If you know that you will communicate between the two processes soon again, there is no need for closing the connection. If your server has to deal with other connections as well, you want to make it multithreaded, though. The same. You know that both have to do the same thing, right? You have to create a new socket o...
1
3
0
I've been struggling along with sockets, making OK progress, but I keep running into problems, and feeling like I must be doing something wrong for things to be this hard. There are plenty of tutorials out there that implement a TCP client and server, usually where: The server runs in an infinite loop, listening for a...
What is the correct procedure for multiple, sequential communications over a socket?
1.2
0
1
643
7,064,197
2011-08-15T11:03:00.000
1
0
0
0
python,mysql,django,blob,django-blob
7,108,043
2
true
1
0
I have been dealing with this same issue, writing a pdf to a mediumblob field in mysql and retrieving via django. I have set the mysql field type to a mediumblob and the django field type to textfield. I have used a queryset and httpresponse to view the PDF objects in a browser (but not directly in django).
1
10
0
I have a C# program that inserts a pdf inside a MySQL database. Now I want to retrieve that pdf via django but django's models.FileField needs an "Upload To" parameter which means behind the scenes it actually stores the File on the file system rather than in the database. Is there any way I can set up a django model ...
Django Binary or BLOB model field
1.2
0
0
25,605
7,064,564
2011-08-15T11:51:00.000
1
0
0
0
python,django
7,064,785
2
false
1
0
Could you post a link to that piece of documentation, please? In Django you configure, in settings.py, the search path for templates (through TEMPLATE_DIRS variable). Then, inside a view, you render a template naming its file relative to one of the path included in TEMPLATE_DIRS. That way, whenever you move you templat...
1
0
0
In django, the documentation asks to use the absolute paths and not the relative paths. Then, how do they manage portability ? If I have my template in the project folder then, even a rename of the folder will cause breakage.. ! Then what is the reason behind this practice ? Please explain ?
Why absolute paths to templates and css in django ? (Isn't that a bad practice ?)
0.099668
0
0
612
7,065,283
2011-08-15T13:08:00.000
1
0
0
1
python,django,postgresql,comet,gevent
11,276,439
2
false
1
0
Instead of Apache + X-Sendfile you could use Nginx + X-Accel-Redirect. That way you can run a gevent/wsgi/django server behind Nginx with views that provide long-polling. No need for a separate websockets server. I've used both Apache + X-Sendfile and Nginx + X-Accel-Redirect to serve (access-protected) content on Webf...
1
5
0
I have been working with Django for some time now and have written several apps on a setup that uses Apache 2 mod_wsgi and a PostgreSQL database on ubuntu. I have aa app that uses xsendfile to serve files from Apache via a Django view, and also allow users to upload files via a form as well. All this working great, bu...
Should I use orbited or gevent for integrating comet functionality into a django app
0.099668
0
0
1,434
7,066,395
2011-08-15T14:50:00.000
1
0
1
1
python,centos
7,066,558
2
true
0
0
Try specifying the full path to the python executable (i.e. /opt/python27/python) rather than using a bare python command. Alternatively, place /opt/python27/ on your PATH earlier than /usr/local/bin (where the python command is presumably already present, you can check with which python).
2
2
0
I recently attempted to upgrade our Python install on a CentOS server from 2.4.3 to 2.7, however it lists 2.4.3 as the newest stable release. This is a problem because I have a Python program that requires at least 2.7 to run properly. After contacting support they installed Python 2.7 in a separate directory, howeve...
Using Non-Standard Python Install
1.2
0
0
608
7,066,395
2011-08-15T14:50:00.000
2
0
1
1
python,centos
7,066,607
2
false
0
0
I'd suggest you ask your support team to build a separate RPM for Python2.7 and have it installed in a separate location and not conflicting with the OS version. I've done this before it was great to have a consistent Python released across my RHEL3, 4, and 5 systems. Next, I'd suggest you use the following for your sh...
2
2
0
I recently attempted to upgrade our Python install on a CentOS server from 2.4.3 to 2.7, however it lists 2.4.3 as the newest stable release. This is a problem because I have a Python program that requires at least 2.7 to run properly. After contacting support they installed Python 2.7 in a separate directory, howeve...
Using Non-Standard Python Install
0.197375
0
0
608
7,067,279
2011-08-15T15:55:00.000
2
1
1
1
python,eclipse,pydev
7,067,352
2
true
0
0
Yes, check the run configurations. You can add the script as a "Python Run".
1
5
0
In matlab, it is possible to execute a script (ie an m-file) and then manipulate the variables created by the script on the command line. Is it possible to run a .py file on PyDev and consequently, manipulate its variables inside eclipse as is possible in the case of matlab?
Running python command line interpreter inside PyDev
1.2
0
0
7,173
7,067,726
2011-08-15T16:30:00.000
7
0
1
0
python,linked-list
7,067,801
2
false
0
0
This sounds like a perfect use for a dictionary.
1
0
1
there are huge number of data, there are various groups. i want to check whether the new data fits in any group and if it does i want to put that data into that group. If datum doesn't fit to any of the group, i want to create new group. So, i want to use linked list for the purpose or is there any other way to doing s...
linked list in python
1
0
0
468
7,067,787
2011-08-15T16:35:00.000
11
0
1
0
python,multiprocessing
7,079,399
1
true
0
0
On Windows, multiprocessing tries to emulate the Unix fork() system call by starting new instances of your executable, and execute its child process routine (multiprocessing.forking.main()) therein. With the standard Python interpreter (python.exe), multiprocessing can pass the -c parameter to run custom code. For cu...
1
8
0
I just discovered a bizarre bug in my program related to its use of Python's multiprocessing module. Everything works fine when I run the program from the source on my machine. But I've been building it into an executable using pyinstaller, and for some reason the behavior of multiprocessing changes drastically when I ...
Python - Multiprocessing.processes become copies of the main process when run from executable
1.2
0
0
6,027
7,067,909
2011-08-15T16:47:00.000
0
1
0
0
python,mongodb,amazon-web-services,cloud-hosting,mlab
7,068,152
1
true
1
0
One thing to consider is that you don't need to use MongoLab's REST API. You can connect directly via a driver as well. So, if you need to implement business logic (which it sounds like you do), it makes sense to have a three tier architecture with an app server connecting to your MongoLab database via one of the driv...
1
0
0
I am looking for feasible solutions for my Application to be backed with MongoDB. I am looking to host the MongoDB on the cloud with a python based server to interact with the DB and my app (either mobile/web). I am trying to understand how the architecture should look like. Either i can host a mongoDB on the AWS clou...
Using MongoLab Database service vs Custom web service with MongoDB running on AWS
1.2
0
0
501
7,068,340
2011-08-15T17:30:00.000
2
0
1
0
python,api,python-3.x
7,068,379
4
false
0
0
I do not think there is a way to do it - at least not a clean way. Even the Python official modules have a lot of util functions appearing in its documentation. What I would do, if the separation is important, is to create two different modules. Anyway, to use from module import * is not a good practice and I would not...
2
5
0
I have a module which is split roughly in half between utility type functions and core api functions. I need to have all of them in __all__ in order to have help() be useful, and also to specify which of the many functions/classes/etc in the module are for external use, but I also want to support from mymodule import ...
How to define a `from ... import *' api seperate from __all__ in a module?
0.099668
0
0
830
7,068,340
2011-08-15T17:30:00.000
0
0
1
0
python,api,python-3.x
7,068,394
4
false
0
0
You can't have what you want: import * behavior is defined by __all__.
2
5
0
I have a module which is split roughly in half between utility type functions and core api functions. I need to have all of them in __all__ in order to have help() be useful, and also to specify which of the many functions/classes/etc in the module are for external use, but I also want to support from mymodule import ...
How to define a `from ... import *' api seperate from __all__ in a module?
0
0
0
830
7,070,097
2011-08-15T20:02:00.000
3
1
0
0
php,python,ruby-on-rails,django,plone
7,070,188
2
false
1
0
It does not really matter in which language you would make it. If you are good programmer, the application will work fine in any of those environment. If you are not good programmer, it will sux always :) you can do it for example in Ruby on Rails, but what is the purpose if you will not be able to follow MVC structure...
2
0
0
I have a php video hosting site, not a typical video hosting site, but i think you put it in that category. I'm almost done with it, I'll launch it maybe next week, i created it in php because my partner wanted to get it done so fast, and the fastest way for me to do it was php, because i know it could be done with php...
which is better for my project: Django, Plone, php, or ruby on rails
0.291313
0
0
588
7,070,097
2011-08-15T20:02:00.000
2
1
0
0
php,python,ruby-on-rails,django,plone
7,070,199
2
true
1
0
I think you should stick with PHP : you already know the language you already have the tools for development you already have a code base I think you should see how your site behaves in production and see what are the most wanted user needs before spending time rewriting everything, and during this time not beeing a...
2
0
0
I have a php video hosting site, not a typical video hosting site, but i think you put it in that category. I'm almost done with it, I'll launch it maybe next week, i created it in php because my partner wanted to get it done so fast, and the fastest way for me to do it was php, because i know it could be done with php...
which is better for my project: Django, Plone, php, or ruby on rails
1.2
0
0
588
7,071,166
2011-08-15T21:43:00.000
126
0
0
0
python,mysql,mysql-python
7,190,914
10
true
0
0
We found an attribute on the cursor object called cursor._last_executed that holds the last query string to run even when an exception occurs. This was easier and better for us in production than using profiling all the time or MySQL query logging as both of those have a performance impact and involve more code or mor...
1
82
0
I'm looking for a way to debug queries as they are executed and I was wondering if there is a way to have MySQLdb print out the actual query that it runs, after it has finished inserting the parameters and all that? From the documentation, it seems as if there is supposed to be a Cursor.info() call that will give info...
Print the actual query MySQLdb runs?
1.2
1
0
67,798
7,071,829
2011-08-15T23:06:00.000
1
1
0
0
python,django,satchmo
7,085,400
1
false
1
0
I managed to find the solution for this. It was a setting under the Satchmo /settings/ page, under the Payment section: Email Owner? Needs to be ticked. Feel like a bit of an idiot for missing this, but the reason I skipped over the payment section is that I'm using a custom payment module so didn't think it would appl...
1
1
0
I was wondering if there are any settings I need to do to enable Satchmo sending me an email (to the store config email address) each time an order is placed? I have set up the template: templates/shop/email/order_placed_notice.html and enabled Send HTML Email in the settings. The site is sending the order placed and o...
Not receiving order placed notice in Satchmo
0.197375
0
0
283
7,073,527
2011-08-16T04:04:00.000
0
0
1
0
python,build,cygwin,compilation,gstreamer
7,073,548
1
true
0
0
You need to tell it where to look for the headers from that GStreamer build, or copy them to (the cygwin version of) /usr/include or /usr/local/incude. Try ./configure --help to see what option would let you pass the header dir. Also, back in the GStreamer dir, take a look in the makefile -- it may have already install...
1
1
0
I've given up on the OSSBuild of PyGST (Gstreamer) due to several major bugs. Instead, I am building from source myself. However, I have hit a snag. I am running this build in Cygwin. After unpacking the tarball, I run ./configure in the unpacked folder. I get the following error after a little while: configure: error...
Installing PyGST with Cygwin
1.2
0
0
828
7,074,662
2011-08-16T07:05:00.000
1
0
0
1
python,google-app-engine
7,075,300
2
false
1
0
You can't; the only thing you can do is to stream these static files adding the Access-Control-Allow-Origin header to the Response.
1
4
0
Is there a way to set custom headers of responses to static file requests? E.g. I'd want to set Access-Control-Allow-Origin: * when serving static files.
App Engine, Python: setting Access-Control-Allow-Origin (or other headers) for static file responses
0.099668
0
1
692
7,075,312
2011-08-16T08:13:00.000
0
0
0
0
python,http,networking,http-post
7,075,385
3
false
0
0
Use the program to dump the traffic tcpdump or WireShark
1
0
0
I am trying to write a Python program that POSTs a build request to a Jenkins server over HTTPS. I have tried PycURL, which works well, but am now trying to replace that with standard library facilities. The revised program receives a 404 response from the server however, so I would like to inspect both versions of the...
How do I debug HTTPS post requests from my commandline program?
0
0
1
1,792
7,076,056
2011-08-16T09:22:00.000
4
0
1
1
python,windows,handle
7,076,325
2
false
0
0
To investigate this kind of things your best friend is Spy++, that comes with several versions of Visual Studio, if you can get it. According to it, notepad.exe creates three top-level windows: The visible main window, class name "Notepad", overlapped. A hidden, disabled, pop-up window, class name "MSCTFIME UI", capti...
2
5
0
In python, I enumerate top-level windows through EnumWindows, and also I enumerate the processes through EnumProcesses. Then in the python script, I put all the window handles which belongs to the same pid into one list (I did this through GetWindowThreadProcessId). Later I found out something: there are 3 window handl...
How can I get the main window's handle in Python?
0.379949
0
0
4,571
7,076,056
2011-08-16T09:22:00.000
5
0
1
1
python,windows,handle
7,076,281
2
true
0
0
Processes sometimes create invisible windows for their own purposes. You should ignore them (use IsWindowVisible function).
2
5
0
In python, I enumerate top-level windows through EnumWindows, and also I enumerate the processes through EnumProcesses. Then in the python script, I put all the window handles which belongs to the same pid into one list (I did this through GetWindowThreadProcessId). Later I found out something: there are 3 window handl...
How can I get the main window's handle in Python?
1.2
0
0
4,571
7,078,010
2011-08-15T02:07:00.000
0
0
0
0
graphics,python
7,078,262
3
false
1
0
If performance is such an issue and you don't need fancy graphs, you may be able to get by with not creating images at all. Render explicitly sized and colored divs for a simple bar chart in html. Apply box-shadow and/or a gradient background for eye candy. I did this in some report web pages, displaying a small 5-bar ...
1
0
1
I'm building a web application in Django and I'm looking to generate dynamic graphs based on the data. Previously I was using the Google Image Charts, but I ran into significant limitations with the api, including the URL length constraint. I've switched to using matplotlib to create my charts. I'm wondering if this w...
Generating dynamic graphs
0
0
0
228
7,079,473
2011-08-16T14:08:00.000
4
0
0
0
python,sorting,bigdata
7,079,899
4
false
0
0
Split up into files that can be sorted in memory. Sort each file in memory. Then merge the resulting files. Merge by reading a portion of each of the files to be merged. The same amount from each file leaving enough space in memory for the merged result. Once merged saving this. Repeating adding blocks of merged data o...
2
12
0
I have a large file (100 million lines of tab separated values - about 1.5GB in size). What is the fastest known way to sort this based on one of the fields? I have tried hive. I would like to see if this can be done faster using python.
sorting large text data
0.197375
0
0
12,973
7,079,473
2011-08-16T14:08:00.000
2
0
0
0
python,sorting,bigdata
7,079,684
4
false
0
0
I would store the file in a good relational database, index it on the field your are interested in and then read the ordered items.
2
12
0
I have a large file (100 million lines of tab separated values - about 1.5GB in size). What is the fastest known way to sort this based on one of the fields? I have tried hive. I would like to see if this can be done faster using python.
sorting large text data
0.099668
0
0
12,973
7,079,864
2011-08-16T14:31:00.000
23
0
1
1
python,real-time
24,819,846
6
false
0
0
When people talk about real-time computing, what they mean is that the latency from an interrupt (most commonly set off by a timer) to application code handling that interrupt being run, is both small and predictable. This then means that a control process can be run repeatedly at very precise time intervals or, as in...
3
16
0
So I am an inexperienced Python coder, with what I have gathered might be a rather complicated need. I am a cognitive scientist and I need precise stimulus display and button press detection. I have been told that the best way to do this is by using real-time operating, but have no idea how to go about this. Ideally, w...
Real-time operating via Python
1
0
0
43,212
7,079,864
2011-08-16T14:31:00.000
2
0
1
1
python,real-time
24,266,199
6
false
0
0
If you are running the Python code on Linux machine, make the kernel low latency (preemptive). There is a flag for it when you compile the kernel. Make sure that other processes running on the machine are minimum so they do not interrupt the kernel. Assign higher task priority to your Python script.
3
16
0
So I am an inexperienced Python coder, with what I have gathered might be a rather complicated need. I am a cognitive scientist and I need precise stimulus display and button press detection. I have been told that the best way to do this is by using real-time operating, but have no idea how to go about this. Ideally, w...
Real-time operating via Python
0.066568
0
0
43,212
7,079,864
2011-08-16T14:31:00.000
1
0
1
1
python,real-time
59,160,388
6
false
0
0
Run the python interpreter on a real time operating system or tweaked linux. Shut down the garbage collector during the experiments and back on afterward. Maybe actively trigger a garbage collection round after the end of an experiment. Additionally, keep in mind that showing an image is not instantaneous. You must sy...
3
16
0
So I am an inexperienced Python coder, with what I have gathered might be a rather complicated need. I am a cognitive scientist and I need precise stimulus display and button press detection. I have been told that the best way to do this is by using real-time operating, but have no idea how to go about this. Ideally, w...
Real-time operating via Python
0.033321
0
0
43,212
7,082,529
2011-08-16T17:42:00.000
0
0
1
0
python,loops,wxpython,infinite
7,083,015
3
false
0
1
Have you considered having wxPython invoke an event handler of yours periodically, and perform the background processing in this? This depends on you being able to divide your work into discrete pieces, of course. Be aware that your background processing would have to be non-blocking so control would return to wxPython...
1
3
0
I'm trying to write a python program with wxPython GUI. Program must to collect some information in background (infinite loop), but GUI should be active at this time. Like, if I click on the some button, some variable or another information must change, and at the new cycle this variable should be used instead of the o...
Python: Infinite loop and GUI
0
0
0
4,727
7,082,966
2011-08-16T18:14:00.000
1
0
1
0
python,python-3.x,coding-style
7,083,030
9
false
0
0
If you return None, it will be much easier for you to check the return value.
5
57
0
We have a object method that returns a city/state tuple, i.e. ('Boston', 'MA'). Under some valid circumstances, there is no valid city/state to return. Stylistically, does it make more sense to return None, or a two element tuple containing (None, None) in that case?
Should I Return None or (None, None)?
0.022219
0
0
5,621
7,082,966
2011-08-16T18:14:00.000
2
0
1
0
python,python-3.x,coding-style
7,083,301
9
false
0
0
To me, returning (None, None) would imply that (None, State) or (City, None) would also be valid return values. If that is the case, go with (None, None), otherwise, Felix and Brent provide very good arguments for simply returning None.
5
57
0
We have a object method that returns a city/state tuple, i.e. ('Boston', 'MA'). Under some valid circumstances, there is no valid city/state to return. Stylistically, does it make more sense to return None, or a two element tuple containing (None, None) in that case?
Should I Return None or (None, None)?
0.044415
0
0
5,621
7,082,966
2011-08-16T18:14:00.000
4
0
1
0
python,python-3.x,coding-style
7,084,190
9
false
0
0
why not making State a property of City? That way your function would return always one value: a City or None. Returning (None, None) is bad for all the reasons stated in the other answers and serves only to support tuple unpacking. None is the best value to return to state that no valid city can be returned, but havin...
5
57
0
We have a object method that returns a city/state tuple, i.e. ('Boston', 'MA'). Under some valid circumstances, there is no valid city/state to return. Stylistically, does it make more sense to return None, or a two element tuple containing (None, None) in that case?
Should I Return None or (None, None)?
0.088656
0
0
5,621
7,082,966
2011-08-16T18:14:00.000
1
0
1
0
python,python-3.x,coding-style
7,083,014
9
false
0
0
I would implement a public method for object that returned, let say isValidLocation() that returns true if location is valid and false if location is none.
5
57
0
We have a object method that returns a city/state tuple, i.e. ('Boston', 'MA'). Under some valid circumstances, there is no valid city/state to return. Stylistically, does it make more sense to return None, or a two element tuple containing (None, None) in that case?
Should I Return None or (None, None)?
0.022219
0
0
5,621
7,082,966
2011-08-16T18:14:00.000
11
0
1
0
python,python-3.x,coding-style
7,083,006
9
false
0
0
(None, None) does not evaluate to False in Python. In addition, building a tuple requires more work than, well, not building a tuple. So I would prefer None.
5
57
0
We have a object method that returns a city/state tuple, i.e. ('Boston', 'MA'). Under some valid circumstances, there is no valid city/state to return. Stylistically, does it make more sense to return None, or a two element tuple containing (None, None) in that case?
Should I Return None or (None, None)?
1
0
0
5,621
7,083,427
2011-08-16T18:49:00.000
3
0
1
1
python,multithreading,twisted,deep-copy
7,087,226
2
false
0
0
Try operating with the minimum data possible in your worker threads. Pass all data that they need in as arguments and take all of their output as the return value (the value the Deferred fires with) rather than as mutations to the inputs. Then integrate the results into the common data structure in the reactor thread....
1
6
0
I have a twisted server which does some "long" task for each request so i defer to thread each call. In each request i access a common resource, which gets altered during the process. Each request should start with the original data so i use deepcopy on the common resource (while invoking a lock acquire). It works, BUT...
Twisted threading howto avoid deepcopy
0.291313
0
0
1,543
7,084,430
2011-08-16T20:16:00.000
0
0
1
0
python,object
7,084,613
2
true
0
0
If you are trying to use your object with library code, that expects to be able to write what you give it to a file, then you may have to resort to implementing a "duck file" class that acts like a file but supports your stringable object. Unfortunately, file is not a type that you can subclass easily, at least as of ...
2
1
0
I have a custom class, which has some string data. I wish to be able to save this string data to a file, using a file handle's write object. I have implemented __str__(), so i can do str(myobject), what is the equivalent method for making python consider my object to be a character buffer object?
Make an object a "character buffer object"
1.2
0
0
3,072
7,084,430
2011-08-16T20:16:00.000
0
0
1
0
python,object
7,084,501
2
false
0
0
There isn't a single function, but a whole range of them - read, seek, etc. Why don't you subclass StringIO.StringIO, which is already a string buffer?
2
1
0
I have a custom class, which has some string data. I wish to be able to save this string data to a file, using a file handle's write object. I have implemented __str__(), so i can do str(myobject), what is the equivalent method for making python consider my object to be a character buffer object?
Make an object a "character buffer object"
0
0
0
3,072
7,085,184
2011-08-16T21:21:00.000
9
0
1
0
python,encapsulation
7,085,216
1
true
0
0
Python is not Java, use module-level methods without worry.
1
4
0
I have some methods in a file and all of them are defined in the global scope (a module). I did not bother to make a class because the class would never get instantiated and everything would still have to be accessed statically if I defined a class. Does it make sense to leave it as it is, or is it better design to mak...
Does it make sense to make a class in python when it would never get instantiated?
1.2
0
0
177
7,085,967
2011-08-16T22:40:00.000
4
0
1
0
python
7,086,367
3
false
0
0
It's because lists are mutable. [].sort() doesn't return a new list, it just changes the existing one, so the return value is nothing, or None. It's the same reason when you go to sort, you don't have to do something like list = list.sort(), you just do list.sort()
1
3
0
Why is it that [].sort() != [] but instead [].sort() = None? Logically, it seems that the first case should be true.
in place sort returns None for empty list
0.26052
0
0
6,311
7,087,529
2011-08-17T03:06:00.000
3
0
0
1
python,executable
7,087,550
1
true
0
1
You can't use py2exe on plain Ubuntu. It needs to run from Windows. Right now, py2exe doesn't work well with Wine. Do you not have access to any Windows computers (maybe one of your friends')? You can also get your friends to install Python on their Windows machines and teach them how to run your programs, if you're wi...
1
0
0
Okay, I'm completely new to this. I created a python script that imports tkinter. On my Ubuntu, I can execute the program from the terminal program. Till now there is no problem. However, my friends asked if I could deliver the program to them so that they could use it on their PC. They have 0 knowledge of programming...
python executable file in windows
1.2
0
0
245
7,088,175
2011-08-17T05:01:00.000
0
0
0
1
python,linux,pipe
7,088,283
2
false
0
0
First of all, for what you're doing, it should be better to generate the string using python directly. Anyway, when using subprocess, the correct way to pipe data from a process to another is by redirecting stdout and/or stderr to a subprocess.PIPE, and feed the new process' stdin with the previous process' stdout.
1
4
0
I'm trying to generate a random string using this command: strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 30 | tr -d '\n'; Works fine, but when I try to do subprocess.call(cmd,shell=True) it just gets stuck on the strings /dev/urandom command and spams my screen with grep: writing output: Broken pipe What's ca...
Getting output of system commands that use pipes (Python)
0
0
0
250
7,088,196
2011-08-17T05:05:00.000
0
1
0
0
c++,python,physfs
7,299,183
2
true
0
0
[I am the same person who asked the question.] The solution I used eventually was to modify Python's sys.path when my program starts. This does not pollute the game's data directories with symbolic links and is overall much cleaner.
1
0
0
I am writing a game engine and I'd like it to have Python scripting as well as support for mods using PhysFS. My game data is stored something like this: / native scripts sprites ... mods mymodname scripts What I want is for the mod scripts to be able to 'import' the native scripts as if they were in the same...
PhysFS and Python embedding
1.2
0
0
298
7,089,620
2011-08-17T08:09:00.000
1
0
1
0
python,compilation,cmake,vtk
28,362,827
4
false
0
1
You can use VTK with python just installing pythonxy framework, it is just a python with many many libraries included VTK, ITK, Qt and many other, also it is very well documented, and also have many examples, all in python. I recommend it to you, I have worked a lot with it, and is very amazing. Just make a try. All yo...
1
6
0
I want to use VTK together with Python on a Windows system. It seems that I cannot use the windows installer but "have to compile VTK from source code using CMake and a native build system". So far I have installed CMake. But now I wonder how to proceed? It seems that I need MS Visual Studio to create the project files...
VTK / Python / compile
0.049958
0
0
1,416
7,090,549
2011-08-17T09:25:00.000
0
0
0
0
python,django,docutils
11,377,138
4
false
1
0
Did you restart the Django server? Django has to restart to recognize the newly installed admindocs.
2
1
0
I'm trying to enable docutils for django on windows 7. I've enabled the links in urls.y and settings.py and downloaded and installed the latest snapshot of docutils. However every time I try to access the documentation link in the admin I get a page asking me to install docutils. Any ideas? Thanks
Django docutils not working
0
0
0
725
7,090,549
2011-08-17T09:25:00.000
0
0
0
0
python,django,docutils
70,630,985
4
false
1
0
You might have installed the docutils module in the virtual env/path. Uninstall it from the virtual path and re-install it in the global python installation folder. That should solve the problem. Note: Do not install django-docutils, but just simply docutils
2
1
0
I'm trying to enable docutils for django on windows 7. I've enabled the links in urls.y and settings.py and downloaded and installed the latest snapshot of docutils. However every time I try to access the documentation link in the admin I get a page asking me to install docutils. Any ideas? Thanks
Django docutils not working
0
0
0
725
7,090,957
2011-08-17T10:00:00.000
1
0
0
1
python,unicode,swig
8,785,250
1
false
0
0
This is from the SWIG docs, maybe you have seen this: At this time, SWIG provides limited support for Unicode and wide-character strings (the C wchar_t type). Some languages provide typemaps for wchar_t, but bear in mind these might not be portable across different operating systems. This is a delicate topic that is p...
1
4
0
Does anyone know if there is a way to make SWIG encode strings as UCS-4 for Python? The SWIG documentation states that this may be possible using typemaps, but does not provide any other details or examples. For context, I'm working on extending the Blender 3D software with a set of Python scripts. We need to interface...
Swig binding for Python using UCS-4
0.197375
0
0
421
7,091,583
2011-08-17T10:51:00.000
2
0
0
0
python,node.js
7,092,538
1
true
1
0
I think you have answered your own question. Python has greater maturity and by your own admission has the libraries you require. Could you narrow down your requirements a bit more?
1
0
0
I love node.js, socket.io, the templating engines, etc: as a web framework, it's amazing. A lot of my back-end work is with NLP, Machine Learning, and Data Mining, for which there exist hundreds of rock-solid Python libraries, but no Javascript libraries. If I were using Django, I'd just import the libraries and chug a...
Complex server logic and node.js
1.2
0
1
360
7,092,639
2011-08-17T12:18:00.000
0
0
1
0
python,python-idle
7,092,786
2
false
0
0
You've probably got some kind of firewall in place that prevents IDLE from opening a local network connection. What kind of firewall are you using? PS - in a pinch, you can just run python.exe from where it is installed and use a standard text editor (such as Notepad++) to create new scripts and modules. Do you know ho...
2
0
0
Firstly, sorry i'm just a beginner. Everytime i try to run/open python an IDLE subprocess error message comes up saying 'socket error: conection refused'. I'm not sure what to do about it, and because of this i can't use python. Could anyone help me please?
Python won't run everytime i try to run it, why is this?
0
0
1
946
7,092,639
2011-08-17T12:18:00.000
0
0
1
0
python,python-idle
7,092,770
2
false
0
0
On Windows, you have to create a firewall rule for IDLE, since it uses a network connection for certain tasks. Unfortunately I could not find any documentation on this topic, but I think it can be read in the IDLE README.
2
0
0
Firstly, sorry i'm just a beginner. Everytime i try to run/open python an IDLE subprocess error message comes up saying 'socket error: conection refused'. I'm not sure what to do about it, and because of this i can't use python. Could anyone help me please?
Python won't run everytime i try to run it, why is this?
0
0
1
946
7,093,689
2011-08-17T13:30:00.000
1
1
0
1
python,macos,osx-lion,launchd,pyserial
7,096,933
2
false
0
0
The path you are appending: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages is the site-packages directory for a third-party, non-system Python, possibly installed using a python.org installer, and not that of the Apple-supplied system Python 2.7, which would be: /Library/Python/2.7/site-p...
1
0
0
I have a launchd entry that worked with OSX 10.6 but that fails with 10.7. It uses python, and it produces an error whilst trying to import serial. I don't quite understand this, because I've re-downloaded pyserial-2.5 and re-installed it with sudo. (In desperation, I re-installed it for each of the many flavours of...
python/serial broken in OSX lion / launchd
0.099668
0
0
1,631
7,094,771
2011-08-17T14:45:00.000
1
0
0
0
python,excel,combobox,xlwt,xlrd
7,266,184
1
false
0
0
No, it's not possible. xlrd doesn't pick up the combo box and suchlike.
1
2
0
Is this possible? Generation of Excel combobox in a cell using xlwt or similar module? When I load the xls using xlrd, then copy and save it using xlwt, the combobox from original xls is lost.
Excel Combobox in Python xlwt module
0.197375
1
0
597
7,100,610
2011-08-17T23:07:00.000
3
0
0
0
python,django,django-templates
9,424,701
2
true
1
0
From the comments: I think you need to walk up the stacktrace (in the django debug page) to actually see your context variables. I don't understand your problem exactly. If I have a template error I can inspect my context somewhere in the traceback. Yes, setting a "breakpoint" in django can sometimes mean just insertin...
1
1
0
I am getting a template error during rendering, which I think would be easy to fix if I could just see what's in the context that is passed into the template that is being rendered. Django's debug error page provides a lot of information, but I'm not seeing my context anywhere. Am I missing something? Also, I am usi...
How to see current context when debugging template errors?
1.2
0
0
1,407
7,105,202
2011-08-18T09:27:00.000
12
1
0
0
c++,python,properties
7,105,239
3
true
0
0
Yes, explicit getter and setters would be the closest construct in C++.
1
7
0
Is there an equivalent of Python properties in C++? Or would it just be better to do this using getters and setters?
C++ equivalent of Python properties
1.2
0
0
2,093
7,106,417
2011-08-18T11:08:00.000
31
0
1
0
python,locale,decimal-point
7,106,436
7
true
0
0
float("2,5".replace(',', '.')) will do in most cases If valueis a large number and .has been used for thousands, you can: Replace all commas for points: value.replace(",", ".") Remove all but the last point: value.replace(".", "", value.count(".") -1)
1
35
0
I have a CSV file with data reading that I want to read into Python. I get lists that contain strings like "2,5". Now doing float("2,5") does not work, because it has the wrong decimal mark. How do I read this into Python as 2.5?
Convert decimal mark when reading numbers as input
1.2
0
0
95,378
7,111,149
2011-08-18T16:53:00.000
4
0
0
0
python,django,performance,benchmarking,django-orm
7,111,827
1
true
1
0
This information is only available in debug mode. I'm not aware of any library to do exactly what you are trying to do, however you could probably rig something up pretty easily. If you are in running in debug mode, then you can view all the queries that have been run with connection.queries. This is effectively how ...
1
1
0
I have a large complex Django App that we use that does lots of things. From looking at the Django Debug Toolbar some of our views do a lot of SQL requests. I want to increase the performance of it by reducing the number of SQL requests (e.g. by adding more select_related, more clever queries, etc.). I would like to be...
Is there a library to benchmark my Django App for SQL requests?
1.2
0
0
293