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
4,839,597
2011-01-29T21:36:00.000
4
1
1
0
python,string,search,large-files
4,839,646
3
false
0
0
If you've got a fixed data set and variable queries, then the usual technique is to reorganise the data set into something that can be searched more easily. At an abstract level, you could break up each article title into individual lowercase words, and add each of them to a Python dictionary data structure. Then, when...
3
6
0
I downloaded the Wikipedia article titles file which contains the name of every Wikipedia article. I need to search for all the article titles that may be a possible match. For example, I might have the word "hockey", but the Wikipedia article for hockey that I would want is "Ice_hockey". It should be a case-insensit...
most efficient way to find partial string matches in large file of strings (python)
0.26052
0
0
2,903
4,839,597
2011-01-29T21:36:00.000
1
1
1
0
python,string,search,large-files
4,841,314
3
false
0
0
I'd suggest you put your data into an sqlite database, and use the SQL 'like' operator for your searches.
3
6
0
I downloaded the Wikipedia article titles file which contains the name of every Wikipedia article. I need to search for all the article titles that may be a possible match. For example, I might have the word "hockey", but the Wikipedia article for hockey that I would want is "Ice_hockey". It should be a case-insensit...
most efficient way to find partial string matches in large file of strings (python)
0.066568
0
0
2,903
4,839,670
2011-01-29T21:49:00.000
1
0
0
0
python,curl,http-headers,pycurl
4,860,930
2
true
0
0
libcurl itself provides this data in the DEBUGFUNCTION callback, so if there's no current support for that in pycurl I figure it should be added and it shouldn't be too hard to do it...
2
0
0
Right now I'm using a proxy where I can see the headers that are sent. I'm wondering if there's a simpler pycurl method of grabbing the headers that were sent in an http request. Ive tried using HEADERFUNCTION already but it gives you the response headers and not the ones i'm looking for.
is there an easy way of fetching the sent headers of an http request for pycurl/curl?
1.2
0
1
230
4,839,670
2011-01-29T21:49:00.000
0
0
0
0
python,curl,http-headers,pycurl
4,903,643
2
false
0
0
There is indeed support for the debugfunction callback. Alternatively, if you just need the data for debugging purposes, set the verbose option to 1 on your Curl instance and the data will be sent to stdout.
2
0
0
Right now I'm using a proxy where I can see the headers that are sent. I'm wondering if there's a simpler pycurl method of grabbing the headers that were sent in an http request. Ive tried using HEADERFUNCTION already but it gives you the response headers and not the ones i'm looking for.
is there an easy way of fetching the sent headers of an http request for pycurl/curl?
0
0
1
230
4,839,749
2011-01-29T22:04:00.000
2
0
0
1
python,google-app-engine
4,841,024
3
false
1
0
Use from django.utils import simplejson. dev_appserver mimics the production environment. Nothing you install at the system level will be available for import to your scripts, to avoid imports working fine in your testing and then failing spectacularly when you deploy. However, you don't need to bundle this particula...
2
1
0
I'm getting a "ImportError: No module named simplejson" when trying to access datastore admin on the development server. After the first time I got this error I installed the simplejson package from slackbuilds (i'm on Slackware). It seems to be working normally, I could import the simplejson module with no errors on t...
Import error when trying to access sdk datastore admin
0.132549
0
0
769
4,839,749
2011-01-29T22:04:00.000
0
0
0
1
python,google-app-engine
27,462,399
3
false
1
0
If it in app engine SDK's lib, e.g on Mac it's /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/ Copy it over to app's dir would work. It's better than pip install and then copy over, which may contain c-extension. The modules in SDK's l...
2
1
0
I'm getting a "ImportError: No module named simplejson" when trying to access datastore admin on the development server. After the first time I got this error I installed the simplejson package from slackbuilds (i'm on Slackware). It seems to be working normally, I could import the simplejson module with no errors on t...
Import error when trying to access sdk datastore admin
0
0
0
769
4,840,182
2011-01-29T23:41:00.000
15
0
1
1
python
9,478,011
4
false
0
0
If you're willing to build and install the entire python package, this is how I would go about it: Edit the setup() function in setup.py to contain a parameter named scripts and set its argument as the location of the file(s) you wish to run from anywhere. e.g. setup(name='myproject',author='',author_email='',script...
1
81
0
I can't figure out how to make setup.py add a scrip to the the user's /bin or /usr/bin or whatever. E.g., I'd like to add a myscript.py to /usr/bin so that the user can call myscript.py from any directory.
setup.py and adding file to /bin/
1
0
0
48,656
4,841,436
2011-01-30T06:00:00.000
3
0
1
0
python,operators,compound-assignment
54,202,926
15
false
0
0
The short answer is += can be translated as "add whatever is to the right of the += to the variable on the left of the +=". Ex. If you have a = 10 then a += 5 would be: a = a + 5 So, "a" now equal to 15.
2
158
0
I need to know what += does in Python. It's that simple. I also would appreciate links to definitions of other shorthand tools in Python.
What exactly does += do?
0.039979
0
0
760,798
4,841,436
2011-01-30T06:00:00.000
32
0
1
0
python,operators,compound-assignment
4,841,451
15
false
0
0
+= adds a number to a variable, changing the variable itself in the process (whereas + would not). Similar to this, there are the following that also modifies the variable: -=, subtracts a value from variable, setting the variable to the result *=, multiplies the variable and a value, making the outcome the variable /...
2
158
0
I need to know what += does in Python. It's that simple. I also would appreciate links to definitions of other shorthand tools in Python.
What exactly does += do?
1
0
0
760,798
4,841,732
2011-01-30T07:33:00.000
3
0
1
0
python,python-2.x
4,842,269
5
false
0
0
There is no quantity 1/2 anywhere. Python does not represent rational numbers with a built-in type - just integers and floating-point numbers. 1 is divided by 2 - following the integer division rules - resulting in 0. float(0) is 0.
1
14
0
I want to convert 1/2 in python so that when i say print x (where x = 1/2) it returns 0.5 I am looking for the most basic way of doing this, without using any split functions, loops or maps I have tried float(1/2) but I get 0... can someone explain me why and how to fix it? Is it possible to do this without modifying t...
Convert fraction to decimal in Python
0.119427
0
0
52,481
4,842,049
2011-01-30T09:03:00.000
1
1
0
1
python
4,842,172
1
true
0
0
As @Thomas points out, blacklisting is a pretty poor mechanism for implementing any security mechanisms. Whitelisting is a much safer approach. But a mechanism inside the interpreter isn't particularly excellent for any number of reasons: flaws in the interpreter that are exploitable at the source code level would allo...
1
5
0
Is there any way to disable a module from being loaded on my system? Let's say i would like to restrict my users from accessing the subprocess or popen2 module. Something like PHP's 'disabled_functions' or any similar method to achieve the same thing.
DIsable Python module
1.2
0
0
3,339
4,842,449
2011-01-30T10:44:00.000
1
0
0
0
python,ajax,web-applications,user-interface,pyjamas
4,842,562
4
false
1
0
The biggest influence is whether you are concerned about initial page load time. If you don't mind having all the UI there at page load, your app can be more responsive by just shuttling data instead of UI. If you want faster load and don't mind larger AJAX requests, sending some UI markup isn't bad. If you have the se...
3
2
0
I have one design decision to make. In my web(ajax) application we need to decide where should we put user interface logic ? Should It be completely loaded via javascript ( pure single page ) . and Only data comes and go. or Should server send some format (XML) which translated via javascript to dynamically create...
rich web client vs thin web client
0.049958
0
1
993
4,842,449
2011-01-30T10:44:00.000
2
0
0
0
python,ajax,web-applications,user-interface,pyjamas
4,844,422
4
false
1
0
I faced similar dilemma few months back. As Lennart (above) says it makes sense to go for pyjamas or similar library if your app is more desktopish. Further one of the biggest advantage of pyjamas provide is logically well separated backend and frontend code. IMO that is very important. If your app is not like a deskt...
3
2
0
I have one design decision to make. In my web(ajax) application we need to decide where should we put user interface logic ? Should It be completely loaded via javascript ( pure single page ) . and Only data comes and go. or Should server send some format (XML) which translated via javascript to dynamically create...
rich web client vs thin web client
0.099668
0
1
993
4,842,449
2011-01-30T10:44:00.000
0
0
0
0
python,ajax,web-applications,user-interface,pyjamas
4,886,016
4
false
1
0
Which option is better ? ( speed, ease of development, platform independence ) Platform independence, if you mean cross-browser compatibility, is a HUGE reason to use pyjamas because the python code includes a sane override infrastructure which handles everything for you. No more JS compatibility classes. Anyway Pyjam...
3
2
0
I have one design decision to make. In my web(ajax) application we need to decide where should we put user interface logic ? Should It be completely loaded via javascript ( pure single page ) . and Only data comes and go. or Should server send some format (XML) which translated via javascript to dynamically create...
rich web client vs thin web client
0
0
1
993
4,844,166
2011-01-30T17:02:00.000
1
0
1
0
python,asynchronous,gearman
4,844,392
2
false
0
0
If your program is CPU bound in the interpreter then spawning multiple threads will actually slow down the result even if there are enough processors to run them all. This happens because the GIL (global interpreter lock) only allows one thread to run in the interpreter at a time. If most of the work happens in a C li...
1
1
0
I have a Python function which generates an image once it is accessed. I can either invoke it directly upon a HTTP request, or do it asynchronously using Gearman. There are a lot of requests. Which way is better: Inline - create an image inline, will result in many images being generated at once Asynchronous - queue ...
Threaded vs. asynchronous image processing?
0.099668
0
0
856
4,844,462
2011-01-30T17:52:00.000
13
0
1
0
python,numpy,python-3.x,matplotlib
4,844,503
4
true
0
0
You won't have a problem going back to Python 2.x after learning Python 3, or vice versa. There aren't too many differences. (Some standard library changes, print is a function, all strings are unicode -- you'll never notice most of them). Realistically, if you learn Python 3 now, and get a job working with Python, you...
2
7
0
I want to learn Python. I have a course to do in Python 3. However, I will need to use mainly the matplotlib and Numpy, and these libraries are not yet compatible with Python 3. Is it worth doing the course in Python 3 or will be a waste of time to learn Python 3 and then came back to Python 2.x? What would you do?
New to Python... Python 3 and Matplotlib
1.2
0
0
6,841
4,844,462
2011-01-30T17:52:00.000
4
0
1
0
python,numpy,python-3.x,matplotlib
4,844,512
4
false
0
0
"What would you do?" I would port matplotlib to Python 3. :-) But no, a course in Python 3 is not wasted. The differences are mainly in the standard library, and in subtle internal differences. The major differences in the language itself is that the unicode type is called str in Python 3, and that print is a function...
2
7
0
I want to learn Python. I have a course to do in Python 3. However, I will need to use mainly the matplotlib and Numpy, and these libraries are not yet compatible with Python 3. Is it worth doing the course in Python 3 or will be a waste of time to learn Python 3 and then came back to Python 2.x? What would you do?
New to Python... Python 3 and Matplotlib
0.197375
0
0
6,841
4,844,811
2011-01-30T18:59:00.000
1
0
0
0
python
4,844,899
3
false
0
0
You don't need any library for this at all, really. What you do need is a list of geographic locations. If you don't have that there are geolocation services online you can use, that will do these things for you, accessible via http (and hence urllib). You might need a library to interpret the response, that could be X...
1
4
0
So, I have a list of a bunch of city and state/region combinations (where some cities do not have a paired state/region) and I'd like to use these to fill in country, continent, (and state/region where it's not supplied) information. Where multiple regions would fit, I'm willing to accept any of them, though the bigges...
How Can I Determine a Region, Country, and Continent Based on a City Using Python?
0.066568
0
1
11,246
4,848,907
2011-01-31T08:35:00.000
1
0
0
0
python,windows,django
4,848,949
4
false
1
0
The default behavior for cmd is to simply "open" the file, which in the case of .py for you is associated with a text editor (me too). Try python django-admin.py startproject. To make it fool proof, locate your python.exe and type in \path\to\python.exe \path\to\django-admin.py startproject myproject Actually, you said...
3
2
0
In my windows I'm able to install the django by running the python file setup.py install. But after that, I'm unable to start a project by saying django-admin.py startproject newsite. All it gives me is opening a textfile showing the django-admin.py! Show me a way out guys
Django does not install correctly on windows machine
0.049958
0
0
469
4,848,907
2011-01-31T08:35:00.000
0
0
0
0
python,windows,django
5,925,065
4
false
1
0
I solved this as follows: Added this to the end of my User Variable PATH: C:\Python27;C:\Python27\Scripts Added a new System Variable PYTHONPATH and set to: c:\Python27\Lib;c:\Python27\Scipts Be sure that you close all cmd windows and open a new cmd prompt window after you've set your new environment variables. Hope ...
3
2
0
In my windows I'm able to install the django by running the python file setup.py install. But after that, I'm unable to start a project by saying django-admin.py startproject newsite. All it gives me is opening a textfile showing the django-admin.py! Show me a way out guys
Django does not install correctly on windows machine
0
0
0
469
4,848,907
2011-01-31T08:35:00.000
0
0
0
0
python,windows,django
16,140,424
4
false
1
0
Well well ..I was just having the same problem..and the problem was not related to any path variables. The Problem was because of the default python viewer wingIDE. I had changed the default opening of python file from IDLE to wing IDE, this was the problem. To solve this .. click any python file and open its proper...
3
2
0
In my windows I'm able to install the django by running the python file setup.py install. But after that, I'm unable to start a project by saying django-admin.py startproject newsite. All it gives me is opening a textfile showing the django-admin.py! Show me a way out guys
Django does not install correctly on windows machine
0
0
0
469
4,851,536
2011-01-31T13:43:00.000
2
0
0
0
python,google-app-engine,openid,tipfy
4,852,004
2
false
1
0
That code is just an example. You just need to allow the user to specify their OpenID provider's endpoint URL via a form, and get the value from the POST. It's just a string.
1
9
0
I am developing the authentication part of my app and I've run into issues with coding authentication using OpenID. I've looked at the Tipfy example code, but it seems written under the assumption that the OpenID provider is hard-coded to google. I would like the user to be able to provide any OpenID they desire (isn't...
Authentication using any OpenID with Tipfy
0.197375
0
0
790
4,853,635
2011-01-31T16:53:00.000
0
0
1
0
debugging,ironpython,traceback
8,096,588
1
true
0
0
Just for the record: Our current solution is now to parse the source files on our own, if a file is available. For the stackframes not backed by a file (e. G. eval), we simply cannot trace them.
1
0
0
I'm currently experimenting with lightweight debugging via Python.SetTrace(). But I cannot find a generic way from the callback parameters (TraceBackFrame stackFrame, string stEvent, object payload) to the ScriptSource containing the code. I can map for the ScriptSource on which I initially called Execute(), by matchin...
How to get from the TraceBackFrame to the ScriptSource
1.2
0
0
266
4,854,486
2011-01-31T18:18:00.000
2
0
0
0
user-interface,redirect,event-handling,wxpython,stdin
4,854,744
1
true
0
1
When you type, the input comes from the GUI event mechanism, not from stdin. You asked how to get the "keyboard stdin", and the answer to that is the same as for any other type of program: you read it (but it will almost certainly be empty). It's important to realize that the GUI probably doesn't have a stdin if it was...
1
0
0
I am quite confused about the stdin and the key_events of GUI widget. Usually in my mind, I thought stdin is the ordinary way to get the keyboard input for a process. E.g., If I have a process, then I could use stdin to have the keyboard inputs. And this is usually used to make I/O direction for the subprocess to get k...
key_events of GUI widget and stdin
1.2
0
0
405
4,855,523
2011-01-31T20:07:00.000
1
0
1
0
python,csv
4,855,557
4
false
0
0
Use the stringio module, which allows you to dress strings as file-like objects. That way you can pass a stringio "file" to the CSV module for parsing (or any other parser you may be using).
1
7
1
Is there a way to parse CSV data in Python when the data is not in a file? I'm storing CSV data in my database and I'd like to parse it. I'm looking for something analogous to Ruby's CSV.parse. I know Python has a CSV class but everything I've seen in the docs seems to deal with files as opposed to in-memory CSV data. ...
Parsing CSV data from memory in Python
0.049958
0
0
6,225
4,855,903
2011-01-31T20:46:00.000
7
1
1
0
python,multithreading,gil
4,855,924
1
true
0
0
If your code executes then you have the GIL, no need to acquire it manually.
1
3
0
Is it possible to acquire the global interpreter lock from python code? Or is that purely implemented in the C side?
Acquiring the global interpreter lock from python
1.2
0
0
914
4,859,291
2011-02-01T05:37:00.000
0
0
0
1
python,windows-xp,batch-file,hyperlink,symlink
4,859,343
3
false
0
0
When doing something similar for myself, I just created a few more batch files. For example, you could provide a py_go.bat to invoke python theLongestPythonScriptNameInTheWorld.py
1
1
0
I have a .bat that sets up an environment which allows users to execute several python scripts for specific jobs. My goal is to create links to the scripts. For example, the user runs the .bat, a cmd window pops up, and instead of typing python theLongestPythonScriptNameInTheWorld.py he types python go. My target platf...
bat script linking to python script
0
0
0
610
4,859,734
2011-02-01T06:46:00.000
0
0
0
1
python,google-app-engine
4,862,285
2
false
1
0
In loops, you can store the time the loop started and check how long it's been going on each iteration. If you're not in a loop, things are a bit trickier. You could add the time-checking bit every few lines of code. This, of course, makes for really ugly code, but without the ability to spawn threads that could run a...
1
4
0
Since the signal module is not supported in the python version of Google App Engine, what is the simplest way to call a method and throw/catch an exception if the method does not return in less than 2 seconds?
How can you limit the allowed execution time of specific methods in the python version of Google App Engine?
0
0
0
257
4,862,346
2011-02-01T12:08:00.000
1
1
0
1
python,shell,latex
4,862,410
7
false
0
0
Not much of a python man myself. But in a pinch, assuming you're on linux, you could periodically shell out and "ls -lrt /path/to/directory" (get the directory contents and sort by last modified), and compare the results of the last two calls for a difference. If so, then there was a change. Not very detailed, but gets...
1
6
0
I have a program that create files in a specific directory. When those files are ready, I run Latex to produce a .pdf file. So, my question is, how can I use this directory change as a trigger to call Latex, using a shell script or a python script? Best Regards
Check if the directory content has changed with shell script or python
0.028564
0
0
4,757
4,862,598
2011-02-01T12:31:00.000
1
1
0
0
python,linux,openssl
4,927,502
3
true
0
0
This answer doesn't EXACTLY answer my question, but I did find out what I needed to know so I will post it here. I had to change the location of the SSL files it was looking for to just /usr rather than /usr/local. RedHat by default has all the shared libraries in /usr/lib rather than /usr/local/lib, which is where it ...
1
1
0
I am trying to build Python from source and need to include the SSL module for my web scraper to work with it. I ran into the problem of SSL not being found, so I downloaded and built OpenSSL from source. The problem is, I need to install the development libraries along with OpenSSL in order for Python to run the -lssl...
Building OpenSSL to compile portable version of Python
1.2
0
0
2,122
4,863,281
2011-02-01T13:42:00.000
0
0
1
0
python
4,863,318
4
false
0
0
say its name is "theobject": dir( theobject )
1
5
0
If I'm dealing with an object in the Python console, is there a way to see what methods are available for that class?
See class methods in Python console
0
0
0
5,861
4,863,727
2011-02-01T14:27:00.000
-1
1
0
1
python,bluetooth
4,863,792
3
false
0
0
You need a binding for the Bluetooth driver/OS service that handles the Bluetooth device. Most drivers are written in C, some in C++. If you can get the source code/API or if it's provided you might be able to access it from python. You might need to code some custom binding to your OS service to do so.
2
0
0
In Python, am using the LightBlue module for Bluetooth connectivity. How do I get the speed at which I am sending file to my phone from my laptop (Ubuntu)?
Python bluetooth transfer speed?
-0.066568
0
0
1,146
4,863,727
2011-02-01T14:27:00.000
0
1
0
1
python,bluetooth
4,870,002
3
false
0
0
The simplest solution is to figure out how large the file is, capture the system time before the transfer and after the transfer, and then do the math. To compute a more fine-grained transfer rate that changes over the course of the transfer, you would need to use the size of your transmit buffers and the time interval...
2
0
0
In Python, am using the LightBlue module for Bluetooth connectivity. How do I get the speed at which I am sending file to my phone from my laptop (Ubuntu)?
Python bluetooth transfer speed?
0
0
0
1,146
4,865,636
2011-02-01T17:08:00.000
16
0
0
0
python,3d,pygame
4,865,764
14
false
0
1
Well, if you can do 2d you can always do 3d. All 3d really is is skewed 2 dimensional surfaces giving the impression you're looking at something with depth. The real question is can it do it well, and would you even want to. After browsing the pyGame documentation for a while, it looks like it's just an SDL wrapper....
5
34
0
I can't seem to find the answer to this question anywhere. I realize that you have to use PyOpenGL or something similar to do OpenGL stuff, but I was wondering if its possible to do very basic 3D graphics without any other dependencies.
Does PyGame do 3d?
1
0
0
40,558
4,865,636
2011-02-01T17:08:00.000
0
0
0
0
python,3d,pygame
66,323,924
14
false
0
1
If you want to stick with a python-esque language when making games, Godot is a good alternative with both 2D and 3D support, a large community, and lots of tutorials. Its custom scripting language(gdscript) has some minor differences, but overall its mostly the same. It also has support for c# and c++, and has much mo...
5
34
0
I can't seem to find the answer to this question anywhere. I realize that you have to use PyOpenGL or something similar to do OpenGL stuff, but I was wondering if its possible to do very basic 3D graphics without any other dependencies.
Does PyGame do 3d?
0
0
0
40,558
4,865,636
2011-02-01T17:08:00.000
0
0
0
0
python,3d,pygame
51,124,080
14
false
0
1
Pygame is just a library for changing the color of pixels (and some other useful stuff for programming games). You can do this by blitting images to the screen or directly setting the colors of pixels. Because of this, it is easy to write 2D games with pygame, as the above is all you really need. But a 3D game is just ...
5
34
0
I can't seem to find the answer to this question anywhere. I realize that you have to use PyOpenGL or something similar to do OpenGL stuff, but I was wondering if its possible to do very basic 3D graphics without any other dependencies.
Does PyGame do 3d?
0
0
0
40,558
4,865,636
2011-02-01T17:08:00.000
3
0
0
0
python,3d,pygame
8,702,727
14
false
0
1
Python Soya can render 3d graphics on pygame surfaces.
5
34
0
I can't seem to find the answer to this question anywhere. I realize that you have to use PyOpenGL or something similar to do OpenGL stuff, but I was wondering if its possible to do very basic 3D graphics without any other dependencies.
Does PyGame do 3d?
0.042831
0
0
40,558
4,865,636
2011-02-01T17:08:00.000
1
0
0
0
python,3d,pygame
50,873,427
14
false
0
1
It is easy to make 3D driver for PyGame. PyGame has some assets for 3D game development. I am developing Py3D driver using PyGame now. When I finish, I'll show you link to download Py3D. I tried to make 3D game with PyGame, and I needed just small addon for PyGame. It is wrong you think you must use SDL, PyOpenGL, Open...
5
34
0
I can't seem to find the answer to this question anywhere. I realize that you have to use PyOpenGL or something similar to do OpenGL stuff, but I was wondering if its possible to do very basic 3D graphics without any other dependencies.
Does PyGame do 3d?
0.014285
0
0
40,558
4,866,750
2011-02-01T18:56:00.000
4
0
0
0
python,django,django-admin,django-urls,django-settings
4,868,840
4
false
1
0
If you use gunicorn without code preloading, just send a HUP to the gunicorn master process, it will spawn new workers which load the new code, and gracefully shut down the old ones, without a single lost request!
1
12
0
Is there a way to programmatically add URL Patterns to Django without having to restart the server? Or is there a way force Django to reprocess/cache URL patterns ( the URLconf )?
Programmatically add URL Patterns in Django?
0.197375
0
0
4,070
4,869,315
2011-02-01T23:46:00.000
3
0
0
1
python,bash,osx-snow-leopard,twisted,.bash-profile
4,869,690
4
true
0
0
You'll need to install Twisted into your Python 2.7 installation somehow. The "2.6" in that path should be a hint that you shouldn't be trying to tell Python 2.7 about it. Among other things: Extension modules are not compatible between python versions. You may get a segfault if you try to use them. Bytecode forma...
3
1
0
I have a new MacBook Pro running OS X 10.6.6 / Snow Leopard -- which ships with Python 2.6, although I have installed 2.7.1 Unfortunately, this doesn't seem to see the Twisted install in the 2.6/Extras/lib/python/twisted directory, as I find I'm unable to import modules that I can see are present in that directory. "wh...
Python 2.7.1 can't see Twisted
1.2
0
0
2,965
4,869,315
2011-02-01T23:46:00.000
2
0
0
1
python,bash,osx-snow-leopard,twisted,.bash-profile
4,869,359
4
false
0
0
Create an environment using virtualenv. Install Twisted in your newly created environment using pip.
3
1
0
I have a new MacBook Pro running OS X 10.6.6 / Snow Leopard -- which ships with Python 2.6, although I have installed 2.7.1 Unfortunately, this doesn't seem to see the Twisted install in the 2.6/Extras/lib/python/twisted directory, as I find I'm unable to import modules that I can see are present in that directory. "wh...
Python 2.7.1 can't see Twisted
0.099668
0
0
2,965
4,869,315
2011-02-01T23:46:00.000
3
0
0
1
python,bash,osx-snow-leopard,twisted,.bash-profile
4,869,332
4
false
0
0
You'll have to install twisted using python 2.7. Also, python doesn't look up what's in the PATH variable for imports, it looks in PYTHONPATH. But just putting your python 2.6 folder in your pythonpath isn't a very good solution.
3
1
0
I have a new MacBook Pro running OS X 10.6.6 / Snow Leopard -- which ships with Python 2.6, although I have installed 2.7.1 Unfortunately, this doesn't seem to see the Twisted install in the 2.6/Extras/lib/python/twisted directory, as I find I'm unable to import modules that I can see are present in that directory. "wh...
Python 2.7.1 can't see Twisted
0.148885
0
0
2,965
4,869,476
2011-02-02T00:14:00.000
6
1
1
0
python,exception,exception-handling,try-catch,ioerror
18,236,796
4
false
0
0
there's 1 more possible if you're privileged to have an older installation and you're using the 'as' syntax:      except IOError as ioe: and the parser's getting tripped up on 'as'. Using as is the preferred syntax in Python 2.6 and better. It's a syntax error in Python 2.5 and older. For pre-2.6, use this:      exce...
2
13
0
I wrote a method that does some stuff and catches bad filenames. what should happen is if the path doesn't exist, it throws an IOError. however, it thinks my exception handling is bad syntax... why?? def whatever(): try: # do stuff # and more stuff except IOError: # do this pass...
catching an IOError in python
1
0
0
36,567
4,869,476
2011-02-02T00:14:00.000
2
1
1
0
python,exception,exception-handling,try-catch,ioerror
4,869,511
4
false
0
0
Just missing something in your try block, i.e. pass or anything, otherwise it gives an indentation error.
2
13
0
I wrote a method that does some stuff and catches bad filenames. what should happen is if the path doesn't exist, it throws an IOError. however, it thinks my exception handling is bad syntax... why?? def whatever(): try: # do stuff # and more stuff except IOError: # do this pass...
catching an IOError in python
0.099668
0
0
36,567
4,870,102
2011-02-02T02:03:00.000
1
0
0
1
google-app-engine,memcached,app-engine-patch,python-memcached
4,870,311
1
true
1
0
It looks like you're attempting to make a memcache call at import time. Judging from the stacktrace, Django imports your modules before it sets up the App Engine environment, and therefore any calls to App Engine services at the module level will fail on the development server. Move the call to memcache inside a functi...
1
1
0
I'm trying to store a date into memcache using the following code: from datetime import date from google.appengine.api.memcache import Client MEMCACHE_DATE_KEY = 'date' client = Client() def last_date(): return client.get(MEMCACHE_DATE_KEY) def new_date(): client.set(MEMCACHE_DATE_KEY, date.today()) I am ...
Memcache not present in App-Engine-Patch?
1.2
0
0
1,200
4,870,187
2011-02-02T02:23:00.000
0
0
0
0
python,hudson,hudson-api
32,389,162
4
false
1
0
Here is the curl command that worked fine from shell. Replace the text in between and including {}. curl -X POST -u {user:password} -H 'Content-Type: application/x-www-form-urlencoded' --data-urlencode description={descriptionstring} {hudsonurl}/job/{jobname}/{buildnumber}/submitDescription
1
5
0
I have a Python script that operates on Hudson builds and would love to be able to set the description of a build programmatically. I can click "Add Description" on a build's page and fill in the form, how can I POST some data to the same URL that form does?
Set Hudson Build Description via Web API
0
0
0
2,645
4,872,722
2011-02-02T09:33:00.000
0
1
0
1
python,appliance
4,872,968
2
false
1
0
It depends on what langauge/tecnology application is written. If it is java, release war file + tomcat/jboss. If it is python, release eggs. If it is php... not sure, probably just .tar.bz2. Linux distro or virtual image mught be advantage, but I dislike using them, because they are usually does not fits to my infra (w...
1
3
0
We have developed a web application running on Linux that is quite popular. We now wish to release it as an appliance so customers can run it internally on their own networks. We are unsure of the best approach. We are flexible on areas such as: the Linux distro, whether it's a hardware or software only appliance. Doe...
Considerations for moving our web app to an appliance
0
0
0
124
4,873,229
2011-02-02T10:22:00.000
2
0
1
0
python,multiprocessing,sockets
4,873,600
1
false
0
0
The processes need to send a message to specific processes. The receiving processes address (pid) can be stored in a database, but the processes cannot share any common variables in memory. Database? Why? Everyone uses a file for this, since a file is cheap, available, and you're only storing one integer value. Also...
1
2
0
I have many processes that are spawned separately, not from parent to child. The processes need to send a message to specific processes. The receiving processes address (pid) can be stored in a database, but the processes cannot share any common variables in memory. I could not find any way to accomplish this with pyth...
Python multiprocessing with unrelated processes
0.379949
0
0
484
4,876,649
2011-02-02T15:54:00.000
2
0
0
0
python,qt,qt4,pyqt4,qtwebkit
4,885,477
1
false
0
1
I've managed to fix the issue: creating the QWebPage in the GUI thread (the thread of QApplication event loop) fixes the issue. It seems the second time a QWebPage is used, it tries to access to the browser cache (even if it has been disabled by configuration). But if the first QWebPage was not created in the main GUI ...
1
2
0
I'm trying to create a little web server that loads, using webkit, an URL to extract some data from the web page (eg: title, images sizes...). I'm using PyQt4 to access from python to webkit. For each request, I'm creating a QThread that: - creates an QWebPage object, - run an event loop - when the loading of the webpa...
Unable to use in the same application a QWebPage twice
0.379949
0
0
628
4,876,799
2011-02-02T16:08:00.000
0
0
0
0
python,web-scraping,scrapy
4,889,635
2
false
1
0
Why don't you want to add all the links to 50 pages? Are the URLs of the pages consecutive like www.site.com/page=1, www.site.com/page=2 or are they all distinct? Can you show me the code that you have now?
2
1
0
I have recently started to work with Scrapy. I am trying to gather some info from a large list which is divided into several pages(about 50). I can easily extract what I want from the first page including the first page in the start_urls list. However I don't want to add all the links to these 50 pages to this list. I ...
Recursive use of Scrapy to scrape webpages from a website
0
0
1
1,171
4,876,799
2011-02-02T16:08:00.000
1
0
0
0
python,web-scraping,scrapy
4,940,212
2
false
1
0
use urllib2 to download a page. Then use either re (regular expressions) or BeautifulSoup (an HTML parser) to find the link to the next page you need. Download that with urllib2. Rinse and repeat. Scapy is great, but you dont need it to do what you're trying to do
2
1
0
I have recently started to work with Scrapy. I am trying to gather some info from a large list which is divided into several pages(about 50). I can easily extract what I want from the first page including the first page in the start_urls list. However I don't want to add all the links to these 50 pages to this list. I ...
Recursive use of Scrapy to scrape webpages from a website
0.099668
0
1
1,171
4,877,139
2011-02-02T16:40:00.000
1
0
1
0
python,unicode,normalization,unicode-normalization
4,880,852
3
false
0
0
You could do what you want to do very quickly using str.translate. However it is not readily apparent why you would want to do that. What I would call normalising in a language written in a Latin-based alphabet would include lowercasing, normalising whitespace, and stripping accents etc so that the result was ASCII. Th...
1
1
0
From hiragana and katakana charts, it looks like it should be possible to "normalize" japanese text into hiragana or katakana. It's pretty straight-forward to build a table and implement a dictionary/regex table for search/replace. Does anyone know where the work's already been done?
How can I convert all Japanese hiragana to katakana characters in Python?
0.066568
0
0
5,155
4,877,457
2011-02-02T17:08:00.000
0
0
1
0
python,django,init,monkeypatching
4,877,513
2
false
1
0
You can just edit the __init__.py file. There's nothing stopping you and if you do it right nothing bad will happen.
2
5
0
I know, I know, it's dirty and all. I want to know if it's possible to hijack the __init__ module of a Python module to replace it by your own. I'm asking that because I need to prevent a django lib to start some part of it's init process that make it crashes with our configuration. And yes, it's better to fix the djan...
How to monkey patch __init__ module in Python?
0
0
0
2,709
4,877,457
2011-02-02T17:08:00.000
4
0
1
0
python,django,init,monkeypatching
4,877,628
2
false
1
0
One way to hijack the import procedure is to simulate the import sometime before it takes place, in another module that is imported before the one you want to monkey-patch. Insert whatever you want into sys.modules with the name of the module as the key, and when the time comes to import the original module, Python wil...
2
5
0
I know, I know, it's dirty and all. I want to know if it's possible to hijack the __init__ module of a Python module to replace it by your own. I'm asking that because I need to prevent a django lib to start some part of it's init process that make it crashes with our configuration. And yes, it's better to fix the djan...
How to monkey patch __init__ module in Python?
0.379949
0
0
2,709
4,877,959
2011-02-02T17:53:00.000
2
0
1
0
python,linux,pyqt4
4,878,854
1
false
0
1
PyQt4 and Qt are cross-platform. If you write cross-platform code, you don't need to develop on any specific OS. Testing on different platforms from time to time is a good idea, but good cross-platform code will usually just work. Don't use any Windows-specific features, Windows-specific code. In particular, don't use ...
1
1
0
I am trying to use PyQt4. I have downloaded its LINUX version and trying to install it with Cygwin(because I have windows on my PC and I want to use linux, therefore I am using Cygwin). I don't know how to install it ? please guide me . There is no such file like setup.py, install....what should I do??
pyqt4 on Linux environment
0.379949
0
0
526
4,878,093
2011-02-02T18:05:00.000
0
0
1
0
python
4,878,220
3
false
0
1
As opposed to having the program running continuously, why don't you use your system's scheduler? (Cron under *nix, Task Scheduler under windows). There might be a bit more overhead since it has to spin up Python each time, but it would be easier than hooking up a notification icon. Since you refer to it as the task ba...
2
2
0
I would like to know if it is possible to minimise my python program to the system tray. Basically what it does is at every hour it takes a screenshot but I don't want it to stay on the task bar taking space. Could I make it go to the system tray area next to the clock but keep it running? I am not using tkinter or any...
Minimize python to system tray in Windows (Vista)
0
0
0
2,796
4,878,093
2011-02-02T18:05:00.000
2
0
1
0
python
4,878,236
3
true
0
1
Since you are running on Windows, you may simply want to rename your script to have a .pyw extension, so there is no console window. If you try to make a system tray application, you will need to pick a GUI toolkit like you've suggested, and your simple script will become a LOT bigger and far more complicated.
2
2
0
I would like to know if it is possible to minimise my python program to the system tray. Basically what it does is at every hour it takes a screenshot but I don't want it to stay on the task bar taking space. Could I make it go to the system tray area next to the clock but keep it running? I am not using tkinter or any...
Minimize python to system tray in Windows (Vista)
1.2
0
0
2,796
4,878,661
2011-02-02T19:03:00.000
10
0
1
0
python,django,pythonpath,pycharm
5,418,074
2
false
1
0
In pycharm open the settings "cmd" + "," and then to "Project Structure" click on "Sources" to include any modules.
2
5
0
I have purchased PyCharm and am trying to get things to work however I am encountering this issue.. Once I start a project everything works great... Now if I want a standalone app.. let's say at /users/me/djangoApps I understand I have to add this directory to the python path.. I am trying to do so by creating a file ...
Django (w PyCharm) & PYTHON PATH issue
1
0
0
5,796
4,878,661
2011-02-02T19:03:00.000
2
0
1
0
python,django,pythonpath,pycharm
4,878,982
2
false
1
0
Don't add that file to your python site-packages, then your django project is gonna be included for all future projects down the road. If you wanna debug, within PyCharm, click the Run tab up top and choose Edit configurations. Choose the project you are working with and make sure you add the directory where your manag...
2
5
0
I have purchased PyCharm and am trying to get things to work however I am encountering this issue.. Once I start a project everything works great... Now if I want a standalone app.. let's say at /users/me/djangoApps I understand I have to add this directory to the python path.. I am trying to do so by creating a file ...
Django (w PyCharm) & PYTHON PATH issue
0.197375
0
0
5,796
4,879,036
2011-02-02T19:41:00.000
70
0
0
0
python,django,namespaces,project-organization
4,879,235
6
false
1
0
Try to answer question: "What does my application do?". If you cannot answer in a single sentence, then maybe you can split it into several apps with cleaner logic. I read this thought somewhere soon after I've started to work with django and I find that I ask this question of myself quite often and it helps m...
2
215
0
I have a fairly complex "product" I'm getting ready to build using Django. I'm going to avoid using the terms "project" and "application" in this context, because I'm not clear on their specific meaning in Django. Projects can have many apps. Apps can be shared among many projects. Fine. I'm not reinventing the blog or...
Django: "projects" vs "apps"
1
0
0
51,295
4,879,036
2011-02-02T19:41:00.000
8
0
0
0
python,django,namespaces,project-organization
4,880,013
6
false
1
0
If so... in terms of Django's project.app namespace, my inclination is to usemyproduct.myproduct, but of course this isn't allowed There is nothing like not allowed. Its your project, no one is restricting you. It is advisable to keep a reasonable name. I don't see any portion of my product being reusable in any co...
2
215
0
I have a fairly complex "product" I'm getting ready to build using Django. I'm going to avoid using the terms "project" and "application" in this context, because I'm not clear on their specific meaning in Django. Projects can have many apps. Apps can be shared among many projects. Fine. I'm not reinventing the blog or...
Django: "projects" vs "apps"
1
0
0
51,295
4,879,804
2011-02-02T21:00:00.000
0
0
0
0
python,psycopg2,offline-mode
4,880,978
2
false
0
0
It seems like it would be easier and more versatile to store the data to be inserted later in another structure. Perhaps a csv file. Then when you connect you can run through that table, but you can also easily do other things with that CSV if necessary.
1
12
0
I have several occasions where I want to collect data when in the field. This is in situations where I do not always have access to my postgres database. To keep things in sync, it would be excellent if I could use psycopg2 functions offline to generate queries that can be held back and once I am able to connect to the...
Use psycopg2 to construct queries without connection
0
1
0
3,099
4,880,750
2011-02-02T22:38:00.000
1
0
1
0
python,file,compare
4,882,246
3
false
0
0
I would use os.walk to go through the file tree. For each file, I would store the absolutepath+filename, indexed by file size and signature (first 16 bytes? Hash of first 512 bytes? Hash on full file?). When finished, you end up with a dict of file sizes; for each size, a dict of file signatures; for each signature, a ...
2
0
0
I'm trying to write a program to compare files and show the duplicates in python. Anyone know any good functions or methods related to this? I am sorta lost...
Python method or class to compare two video files?
0.066568
0
0
3,560
4,880,750
2011-02-02T22:38:00.000
0
0
1
0
python,file,compare
4,880,810
3
false
0
0
I would first start out comparing filenames and filesizes. If you find a match, you could then loop through the bytes of the file to compare them, although this is probably pretty intensive. I do not know of a library that can do this in python.
2
0
0
I'm trying to write a program to compare files and show the duplicates in python. Anyone know any good functions or methods related to this? I am sorta lost...
Python method or class to compare two video files?
0
0
0
3,560
4,880,818
2011-02-02T22:45:00.000
0
1
1
1
python,rpm,rhel5
4,935,001
3
false
0
0
If you are on RHEL then you could seriously consider using the yum APIs instead of rpm-python directly ... the API is much easier to use.
1
1
0
Trying to learn how to use the rpm-python module (i.e. "import rpm" on RHEL5). I can't find any tutorials that are complete or recent. Specifically regarding how to install and manage rpm's on a system. Anyone?
Where is the most authoritative/complete source of documentation on rpm-python module?
0
0
0
658
4,881,377
2011-02-02T23:59:00.000
0
1
1
0
c++,python,parsing,code-analysis
4,882,258
7
false
0
0
If you can bring yourself to run this analysis using a Windows-platform application, save yourself a lot of time and trouble, and spend $200 on Enterprise Architect by Sparx Systems (I have no affiliation with this company, just a satisfied customer). (Note: this should not be confused with Microsoft's own "Enterprise...
4
13
0
We want to parse our huge C++ source tree to gain enough info to feed to another tool to make diagrams of class and object relations, discern the overall organization of things etc. My best try so far is a Python script that scans all .cpp and .h files, runs regex searches to try to detect class declarations, method...
How to parse C++ source in Python?
0
0
0
6,163
4,881,377
2011-02-02T23:59:00.000
3
1
1
0
c++,python,parsing,code-analysis
4,881,763
7
false
0
0
Can you run a preprocessing step? Doxygen parses most C++ syntax and creates xml with all the relationships. Compilers also create debug databases (typically dwarf format from gcc and codeview format from MSC).
4
13
0
We want to parse our huge C++ source tree to gain enough info to feed to another tool to make diagrams of class and object relations, discern the overall organization of things etc. My best try so far is a Python script that scans all .cpp and .h files, runs regex searches to try to detect class declarations, method...
How to parse C++ source in Python?
0.085505
0
0
6,163
4,881,377
2011-02-02T23:59:00.000
1
1
1
0
c++,python,parsing,code-analysis
4,881,710
7
false
0
0
From what you say of our requirements, Tony's answer of GccXML will probably be the best option. If that doesn't work, you could try to generate an outline of your program with cscope or ctags, and then work your way to the info you want from it's output.
4
13
0
We want to parse our huge C++ source tree to gain enough info to feed to another tool to make diagrams of class and object relations, discern the overall organization of things etc. My best try so far is a Python script that scans all .cpp and .h files, runs regex searches to try to detect class declarations, method...
How to parse C++ source in Python?
0.028564
0
0
6,163
4,881,377
2011-02-02T23:59:00.000
6
1
1
0
c++,python,parsing,code-analysis
4,881,402
7
false
0
0
You could check out GccXML and OpenC++, as well as doxygen.
4
13
0
We want to parse our huge C++ source tree to gain enough info to feed to another tool to make diagrams of class and object relations, discern the overall organization of things etc. My best try so far is a Python script that scans all .cpp and .h files, runs regex searches to try to detect class declarations, method...
How to parse C++ source in Python?
1
0
0
6,163
4,882,377
2011-02-03T03:26:00.000
15
0
0
0
python,django
4,882,942
4
true
1
0
It might be an error in one of your south migrations. You don't see the problem on the real db because the migration has been executed (with the--fake option maybe) You can try to recreate the db from scracth and see if it works. You can also disable South for unit-tests by adding SOUTH_TESTS_MIGRATE = False in your se...
3
8
0
I'm new to the django world. Running some tutorial apps, and when running python manage.py test i'm getting a failure saying that the table already exists. I'm not sure what is going on. I am also running south, and I got no errors when migrating the schema. Any insight is greatly appreciated. TIA Joey
django - "manage.py test" fails "table already exists"
1.2
0
0
5,175
4,882,377
2011-02-03T03:26:00.000
0
0
0
0
python,django
7,374,886
4
false
1
0
and if you are testing with nose: DST_RUN_SOUTH_MIGRATIONS = False
3
8
0
I'm new to the django world. Running some tutorial apps, and when running python manage.py test i'm getting a failure saying that the table already exists. I'm not sure what is going on. I am also running south, and I got no errors when migrating the schema. Any insight is greatly appreciated. TIA Joey
django - "manage.py test" fails "table already exists"
0
0
0
5,175
4,882,377
2011-02-03T03:26:00.000
0
0
0
0
python,django
18,020,458
4
false
1
0
This happens also with Nose when --cover-package=userdata,incorrectname One of package's name is incorrect
3
8
0
I'm new to the django world. Running some tutorial apps, and when running python manage.py test i'm getting a failure saying that the table already exists. I'm not sure what is going on. I am also running south, and I got no errors when migrating the schema. Any insight is greatly appreciated. TIA Joey
django - "manage.py test" fails "table already exists"
0
0
0
5,175
4,882,605
2011-02-03T04:07:00.000
1
0
0
0
python,django,apache,subprocess,mod-wsgi
8,750,220
2
false
1
0
I ran into a couple of issues trying to use subprocess under this configuration. Since I am not sure what specifically you had trouble with I can share a couple of things that were not easy for me to solve but in hindsight seem pretty trivial. I was receiving permissions related errors when trying to execute an applic...
1
6
0
After setting up a django site and running on the dev server, I have finally gotten around to figuring out deploying it in a production environment using the recommended mod_wsgi/apache22. I am currently limited to deploying this on a Windows XP machine. My problem is that several django views I have written use the py...
Django + Apache + Windows WSGIDaemonProcess Alternative
0.099668
1
0
2,617
4,882,808
2011-02-03T05:27:00.000
15
0
1
1
python,windows,python-3.x
19,559,108
2
false
0
0
Right click on my computer>got to properties>advanced settings>environmental variables> choose path and add the installed python dirtory to that path as like below: C:\WINDOWS\system32;C:\WINDOWS;C:\Python27
1
13
0
I have python 3.1 installed, and I have added it to the system path too. Now I can open "cmd" and type python to start python, but whenever I try to open cmd in a specific directory by using (shift + right click -> open command prompt here), and type python, it says "command not found"! How can I fix this?
How can I add python to cmd in windows
1
0
0
46,626
4,883,101
2011-02-03T06:29:00.000
0
0
0
0
python,urllib2,urllib,python-2.6,wmv
4,888,107
3
false
0
0
From what I understand, urllib works at the HTTP level and should properly remove headers in subsequent chunks. I took a look at the data returned by read() and it's all bytes.
2
0
0
I have a wmv file at a particular url that I want to grab and save as a file using Python. My script uses urllib2 to authenticate and read the bytes and save them locally in chunks. However, once I open the file, no video player recognizes it. When I download the wmv manually from a browser, the file plays fine, but od...
Downloading wmv from a url in Python 2.6
0
0
1
316
4,883,101
2011-02-03T06:29:00.000
0
0
0
0
python,urllib2,urllib,python-2.6,wmv
4,900,216
3
false
0
0
I was writing my file with mode 'w' on a Windows machine. Writing binary data should be done with mode 'wb' or the EOLs will be incorrect.
2
0
0
I have a wmv file at a particular url that I want to grab and save as a file using Python. My script uses urllib2 to authenticate and read the bytes and save them locally in chunks. However, once I open the file, no video player recognizes it. When I download the wmv manually from a browser, the file plays fine, but od...
Downloading wmv from a url in Python 2.6
0
0
1
316
4,883,541
2011-02-03T07:41:00.000
1
0
0
1
python
4,883,551
2
false
0
0
you have to start the process as root. You can run "sudo yourscript.py" as your normal user account or log in as root or run "su -" to become root and then run your script. Your script cannot obtain root privileges after it starts running. That's just not how unix/linux systems work.
1
1
0
hi everybody i wanna take a dir from one directory and os doesn't allow me to do this work(for example /etc/openvpn in linux) and i know i should be root but i don't know how can i do this with python.
access denied in python
0.099668
0
0
757
4,885,296
2011-02-03T11:00:00.000
-1
0
0
0
python,geometry,wxpython
4,888,025
2
false
0
1
The GridBagSizer or FlexGridSizer are kind of like Tkinter's place. Of course, wx also supports absolute positions, although I do not recommend that.
2
1
0
Is there an equivalent to Tkinter's place geometry manager in wxPython? For those those that don't know, place allows the positioning of widgets based on x y or relative x y coordinates. I'm a fan of this geometry manager simply because it offers a lot of control over widget positioning.
Equivalent to Tkinter's place geometry manager in wxPython
-0.099668
0
0
231
4,885,296
2011-02-03T11:00:00.000
1
0
0
0
python,geometry,wxpython
4,888,233
2
true
0
1
I think the best answer is "no, there is no equivalent". You can use absolute positioning with the "pos" keyword argument in the constructor, but that doesn't come close to the power of place.
2
1
0
Is there an equivalent to Tkinter's place geometry manager in wxPython? For those those that don't know, place allows the positioning of widgets based on x y or relative x y coordinates. I'm a fan of this geometry manager simply because it offers a lot of control over widget positioning.
Equivalent to Tkinter's place geometry manager in wxPython
1.2
0
0
231
4,886,652
2011-02-03T13:17:00.000
2
0
0
0
python,gtk
4,886,782
1
false
0
1
Windows become unresponsive in gtk (and in windowing systems in general) when you call a function within the Event Loop, which is the thread in charge of keeping the window responsive (this thread repaints the window, handles mouse clicks, etc.). If the function you call returns immediately, you won't notice the unresp...
1
1
0
I have created a gtk window in init and then I process a new function and i append the values from new function to the gtk window till the second function completes, the window gets unresponsive and can become responsive when second function completes. can anyone tell me whet should i do for the same?
python gtk problem
0.379949
0
0
142
4,888,568
2011-02-03T16:11:00.000
4
1
0
1
python,error-handling,fabric
4,888,891
4
false
0
0
Apparently messing with the environment is the answer. fabric.api.settings can be used as a context manager (with with) to apply it to individual statements. The return value of run(), local() and sudo() calls isn't just the output of the shell command, but also has special properties (return_code and failed) that allo...
1
70
0
Normally Fabric quits as soon as a run() call returns a non-zero exit code. For some calls, however, this is expected. For example, PNGOut returns an error code of 2 when it is unable to compress a file. Currently I can only circumvent this limitation by either using shell logic (do_something_that_fails || true or do_s...
Can I catch error codes when using Fabric to run() calls in a remote shell?
0.197375
0
0
44,680
4,890,257
2011-02-03T18:39:00.000
1
0
0
0
python
4,890,390
1
false
0
1
In wxWindows you just call the .destroy() method on the dialog/window to delete it. You don't have to move the mouse over it. That would make wxWindows apps very annoying. I suspect your problem is more related to trying to do something outside the wx event framework. Most GUIs are event driven, so if you've got other ...
1
0
0
The idea is that I would have two or three different windows and I would like to open and close them automatically by calling a function (separate functions to open and close each window). The program itself would be running in the background but when a certain event happens it would call the window opening function. O...
Opening and closing windows by calling a function?
0.197375
0
0
149
4,890,407
2011-02-03T18:54:00.000
1
0
1
0
c#,.net,python,ironpython
4,892,791
2
false
0
1
If you are in a Windows environment for reasons beyond your control, there are a lot of advantages in using IronPython. Its just like Python, only .NET. Once you learn the idosyncratic elements of how to reference an assembly, how to instantiate objects, browse objects, etc. it is really nice. You don't need Visual ...
2
3
0
I'm about to undertake a .NET project: We need to create a create a program that utilize some existing C# code, and I'm hoping to use IronPython. (I'm an experienced Python programmer, but a bit of a .NET newbie). My question is: Is IronPython a good fit for using mostly C# code, or would it be better just to use C#? ...
Using C# code in IronPython
0.099668
0
0
801
4,890,407
2011-02-03T18:54:00.000
5
0
1
0
c#,.net,python,ironpython
4,890,442
2
true
0
1
You'll need to compile the C# code into an assembly (DLL) you can use within IronPython. Once you do this, IronPython can use this just like any other .NET assembly. This is a common usage scenario for IronPython.
2
3
0
I'm about to undertake a .NET project: We need to create a create a program that utilize some existing C# code, and I'm hoping to use IronPython. (I'm an experienced Python programmer, but a bit of a .NET newbie). My question is: Is IronPython a good fit for using mostly C# code, or would it be better just to use C#? ...
Using C# code in IronPython
1.2
0
0
801
4,890,971
2011-02-03T19:53:00.000
2
0
0
0
python,django
4,891,078
2
true
1
0
My suggestion would be to use the Django signal system. Your app should send signals when certain actions occur and then listen to them when the next stage happens. If someone wants to change the behaviour of your app, all they would need to do would be to listen to the relevant signals that your app sends out and modi...
1
3
0
I would like to know of a good approach, or programming "pattern" to apply, to allow users of my Django application to drop in "plugins" or "extensions" for my app, without having to add anything to 'installed apps' or edit any configuration. WordPress plugins probably being the best example. New options/settings/menu...
Allow "third party" plugins for my Django app, that don't require config changes?
1.2
0
0
827
4,891,506
2011-02-03T20:43:00.000
6
0
0
0
python,django,django-admin
5,409,234
4
false
1
0
It's easy enough to get arbitrary data to show up in change list or make a field show up in the form: list_display arbitrarily takes either actual model properties, or methods defined on the model or the modeladmin, and you can subclass forms.ModelForm to add any field type you'd like to the change form. What's far mor...
1
15
0
I have a model, Foo. It has several database properties, and several properties that are calculated based on a combination of factors. I would like to present these calculated properties to the user as if they were database properties. (The backing factors would be changed to reflect user input.) Is there a way to do t...
Django: Faking a field in the admin interface?
1
0
0
11,911
4,891,699
2011-02-03T21:02:00.000
1
0
0
0
python,django,django-templates
4,891,762
4
false
1
0
A view function doesn't have any special status in Django. A template can be rendered anywhere: in a view, inside a templatetag, in a model method, in a utility function... so it's not even clear what you would want to access. But in any case, the general principle is that if you want access to something in a template,...
1
0
0
What it says on the tin: I want to be able to access either: the view function itself the view name (although this is less useful, I can probably use it to get back to the function) attributes of the view function This needs to be accessed from within a template tag. In short, what I'm trying to do is to mark up view...
How can I access the view function in a Django template tag?
0.049958
0
0
3,003
4,891,911
2011-02-03T21:25:00.000
0
1
0
0
python,perl,sockets,scala,client-server
4,891,991
3
false
0
0
To implement something like that you would need to go through a MQ System like perhaps ActiveMQ instead of using plain sockets.
2
0
0
In another question I asked for "the best" language for a certain purpose. Realizing this goal was a bit too much to start, I simplified my idea :) But there were really useful language hints. So I decided on Scala for the desktop-app and consider between Perl and Python on the webserver. I want to program something li...
Does this Scala Perl/Python architecture make sense
0
0
1
609
4,891,911
2011-02-03T21:25:00.000
1
1
0
0
python,perl,sockets,scala,client-server
4,892,391
3
false
0
0
Use Scala for the "chat.exe" (Or is just a "chat.jar" possible?) Step 1. Figure that out. Actually write some stuff and see what you can build. which communicates via SOCKET with a Perl/Python Framework which handles the requests. Not meaningful. All internet communication is done with sockets. Leave this sent...
2
0
0
In another question I asked for "the best" language for a certain purpose. Realizing this goal was a bit too much to start, I simplified my idea :) But there were really useful language hints. So I decided on Scala for the desktop-app and consider between Perl and Python on the webserver. I want to program something li...
Does this Scala Perl/Python architecture make sense
0.066568
0
1
609
4,892,049
2011-02-03T21:40:00.000
23
0
0
0
python,django
4,892,163
2
false
1
0
You can also try __repr__ and __str__ for your logging/debugging purposes. It is possible (at least it should be this way) that your logger/debugger uses repr( object ) to log your objects.
1
11
0
I would like my models to have two string representations: one that is displayed in the backend logs for debugging purposes, and a cleaner one that is displayed to end users when the model is represented in the HTML. Right now, I'm just overriding __unicode__(). Is there a way to do this?
Django: String representation of models
1
0
0
14,854
4,894,048
2011-02-04T02:42:00.000
11
0
1
0
c++,python,c
4,894,071
7
false
0
0
Look at py2exe and py2app for Windows and Mac. Macs running OSX and most modern Linuces have Python installed, however. C/C++ apps are normally compiled to executables which work on one machine/OS architecture (e.g. 32-bit Windows, or 64-bit OSX); such an executable can run on some but not all machines. For example, 6...
4
17
0
Can I create a Python program, send it to a remote computer, and run it there without that computer having Python installed? I've heard that you cannot, as Python needs to be interpreted. If this is true, then it seems very odd as it would be hard to distribute your program unless everyone decides to install Python. Al...
Can a python program be run on a computer without Python? What about C/C++?
1
0
0
39,851
4,894,048
2011-02-04T02:42:00.000
9
0
1
0
c++,python,c
4,894,089
7
false
0
0
python is interpreted, so it won't run without python. However, that doesn't mean that python has to be installed, you can include a copy in your program directory or even bundle your program and the python runtime into a single file. C and C++ compilers toolchains generate machine code (in most cases, C interpreters ...
4
17
0
Can I create a Python program, send it to a remote computer, and run it there without that computer having Python installed? I've heard that you cannot, as Python needs to be interpreted. If this is true, then it seems very odd as it would be hard to distribute your program unless everyone decides to install Python. Al...
Can a python program be run on a computer without Python? What about C/C++?
1
0
0
39,851
4,894,048
2011-02-04T02:42:00.000
0
0
1
0
c++,python,c
47,029,680
7
false
0
0
Look into Pyinstaller for standalone executables with no python integration needed. Well, apart from the crucial libraries so it can run! It's recently updated, well maintained and even supports cython integration though that can get complex. You can compress the files to be smaller or if you have multiple executables...
4
17
0
Can I create a Python program, send it to a remote computer, and run it there without that computer having Python installed? I've heard that you cannot, as Python needs to be interpreted. If this is true, then it seems very odd as it would be hard to distribute your program unless everyone decides to install Python. Al...
Can a python program be run on a computer without Python? What about C/C++?
0
0
0
39,851
4,894,048
2011-02-04T02:42:00.000
1
0
1
0
c++,python,c
4,894,082
7
false
0
0
There is a py2exe that can produce an executable that will run on another computer without that user installing the normal Python package. Yes, C and C++ are (at least normally) implemented as compilers that can produce standalone executables. Edit: In a typical case, a C or C++ implementation will link the functions f...
4
17
0
Can I create a Python program, send it to a remote computer, and run it there without that computer having Python installed? I've heard that you cannot, as Python needs to be interpreted. If this is true, then it seems very odd as it would be hard to distribute your program unless everyone decides to install Python. Al...
Can a python program be run on a computer without Python? What about C/C++?
0.028564
0
0
39,851
4,895,661
2011-02-04T07:45:00.000
0
0
1
0
python,nlp,grammar,nltk
4,895,933
2
false
0
0
May be you need simply define patterns like "noun verb noun" etc for each type of grammatical structure and search matches in part-of-speach tagger output sequence.
1
2
1
I want to parse a text and categorize the sentences according to their grammatical structure, but I have a very small understanding of NLP so I don't even know where to start. As far as I have read, I need to parse the text and find out (or tag?) the part-of-speech of every word. Then I search for the verb clause or wh...
How would I go about categorizing sentences according to tense (present, past, future, etc.)?
0
0
0
1,212
4,896,361
2011-02-04T09:22:00.000
0
1
1
0
c++,python,ruby-on-rails
4,896,404
3
false
1
0
Language should be a means to an end. Pick a project you want to work on, then figure out what you will need to know to get the job done. It's very difficult to get any language-learning to stick without some practical application. And "knowing a language" is not particularly difficult or useful. Knowing how to us...
2
2
0
I am a 3rd year CS engineering student, I have done some basic programming in languages like C,C++,Java,Shell,Perl,PHP,Ruby on Rails, Python. But now I wanted to settle for one language, so I thought of finally mastering one scripting language and other compiled one. So I decided to stick with C++ and Python. Can someo...
Which programming language to choose?
0
0
0
436
4,896,361
2011-02-04T09:22:00.000
0
1
1
0
c++,python,ruby-on-rails
4,896,389
3
false
1
0
Presently ROR is high in demand for web. As a professional i'll suggest to learn ROR.
2
2
0
I am a 3rd year CS engineering student, I have done some basic programming in languages like C,C++,Java,Shell,Perl,PHP,Ruby on Rails, Python. But now I wanted to settle for one language, so I thought of finally mastering one scripting language and other compiled one. So I decided to stick with C++ and Python. Can someo...
Which programming language to choose?
0
0
0
436
4,896,434
2011-02-04T09:30:00.000
0
0
0
0
python,c,multithreading,gtk,pygtk
4,911,145
2
false
0
1
This is a situation where you are better off making one more Python interpreter and doing all your GTK work by sending Python snippets to that special GTK helper interpreter. That way your C code never uses GTK directly and you only need to worry about coordinating between the Python threads.
2
2
0
I'm trying to develop a C-based application which embeds one or more Python interpreters. I'm using gtk-things in the C-parts, and logically calling gtk_main() within that. The Python interpreters are created in separate pthreads using Py_NewInterpreter(), and basically running forever (a 'while True' loop is added to ...
pygtk and native gtk_main(); mixing
0
0
0
285
4,896,434
2011-02-04T09:30:00.000
0
0
0
0
python,c,multithreading,gtk,pygtk
4,911,173
2
false
0
1
This looks like a pretty long stack, and some of the functions called look the same. (For example, g_signal_emit is called repeatedly from itself via g_closure_invoke.) It looks to me like you may be causing a stack overflow, possibly by emitting a signal inside your callback that handles the signal, thus infinitely r...
2
2
0
I'm trying to develop a C-based application which embeds one or more Python interpreters. I'm using gtk-things in the C-parts, and logically calling gtk_main() within that. The Python interpreters are created in separate pthreads using Py_NewInterpreter(), and basically running forever (a 'while True' loop is added to ...
pygtk and native gtk_main(); mixing
0
0
0
285
4,896,785
2011-02-04T10:12:00.000
1
1
0
1
python,automation,ssh,telnet
39,664,919
7
false
0
0
There are many libraries to do that. Subprocess Pexpect Paramiko (Mostly used) Fabric Exscript You can check their documentation for the implementation.
1
10
0
I already know there are ssh modules for Python, that's not for what I'm looking for. What I want to have is an python script to do the following: > connect to an [ input by user ] SSH host > connect using the credentials [ provided by the user ] > run command on the SSH host [ telnet to [host - input by user ] > Sele...
Python script - connect to SSH and run command
0.028564
0
1
74,237