Q_Id
int64
2.93k
49.7M
CreationDate
stringlengths
23
23
Users Score
int64
-10
437
Other
int64
0
1
Python Basics and Environment
int64
0
1
System Administration and DevOps
int64
0
1
DISCREPANCY
int64
0
1
Tags
stringlengths
6
90
ERRORS
int64
0
1
A_Id
int64
2.98k
72.5M
API_CHANGE
int64
0
1
AnswerCount
int64
1
42
REVIEW
int64
0
1
is_accepted
bool
2 classes
Web Development
int64
0
1
GUI and Desktop Applications
int64
0
1
Answer
stringlengths
15
5.1k
Available Count
int64
1
17
Q_Score
int64
0
3.67k
Data Science and Machine Learning
int64
0
1
DOCUMENTATION
int64
0
1
Question
stringlengths
25
6.53k
Title
stringlengths
11
148
CONCEPTUAL
int64
0
1
Score
float64
-1
1.2
API_USAGE
int64
1
1
Database and SQL
int64
0
1
Networking and APIs
int64
0
1
ViewCount
int64
15
3.72M
1,695,971
2009-11-08T10:29:00.000
2
0
0
0
0
python,text,nlp,words,wordnet
0
1,696,133
0
5
0
false
0
0
In order to get levels, you need to predefine the content of each level. An ontology often defines these as the immediate IS_A children of a specific concept, but if that is absent, you need to develop a method of that yourself. The next step is to put a priority on each concept, in case you want to present only one ca...
4
6
1
0
For example... Chicken is an animal. Burrito is a food. WordNet allows you to do "is-a"...the hiearchy feature. However, how do I know when to stop travelling up the tree? I want a LEVEL. That is consistent. For example, if presented with a bunch of words, I want wordNet to categorize all of them, but at a certain leve...
Does WordNet have "levels"? (NLP)
0
0.07983
1
0
0
2,585
1,695,971
2009-11-08T10:29:00.000
0
0
0
0
0
python,text,nlp,words,wordnet
0
1,717,952
0
5
0
false
0
0
WordNet's hypernym tree ends with a single root synset for the word "entity". If you are using WordNet's C library, then you can get a while recursive structure for a synset's ancestors using traceptrs_ds, and you can get the whole synset tree by recursively following nextss and ptrlst pointers until you hit null point...
4
6
1
0
For example... Chicken is an animal. Burrito is a food. WordNet allows you to do "is-a"...the hiearchy feature. However, how do I know when to stop travelling up the tree? I want a LEVEL. That is consistent. For example, if presented with a bunch of words, I want wordNet to categorize all of them, but at a certain leve...
Does WordNet have "levels"? (NLP)
0
0
1
0
0
2,585
1,695,971
2009-11-08T10:29:00.000
6
0
0
0
0
python,text,nlp,words,wordnet
0
1,698,380
0
5
0
false
0
0
[Please credit Pete Kirkham, he first came with the reference to SUMO which may well answer the question asked by Alex, the OP] (I'm just providing a complement of information here; I started in a comment field but soon ran out of space and layout capabilites...) Alex: Most of SUMO is science or engineering? It does no...
4
6
1
0
For example... Chicken is an animal. Burrito is a food. WordNet allows you to do "is-a"...the hiearchy feature. However, how do I know when to stop travelling up the tree? I want a LEVEL. That is consistent. For example, if presented with a bunch of words, I want wordNet to categorize all of them, but at a certain leve...
Does WordNet have "levels"? (NLP)
0
1
1
0
0
2,585
1,697,045
2009-11-08T16:24:00.000
1
0
0
0
0
python,sql,django,database-design,database
0
1,697,224
0
2
0
true
1
0
You might also simply store the last time a user was reading a particular forum. Any posts that have been updated since that date are new. You'll only be storing one additional piece of information per user as opposed to a piece of information per post per user.
2
2
0
0
I'm working on a not-so-big project in django that will among other things incorporate a forum system. I have most of the system at a more or less functioning state, but I'm still missing a feature to mark unread threads for the users when there are new posts. The thing is I can't really think of a way to properly stor...
Django/SQL: keeping track of who who read what in a forum
1
1.2
1
0
0
354
1,697,045
2009-11-08T16:24:00.000
2
0
0
0
0
python,sql,django,database-design,database
0
1,697,061
0
2
0
false
1
0
You're much better off storing the "read" bit, not the "unread" bit. And you can store them not as relational data, but in a giant bit-blob. Then you don't have to modify the read data at all when new posts are added, only when a user reads posts.
2
2
0
0
I'm working on a not-so-big project in django that will among other things incorporate a forum system. I have most of the system at a more or less functioning state, but I'm still missing a feature to mark unread threads for the users when there are new posts. The thing is I can't really think of a way to properly stor...
Django/SQL: keeping track of who who read what in a forum
1
0.197375
1
0
0
354
1,697,153
2009-11-08T17:01:00.000
2
0
0
0
1
c++,python,database,persistence
0
1,697,185
0
6
0
false
0
0
BerkeleyDB is good, also look at the *DBM incarnations (e.g. GDBM). The big question though is: for what do you need to search? Do you need to search by that URL, by a range of URLs or the dates you list? It is also quite possible to keep groups of records as simple files in the local filesystem, grouped by dates ...
3
5
0
0
I'm developing an application that will store a sizeable number of records. These records will be something like (URL, date, title, source, {optional data...}) As this is a client-side app, I don't want to use a database server, I just want the info stored into files. I want the files to be readable from various langua...
Which database should I use to store records, and how should I use it?
0
0.066568
1
1
0
666
1,697,153
2009-11-08T17:01:00.000
0
0
0
0
1
c++,python,database,persistence
0
1,698,109
0
6
0
false
0
0
Ok, so you say just storing the data..? You really only need a DB for retrieval, lookup, summarising, etc. So, for storing, just use simple text files and append lines. Compress the data if you need to, use delims between fields - just about any language will be able to read such files. If you do want to retrieve, then...
3
5
0
0
I'm developing an application that will store a sizeable number of records. These records will be something like (URL, date, title, source, {optional data...}) As this is a client-side app, I don't want to use a database server, I just want the info stored into files. I want the files to be readable from various langua...
Which database should I use to store records, and how should I use it?
0
0
1
1
0
666
1,697,153
2009-11-08T17:01:00.000
2
0
0
0
1
c++,python,database,persistence
0
1,697,239
0
6
0
false
0
0
Personally I would use sqlite anyway. It has always just worked for me (and for others I work with). When your app grows and you suddenly do want to do something a little more sophisticated, you won't have to rewrite. On the other hand, I've seen various comments on the Python dev list about Berkely DB that suggest i...
3
5
0
0
I'm developing an application that will store a sizeable number of records. These records will be something like (URL, date, title, source, {optional data...}) As this is a client-side app, I don't want to use a database server, I just want the info stored into files. I want the files to be readable from various langua...
Which database should I use to store records, and how should I use it?
0
0.066568
1
1
0
666
1,700,441
2009-11-09T11:24:00.000
3
0
0
1
0
python,google-app-engine
0
1,701,239
0
3
0
false
1
0
To answer the actual question from the title of your post, assuming you're still wondering: to get environment variables, simple import os and the environment is available in os.environ.
1
0
0
0
does someone have an idea how to get the environment variables on Google-AppEngine ? I'm trying to write a simple Script that shall use the Client-IP (for Authentication) and a parameter (geturl or so) from the URL (for e.g. http://thingy.appspot.dom/index?geturl=www.google.at) I red that i should be able to get the C...
Environment on google Appengine
0
0.197375
1
0
0
461
1,702,024
2009-11-09T16:11:00.000
1
0
0
0
0
python,performance,profiling,paster
0
1,710,186
0
3
0
true
0
0
I almost always use paster serve --reload ... during development. That command executes itself as a subprocess (it executes its own script using the subprocess module, not fork()). The subprocess polls for source code changes, quits when it detects a change, and gets restarted by the parent paster serve --reload. That'...
1
2
0
0
Python's paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I would like it to not fork a thread pool and quit as soon as it is ready to serve so the time after it's ready doesn't show ...
How do I profile `paster serve`'s startup time?
0
1.2
1
0
0
545
1,706,644
2009-11-10T09:29:00.000
1
0
0
0
1
python,authentication,urllib2,digest
0
1,717,241
0
1
1
false
0
0
Although it's not available out of the box, urllib2 is flexible enough to add it yourself. Subclass HTTPDigestAuthHandler, hack it (retry_http_digest_auth method I think) to remember authentication information and define an http_request(self, request) method to use it for all subsequent requests (add WWW-Authenticate h...
1
1
0
0
I am trying to use Python to write a client that connects to a custom http server that uses digest authentication. I can connect and pull the first request without problem. Using TCPDUMP (I am on MAC OS X--I am both a MAC and a Python noob) I can see the first request is actually two http requests, as you would expec...
Client Digest Authentication Python with URLLIB2 will not remember Authorization Header Information
1
0.197375
1
0
1
1,902
1,707,780
2009-11-10T12:57:00.000
3
0
0
0
0
python,matlab,language-interoperability
0
50,057,490
0
13
0
false
0
0
Like Daniel said you can run python commands directly from Matlab using the py. command. To run any of the libraries you just have to make sure Malab is running the python environment where you installed the libraries: On a Mac: Open a new terminal window; type: which python (to find out where the default version of ...
1
76
1
0
I need to call a Python function from MATLAB. how can I do this?
Call Python function from MATLAB
0
0.046121
1
0
0
132,733
1,713,398
2009-11-11T06:20:00.000
4
0
1
0
0
python,linux,unix
0
1,713,411
0
5
0
true
0
0
Then it fails. You can't import a python 2.5 library while you're running python 2.4. It won't work. Why can't you run python 2.5+?
1
0
0
0
Then how do I import that? I run everything in python 2.4, but one of my scripts import xml.etree.ElementTree...which is only Python 2.5
What if one of my programs runs in python 2.4, but IMPORTS something that requires python 2.5?
0
1.2
1
0
1
1,923
1,725,758
2009-11-12T22:07:00.000
0
0
1
0
0
python
0
1,725,784
0
3
0
false
0
0
Clearly, you must sleep according to real, elapsed time. The alternative (sleeping according to some other clock that "somehow" started and stopped) would be unmanageable. How would your application (which is sleeping) be notified of all this starting and stopping activity? Right, it would have to be woken up to be t...
1
2
0
0
For example, if I do time.sleep(100) and immediately hibernate my computer for 99 seconds, will the next statement be executed in 1 second or 100 seconds after waking up? If the answer is 1 second, how do you "sleep" 100 seconds, regardless of the length of hibernate/standby?
time.sleep and suspend (ie. standby and hibernate)
0
0
1
0
0
2,094
1,728,330
2009-11-13T10:13:00.000
0
0
0
1
0
python,linux,process,subprocess
0
1,728,361
0
7
0
false
0
0
I do not think you can do this portably in the general case. You need to get this information from the process list (e.g. through the ps command), which is obtained in a system-specific way.
1
7
0
0
How can i get process id of the current process's parent? In general given a process id how can I get its parent process id? e.g. os.getpid() can be used to get the proccess id, and os.getppid() for the parent, how do I get grandparent, My target is linux(ubuntu) so platform specific answers are ok.
How to get process's grandparent id
0
0
1
0
0
14,912
1,732,761
2009-11-14T00:30:00.000
2
1
1
0
0
python,png
0
1,732,962
0
2
0
true
0
1
Getting data out of a PNG requires unpacking data and decompressing it. These are likely going to be too slow in Python for your application. One possibility is to start with PyPNG and get rid of anything in it that you don't need. For example, it is probably storing all of the data it reads from the PNG, and some o...
1
1
0
0
I am having an issue with an embedded 64bit Python instance not liking PIL. Before i start exhausting more methods to get a compiled image editor to read the pixels for me (such as ImageMagick) i am hoping perhaps anyone here can think of a purely Python solution that will be comparable in speeds to the compiled counte...
Reading Alpha of a PNG Pixel. Fast way via pure Python?
0
1.2
1
0
0
955
1,733,364
2009-11-14T05:23:00.000
1
0
1
1
0
python,ubuntu,installation
0
1,733,409
0
4
0
false
0
0
Sounds like they're an accident from some package(s) you have installed. The Python version in use determines the locations searched to find installed Python packages/modules, and the "system version" of Python in Ubuntu 9.10 is 2.6, so that's what practically everything should be using. If you were to install the pyt...
1
3
0
0
In ubuntu 9.10, in usr/lib/ there are the directories python2.4, python2.5, python2.6 and python3.0 Only python 2.6 is actually working. python2.4 has only a lib-dynload directory, python2.5 has only lib-dynload and site-packages, python3.0 has only a dist-packages directory. Now i'm wondering what is the idea behin...
ubuntu9.10 : how to use python's lib-dynload and site-packages directories?
0
0.049958
1
0
0
10,075
1,739,543
2009-11-16T00:55:00.000
0
0
0
1
0
python,google-app-engine,compression,gzip,zlib
0
2,125,539
0
5
0
false
1
0
You can store up to 10Mb with a list of Blobs. Search for google file service. It's much more versatile than BlobStore in my opinion, since I just started using BlobStore Api yesterday and I'm still figuring out if it is possible to access the data bytewise.. as in changing doc to pdf, jpeg to gif.. You can storage Bl...
2
1
0
0
I im trying to store 30 second user mp3 recordings as Blobs in my app engine data store. However, in order to enable this feature (App Engine has a 1MB limit per upload) and to keep the costs down I would like to compress the file before upload and decompress the file every time it is requested. How would you suggest ...
Compress data before storage on Google App Engine
0
0
1
0
0
2,545
1,739,543
2009-11-16T00:55:00.000
2
0
0
1
0
python,google-app-engine,compression,gzip,zlib
0
1,739,598
0
5
0
true
1
0
"Compressing before upload" implies doing it in the user's browser -- but no text in your question addresses that! It seems to be about compression in your GAE app, where of course the data will only be after the upload. You could do it with a Firefox extension (or other browsers' equivalents), if you can develop tho...
2
1
0
0
I im trying to store 30 second user mp3 recordings as Blobs in my app engine data store. However, in order to enable this feature (App Engine has a 1MB limit per upload) and to keep the costs down I would like to compress the file before upload and decompress the file every time it is requested. How would you suggest ...
Compress data before storage on Google App Engine
0
1.2
1
0
0
2,545
1,741,023
2009-11-16T09:23:00.000
2
0
0
0
0
python,testing,powerbuilder
0
1,741,142
0
4
0
false
0
1
I'm experimenting with code for a tool for automating PowerBuilder-based GUIs as well. From what I can see, your best bet would be to use the PowerBuilder Native Interface (PBNI), and call PowerScript code from within your NVO. If you like, feel free to send me an email (see my profile for my email address), I'd be int...
2
6
0
0
I'm not familiar with PowerBuilder but I have a task to create Automatic UI Test Application for PB. We've decided to do it in Python with pywinauto and iaccesible libraries. The problem is that some UI elements like newly added lists record can not be accesed from it (even inspect32 can't get it). Any ideas how to re...
How to make PowerBuilder UI testing application?
0
0.099668
1
0
1
3,825
1,741,023
2009-11-16T09:23:00.000
1
0
0
0
0
python,testing,powerbuilder
0
2,328,021
0
4
0
false
0
1
I've seen in AutomatedQa support that they a recipe recommending using msaa and setting some properties on the controls. I do not know if it works.
2
6
0
0
I'm not familiar with PowerBuilder but I have a task to create Automatic UI Test Application for PB. We've decided to do it in Python with pywinauto and iaccesible libraries. The problem is that some UI elements like newly added lists record can not be accesed from it (even inspect32 can't get it). Any ideas how to re...
How to make PowerBuilder UI testing application?
0
0.049958
1
0
1
3,825
1,748,482
2009-11-17T12:19:00.000
0
0
0
0
0
python,blender
0
2,397,249
0
1
0
false
0
0
You must write the plug-in for blender and used the wintracker driver. It is ready for c Lagrange. but you have "wintracker2"? I wanted to buy it but the company said "it's not ready to seal".
1
0
0
0
I am trying to develop a project that uses a control model in Blender by using WinTracker machine, but I don't know how to connect it with Blender Game Engine. How can I connect it with Blender Game Engine?
Python: Connect blender with WinTracker 2
0
0
1
0
0
178
1,750,676
2009-11-17T18:01:00.000
18
0
0
0
0
python,django,cpu
0
1,756,874
0
4
0
true
1
0
FWIW, you should do the profiling, but when you do I'll bet you find that the answer is "polling for changes to your files so it can auto-reload." You might do a quick test with "python manage.py runserver --noreload" and see how that affects the CPU usage.
2
7
0
0
I'm noticing that my django development server (version 1.1.1) on my local windows7 machine is using a lot of CPU (~30%, according to task manager's python.exe entry), even in idle state, i.e. no request coming in/going out. Is there an established way of analysing what might be responsible for this? Thanks! Martin
Django development server CPU intensive - how to analyse?
0
1.2
1
0
0
3,645
1,750,676
2009-11-17T18:01:00.000
4
0
0
0
0
python,django,cpu
0
1,750,793
0
4
0
false
1
0
Hit Control-C and crash the process. It will probably crash somewhere that it's spending a lot of time. Or you could use a profiler.
2
7
0
0
I'm noticing that my django development server (version 1.1.1) on my local windows7 machine is using a lot of CPU (~30%, according to task manager's python.exe entry), even in idle state, i.e. no request coming in/going out. Is there an established way of analysing what might be responsible for this? Thanks! Martin
Django development server CPU intensive - how to analyse?
0
0.197375
1
0
0
3,645
1,772,133
2009-11-20T17:41:00.000
2
1
0
0
0
python,svn,ssh,pysvn
0
1,773,231
0
1
0
true
0
0
Check out ssh configuration option PasswordAuthentication. I'm not sure how pysvn interacts with ssh, but if you set this to no in your ~/.ssh/config (or maybe global config?) then it shouldn't prompt for a password.
1
5
0
0
I'm working with pysvn, and I'm trying to find a decent way to handle repositories that are only accessible via svn+ssh. Obviously SSH keys make this all incredibly easy, but I can't guarantee the end user will be using an SSH key. This also has to be able to run without user interaction, because it's going to be doing...
pysvn with svn+ssh
1
1.2
1
0
0
1,664
1,773,222
2009-11-20T21:02:00.000
3
1
1
0
0
python,tcl,tkinter,tk
0
1,773,435
0
1
0
false
0
1
The files you found are for linking directly to tcl/tk. Python depends on another library as well: _tkinter.so. It should be in /usr/lib/python2.5/lib-dynload/_tkinter.so. How did you install python2.5? If you are using Debian or Ubuntu you need to install the python-tk package to get Tkinter support. If the _tkinter.s...
1
0
0
0
I have an existing Python 2.4 and it is working properly with tkinter as I tested it using python import _tkinter import Tkinter Tkinter._test() Now, I have installed python 2.5.2 but when I try the same tests (with the newer version), it returns (but the same tests are working for the previous version) I...
Linking Tcl/Tk to Python 2.5
0
0.53705
1
0
0
1,073
1,776,290
2009-11-21T18:24:00.000
13
0
0
0
0
python,matlab
0
1,777,708
0
8
0
false
0
0
I've been programming with Matlab for about 15 years, and with Python for about 10. It usually breaks down this way: If you can satisfy the following conditions: 1. You primarily use matrices and matrix operations 2. You have the money for a Matlab license 3. You work on a platform that mathworks supports T...
1
18
1
0
i am a engineering student and i have to do a lot of numerical processing, plots, simulations etc. The tool that i use currently is Matlab. I use it in my university computers for most of my assignments. However, i want to know what are the free options available. i have done some research and many have said that pyth...
replacing Matlab with python
1
1
1
0
0
15,393
1,779,464
2009-11-22T18:10:00.000
7
0
0
0
1
python,django,http
0
1,779,475
0
2
0
true
1
0
Do you have any kind of proxy, gateway, or load balancer running on that remote host? That's the sort of thing that would cause connections to appear to be from 127.0.0.1 (because that's where the immediate connection is from, as far as the web server is concerned).
1
2
0
0
I have an application running with debug=True on a remote host somewhere. Now somehow every time I access REMOTE_ADDR it returns 127.0.0.1 no matter where the request is from. I'm not sure where to start and why this is happening.
Django: request.META['REMOTE_ADDR'] is always '127.0.0.1'
0
1.2
1
0
0
4,509
1,781,431
2009-11-23T06:28:00.000
2
1
0
0
0
python,html,web-applications,fastcgi,template-engine
0
1,784,843
0
3
0
false
1
0
You asked whether HTML is allowed within Python, which indicates that you still think too much in PHP terms about it. Contrary to PHP, Python was not designed to create dynamic web-pages. Instead, it was designed as a stand-alone, general-purpose programming language. Therefore you will not be able to put HTML into Pyt...
1
1
0
0
I'm just starting out with Python and have practiced so far in the IDLE interface. Now I'd like to configure Python with MAMP so I can start creating really basic webapps — using Python inside HTML, or well, vice-versa. (I'm assuming HTML is allowed in Python, just like PHP? If not, are there any modules/template engin...
Python for web scripting
1
0.132549
1
0
0
756
1,795,349
2009-11-25T07:59:00.000
1
0
0
0
0
python,reportlab
0
1,842,295
0
2
0
true
1
0
You shouldn't have much trouble doing this. Aside from some differences in element names, it's pretty straightforward: just ignore any HTML elements that can't be easily converted/you don't care about converting to RML and do the rest. I'm sure the ReportLab folks would be glad if you contributed even a basic HTML t...
1
2
0
0
Is there any Python library or some sample code which demonstrates how to convert basic HTML into RML (Reportlab Markup Language www.reportlab.org)? I can think of using a regular HTML parser and adding some home grown code to generate the RML, but I guess there will be a lot of cases to handle in such a conversion.
converting basic HTML to RML (Reportlab Markup Language)
0
1.2
1
0
0
2,613
1,803,741
2009-11-26T13:43:00.000
1
0
0
0
0
python,error-handling
1
1,803,796
0
2
0
false
0
0
In urllib2 HTTPError exception is also a valid HTTP response, so you can treat an HTTP error as an exceptional event or valid response. But in urllib you have to subclass URLopener and define http_error_<code> method[s] or redefine http_error_default to handle them all.
1
4
0
0
the normal behavior of urllib/urllib2 is if an error code is sent in the header of the response (i.e 404) an Exception is raised. How do you look for specific errors i.e (40x, or 50x) based on the different errors, do different things. Also, how do you read the actual data being returned HTML/JSON etc (The data usuall...
Error codes returned by urllib/urllib2 and the actual page
0
0.099668
1
0
1
5,703
1,811,236
2009-11-28T01:24:00.000
0
0
1
0
0
python,regex
0
1,811,244
0
5
0
false
0
0
Install Python on your Mac, then copy the script over? It should work fine on any Python installation.
1
4
0
0
In the Python installation on my PC there is a sweet script in C:\python26\tools\scripts called redemo.py. It's a simple tk application for testing regular expressions. I wish I could get it--or something like it--running on my Mac, but I don't know how. The script doesn't appear to be part of the Python installation o...
How can I run redemo.py (or equivalent) on a Mac?
0
0
1
0
0
898
1,811,940
2009-11-28T08:04:00.000
2
0
0
0
0
python,frameworks,desktop
0
1,813,171
0
4
0
true
0
1
Well the best way to start is to look at the source code of the framework the other answers are talking about. First, try to use them all to build the same application with the functionalities you expect from a framework. Them, look at how it works under the hood. Secondly, build your framework, starting by writing you...
1
2
0
0
I want to develop a desktop application framework in Python, much like QT, but how to go about it? Any tutorials or links related to it would be helpful!
I want to develop a framework in Python for desktop based applications. How should I go about it?
0
1.2
1
0
0
813
1,812,115
2009-11-28T09:46:00.000
4
0
1
1
0
python,windows,file
0
1,812,351
0
8
0
false
0
0
The standard solution is this. Write a new file with a similar name. X.ext# for example. When that file has been closed (and perhaps even read and checksummed), then you two two renames. X.ext (the original) to X.ext~ X.ext# (the new one) to X.ext (Only for the crazy paranoids) call the OS sync function to force d...
2
21
0
0
Imagine you have a library for working with some sort of XML file or configuration file. The library reads the whole file into memory and provides methods for editing the content. When you are done manipulating the content you can call a write to save the content back to file. The question is how to do this in a safe w...
How to safely write to a file?
1
0.099668
1
0
0
9,770
1,812,115
2009-11-28T09:46:00.000
17
0
1
1
0
python,windows,file
0
1,812,604
0
8
0
true
0
0
If you see Python's documentation, it clearly mentions that os.rename() is an atomic operation. So in your case, writing data to a temporary file and then renaming it to the original file would be quite safe. Another way could work like this: let original file be abc.xml create abc.xml.tmp and write new data to it re...
2
21
0
0
Imagine you have a library for working with some sort of XML file or configuration file. The library reads the whole file into memory and provides methods for editing the content. When you are done manipulating the content you can call a write to save the content back to file. The question is how to do this in a safe w...
How to safely write to a file?
1
1.2
1
0
0
9,770
1,814,437
2009-11-29T02:20:00.000
0
0
0
0
0
python,django
0
1,814,465
0
4
0
false
1
0
I'm going to assume that you mean logged in at once, and not one "login" at the same time. I've never written a Django application before. But one method I've used in other languages, is to store the session ID of the logged in user in their user row in the database. For example, if you have a users table in your datab...
1
2
0
0
is it possible to allow only one concurrent login per user in django application? if yes, how do you approach?
Allow only one concurrent login per user in django app
1
0
1
0
0
13,565
1,818,969
2009-11-30T10:20:00.000
3
0
0
0
0
python,selenium
0
1,819,059
0
2
0
false
0
0
You should be able to use the stop and start commands. You will need to ensure that you are not clearing cookies between sessions, and depending on the browser you're launching you may also need to use the -browserSessionReuse command line option.
2
1
0
0
I'm writing a script which needs the browser that selenium is operating close and re-open, without losing its cookies. Any idea on how to go about it? Basically, it's a check to see that if the user opens and closes his browser, his cookies stay intact.
Close and open a new browser in Selenium
0
0.291313
1
0
1
1,370
1,818,969
2009-11-30T10:20:00.000
0
0
0
0
0
python,selenium
0
1,819,042
0
2
0
false
0
0
This is a feature of the browser and not your concern: If there is a bug in the browser, then there is little you can do. If you need to know whether a certain version of the browser works correctly, then define a manual test (write a document that explains the steps), do it once and record the result somewhere (like "...
2
1
0
0
I'm writing a script which needs the browser that selenium is operating close and re-open, without losing its cookies. Any idea on how to go about it? Basically, it's a check to see that if the user opens and closes his browser, his cookies stay intact.
Close and open a new browser in Selenium
0
0
1
0
1
1,370
1,819,903
2009-11-30T13:42:00.000
1
0
0
0
0
javascript,python,testing,selenium,selenium-rc
0
1,902,514
0
2
1
false
1
0
If you are purely testing that the JavaScript functions are performing the correct calculations with the given inputs, I would suggest separating your JavaScript from your page and use a JavaScript testing framework to test the functionality. Testing low level code using Selenium is a lot of unnecessary overhead. If ...
1
3
0
0
My Application has a lot of calculation being done in JavaScript according to how and when the user acts on the application. The project prints out valuable information (through console calls) as to how this calculation is going on, and so we can easily spot any NaNs creeping in. We are planning to integrate Selenium (...
Javascript communication with Selenium (RC)
1
0.099668
1
0
1
2,109
1,828,040
2009-12-01T18:38:00.000
1
0
1
0
0
python,visual-studio,google-app-engine
0
1,828,477
0
4
0
true
0
0
Thanks for all the responses. I did scan through some Python IDEs (and their screenshots) and decided to check out IronPythonStudio. My .py files now get colour coded nicely, and there's some intellisense :) Unfortunately Ctrl+K,D doesn't work, but it's much nicer to code than the plain yellow text I had earlier. For a...
1
2
0
0
I've started messing around with Google App Engine, writing Python. I love Visual Studio for many reasons, but currently my .py files just look like text. I've searched the web looking for a way to get it to highlight python files (intellisense would be a nice bonus, but not required) but turned up nothing. There are o...
Python syntax highlighting / Intellisense?
0
1.2
1
0
0
2,992
1,837,686
2009-12-03T04:43:00.000
18
1
1
0
0
python,c,utf-8,compression
0
1,837,697
0
6
0
false
0
0
Just use gzip compression, and save 60-70% with 0% effort!
3
2
0
0
I wish to take a file encoded in UTF-8 that doesn't use more than 128 different characters, then move it to a 7-bit encoding to save the 1/8 of space. For example, if I have a 16 MB text file that only uses the first 128(ascii) characters, I would like to shave off the extra bit to reduce the file to 14MB. How would I ...
Compressing UTF-8(or other 8-bit encoding) to 7 or fewer bits
0
1
1
0
0
2,837
1,837,686
2009-12-03T04:43:00.000
0
1
1
0
0
python,c,utf-8,compression
0
1,839,384
0
6
0
false
0
0
"this would simply leave an extra 0 on the binary string--11011001 might get mapped to 01000001 rather than 1000001, and I won't actually save space." Correct. Your plan will do nothing.
3
2
0
0
I wish to take a file encoded in UTF-8 that doesn't use more than 128 different characters, then move it to a 7-bit encoding to save the 1/8 of space. For example, if I have a 16 MB text file that only uses the first 128(ascii) characters, I would like to shave off the extra bit to reduce the file to 14MB. How would I ...
Compressing UTF-8(or other 8-bit encoding) to 7 or fewer bits
0
0
1
0
0
2,837
1,837,686
2009-12-03T04:43:00.000
-2
1
1
0
0
python,c,utf-8,compression
0
1,838,614
0
6
0
false
0
0
What you need is UTF-7. Edit: UTF-7 has the advantage of bloating "only" special characters, so if special characters are rare in the input, you get far less bytes than by just converting UTF-8 to 7 bit. That's what UTF-7 is for.
3
2
0
0
I wish to take a file encoded in UTF-8 that doesn't use more than 128 different characters, then move it to a 7-bit encoding to save the 1/8 of space. For example, if I have a 16 MB text file that only uses the first 128(ascii) characters, I would like to shave off the extra bit to reduce the file to 14MB. How would I ...
Compressing UTF-8(or other 8-bit encoding) to 7 or fewer bits
0
-0.066568
1
0
0
2,837
1,843,219
2009-12-03T21:57:00.000
0
0
1
0
0
c#,python,visual-studio,transition
0
1,843,265
0
16
0
false
0
0
I'm not too familiar with Python so I'll give some general advice. Make sure to print out some reference pages of common functions. Keep them by you(or pinned to a wall or desk) at all times when your programming.. I'm traditionally a "stone age" developer and after developing in VS for a few months I'm finding my hobb...
10
9
0
0
i feel like i'm going back to the stone age. how do i relearn to develop without intellisense (pydev intellisense doesn't count).. in general, how does one successfully leave the comfort of visual studio ?
how to transition from C# to python?
0
0
1
0
0
10,335
1,843,219
2009-12-03T21:57:00.000
2
0
1
0
0
c#,python,visual-studio,transition
0
1,843,298
0
16
0
false
0
0
You could always start with IronPython and continue to develop in Visual Studio.
10
9
0
0
i feel like i'm going back to the stone age. how do i relearn to develop without intellisense (pydev intellisense doesn't count).. in general, how does one successfully leave the comfort of visual studio ?
how to transition from C# to python?
0
0.024995
1
0
0
10,335
1,843,219
2009-12-03T21:57:00.000
1
0
1
0
0
c#,python,visual-studio,transition
0
1,844,168
0
16
0
false
0
0
Same way you do anything else that doesn't have IntelliStuff. I'm betting you wrote that question without the aid of an IntelliEnglish computer program that showed you a list of verbs you could use and automatically added punctuation at the end of your sentences, for example. :-)
10
9
0
0
i feel like i'm going back to the stone age. how do i relearn to develop without intellisense (pydev intellisense doesn't count).. in general, how does one successfully leave the comfort of visual studio ?
how to transition from C# to python?
0
0.012499
1
0
0
10,335
1,843,219
2009-12-03T21:57:00.000
0
0
1
0
0
c#,python,visual-studio,transition
0
1,843,273
0
16
0
false
0
0
I've only ever used IDLE for python development and it is not fun in the least. I would recommend getting your favorite text editor, mine is notepad++, and praying for a decent plugin for it. I only ever had to go from Eclipse to Visual Studio so my opinions are generally invalid in these contexts.
10
9
0
0
i feel like i'm going back to the stone age. how do i relearn to develop without intellisense (pydev intellisense doesn't count).. in general, how does one successfully leave the comfort of visual studio ?
how to transition from C# to python?
0
0
1
0
0
10,335
1,843,219
2009-12-03T21:57:00.000
5
0
1
0
0
c#,python,visual-studio,transition
0
1,843,269
0
16
0
false
0
0
One step at a time? Start off with simple programs (things you can write with your eyes closed in C#), and keep going... You will end up knowing the API by heart.
10
9
0
0
i feel like i'm going back to the stone age. how do i relearn to develop without intellisense (pydev intellisense doesn't count).. in general, how does one successfully leave the comfort of visual studio ?
how to transition from C# to python?
0
0.062419
1
0
0
10,335
1,843,219
2009-12-03T21:57:00.000
1
0
1
0
0
c#,python,visual-studio,transition
0
1,843,406
0
16
0
false
0
0
Don't worry about intellisense. Python is really simple and there really isn't that much to know, so after a few projects you'll be conceiving of python code while driving, eating, etc., without really even trying. Plus, python's built in text editor (IDLE) has a wimpy version of intellisense that has always been more ...
10
9
0
0
i feel like i'm going back to the stone age. how do i relearn to develop without intellisense (pydev intellisense doesn't count).. in general, how does one successfully leave the comfort of visual studio ?
how to transition from C# to python?
0
0.012499
1
0
0
10,335
1,843,219
2009-12-03T21:57:00.000
2
0
1
0
0
c#,python,visual-studio,transition
0
1,843,362
0
16
0
false
0
0
The python ide from wingware is pretty nice. Thats what I ended up using going from visual studio C++/.net to doing python.
10
9
0
0
i feel like i'm going back to the stone age. how do i relearn to develop without intellisense (pydev intellisense doesn't count).. in general, how does one successfully leave the comfort of visual studio ?
how to transition from C# to python?
0
0.024995
1
0
0
10,335
1,843,219
2009-12-03T21:57:00.000
4
0
1
0
0
c#,python,visual-studio,transition
0
1,843,434
0
16
0
false
0
0
<rant> This is sort of the reason that I think being a good visual studio user makes you a bad developer. Instead of learning an API, you look in the object browser until you find something that sounds more or less like what you are looking for, instantiate it, then hit . and start looking for what sounds like the righ...
10
9
0
0
i feel like i'm going back to the stone age. how do i relearn to develop without intellisense (pydev intellisense doesn't count).. in general, how does one successfully leave the comfort of visual studio ?
how to transition from C# to python?
0
0.049958
1
0
0
10,335
1,843,219
2009-12-03T21:57:00.000
0
0
1
0
0
c#,python,visual-studio,transition
0
1,847,072
0
16
0
false
0
0
I suggest going cold turkey - languages like Python shine with great text editors. Choose one you want to become amazing at (vim, emacs, etc.) and never look back.
10
9
0
0
i feel like i'm going back to the stone age. how do i relearn to develop without intellisense (pydev intellisense doesn't count).. in general, how does one successfully leave the comfort of visual studio ?
how to transition from C# to python?
0
0
1
0
0
10,335
1,843,219
2009-12-03T21:57:00.000
1
0
1
0
0
c#,python,visual-studio,transition
0
38,883,895
0
16
0
false
0
0
A mistake people coming from C# or Java make a lot is recreate a large class hierarchy like is common in those languages. With Python this is almost never useful. Instead, learn about duck typing. And don't worry too much about the lack of static typing: in practice, it's almost never an issue.
10
9
0
0
i feel like i'm going back to the stone age. how do i relearn to develop without intellisense (pydev intellisense doesn't count).. in general, how does one successfully leave the comfort of visual studio ?
how to transition from C# to python?
0
0.012499
1
0
0
10,335
1,847,120
2009-12-04T14:02:00.000
0
0
0
0
0
javascript,python,xmpp,wsgi
0
1,881,020
0
3
0
false
1
0
I have found a lot of issues with Openfire and TLS are not with the xmpp lib :( -- SleekXMPP in the trunk has been converted to Python 3.0 and the branch is maintained for Python 2.5 Unlike Julien, I would only go with Twisted Words if you really need the power of Twisted or if you are already using Twisted. IMO Sleek...
1
3
0
0
I want to learn how to use XMPP and to create a simple web application with real collaboration features. I am writing the application with Python(WSGI), and the application will require javascript enabled because I am going to use jQuery or Dojo. I have downloaded Openfire for the server and which lib to choose? SleekX...
Best XMPP Library for Python Web Application
0
0
1
0
1
1,373
1,859,195
2009-12-07T10:38:00.000
0
0
0
0
1
python,video,pyglet
0
1,860,559
0
2
0
true
0
1
I think calling "pyglet.app.run()" is missing.
1
1
0
0
I'm new to pyglet and i have a problem with video.. I'm trying to play a video using pyglet .. but instead of playing the video in the window it just exits immediately and terminates .. do you guys have any solution for this problem how can i hold the window to play vedio?? i use windows vista 64x with python 2.5 ple...
problem with pyglet playing video
0
1.2
1
0
0
4,199
1,861,267
2009-12-07T16:52:00.000
1
0
0
0
0
python,django,django-cms
0
1,872,391
0
1
0
true
1
0
This all depends on your model. Plugins use standard django admin features. This also depends on the source data for the table. If you have a CSV or Exel sheet as source i only would make a file field and render the file in the render function with some optional caching. If you want to enter data by hand: A Table mode...
1
1
0
0
I don't see any possibility for creating a table in django-cms. I need this functionnality so I am evaluating the possibility to write my own plugin. I am getting started with this product. I've read the documentation carefully and I see more or less how to do that. However, I would be happy to hear some tips and trick...
Writing my own django-cms plugin. Any recommendations?
0
1.2
1
0
0
1,710
1,870,140
2009-12-08T21:59:00.000
0
0
1
0
0
python,google-app-engine,cron
0
1,870,164
0
4
0
false
1
0
Can you use cron to schedule the job to run at certain intervals? It's usually considered better than infinite loops, and was designed to help solve this sort of problem.
1
1
0
0
Question for Python 2.6 I would like to create an simple web application which in specified time interval will run a script that modifies the data (in database). My problem is code for infinity loop or some other method to achieve this goal. The script should be run only once by the user. Next iterations should run aut...
Render in infinity loop
0
0
1
0
0
283
1,879,872
2009-12-10T09:42:00.000
2
0
0
0
0
jquery,python,ajax,django,django-templates
0
1,879,991
0
3
0
false
1
0
Since you're already using an AJAX post, why don't you return the data from that and insert it into the div? The view that accepts the post can return a rendered template or JSON, and your javascript can insert it in the callback.
1
8
0
0
I am building a chat application. So far I am adding chat messages with jquery $.post() and this works fine. Now I need to retrieve the latest chat message from the table and append the list on the chat page. I am new to Django, so please go slow. So how do I get data from the chat table back to the chat page? Thanks i...
DJANGO : Update div with AJAX
0
0.132549
1
0
0
5,349
1,881,851
2009-12-10T15:41:00.000
0
0
0
0
0
python,c
0
1,881,867
0
7
0
false
0
0
take a look at module struct ?
1
1
1
1
I have a python code computing a matrix, and I would like to use this matrix (or array, or list) from C code. I wanted to pickle the matrix from the python code, and unpickle it from c code, but I could not find documentation or example on how to do this. I found something about marshalling data, but nothing about unpi...
How to unpickle from C code
0
0
1
0
0
1,690
1,896,722
2009-12-13T14:46:00.000
2
0
1
0
0
python,floating-point
0
1,896,737
0
4
0
false
0
0
Floating point numbers have infinite number of decimal places. The physical representation on the computer is dependent on the representation of float, or double, or whatever and is dependent on a) language b) construct, e.g. float, double, etc. c) compiler implementation d) hardware. Now, given that you have a represe...
2
0
0
0
So I know how to print a floating point number with a certain decimal places. My question is how to return it with a specified number of decimal places? Thanks.
How to return a float point number with a defined number of decimal places?
0
0.099668
1
0
0
3,481
1,896,722
2009-12-13T14:46:00.000
4
0
1
0
0
python,floating-point
0
1,896,729
0
4
0
false
0
0
In order to get two decimal places, multiply the number by 100, floor it, then divide by 100. And note that the number you will return will not really have only two decimal places because division by 100 cannot be represented exactly in IEEE-754 floating-point arithmetic most of the time. It will only be the closest re...
2
0
0
0
So I know how to print a floating point number with a certain decimal places. My question is how to return it with a specified number of decimal places? Thanks.
How to return a float point number with a defined number of decimal places?
0
0.197375
1
0
0
3,481
1,897,748
2009-12-13T21:07:00.000
1
1
0
1
0
python,http,unix,asynchronous
0
1,897,759
0
3
0
false
0
0
Django is great for writing web applications, and the subprocess module (subprocess.Popen en .communicate()) is great for executing shell scripts. You can give it a stdin,stdout and stderr stream for communication if you want.
1
2
0
0
We have a collection of Unix scripts (and/or Python modules) that each perform a long running task. I would like to provide a web interface for them that does the following: Asks for relevant data to pass into scripts. Allows for starting/stopping/killing them. Allows for monitoring the progress and/or other informati...
Executing server-side Unix scripts asynchronously
0
0.066568
1
0
0
257
1,902,338
2009-12-14T17:38:00.000
4
0
1
0
0
python,django,multithreading,scheduling
0
1,902,471
0
5
0
true
0
0
Django is a server application, which only reacts to external events. You should use a scheduler like cron to create events that call your django application, either calling a management subcommand or doing an HTTP request on some special page.
1
1
0
0
In python how to implement a thread which runs in the background (may be when the module loads) and calls the function every minute Monday to Friday 10 AM to 3 PM. For example the function should be called at: 10:01 AM 10:02 AM 10:03 AM . . 2:59 PM Any pointers? Environment: Django Thanks
How to implement time event scheduler in python?
0
1.2
1
0
0
3,634
1,907,782
2009-12-15T14:21:00.000
0
1
0
0
0
php,python,integration,trac
0
1,909,272
0
3
0
false
1
0
Your Python code will have access to your users' cookies. A template would be best, but if you don't have one available (or the header/footer are trivially small, or whatever), you can simply port the PHP header and footer code to Python, using the cookies that are already there to query the database or whatever you ne...
2
4
0
0
This might sound really crazy, but still... For our revamped project site, we want to integrate Trac (as code browser, developer wiki and issue tracker) into the site design. That is, of course, difficult, since Trac is written in Python and our site in PHP. Does anybody here know a way how to integrate a header and fo...
Integrate Python app into PHP site
0
0
1
0
0
2,293
1,907,782
2009-12-15T14:21:00.000
1
1
0
0
0
php,python,integration,trac
0
1,907,850
0
3
0
false
1
0
The best option probably is to (re)write the header and footer using python. If the header and footer are relatively static you can also generate them once using php (or once every x minutes) and include them from the filesystem. (You probably already thought about this and dismissed the idea because your sites are too...
2
4
0
0
This might sound really crazy, but still... For our revamped project site, we want to integrate Trac (as code browser, developer wiki and issue tracker) into the site design. That is, of course, difficult, since Trac is written in Python and our site in PHP. Does anybody here know a way how to integrate a header and fo...
Integrate Python app into PHP site
0
0.066568
1
0
0
2,293
1,909,025
2009-12-15T17:26:00.000
20
0
1
0
1
python,virtualenv
1
1,910,294
0
3
0
true
0
0
Is there a bash alias active on this machine for "python", by any chance? That will take priority over the PATH-modifications made by activate, and could cause the wrong python binary to be used. Try running virtualenv/bin/python directly (no need to activate) and see if you can import your module. If this fixes it, yo...
1
10
0
0
I have a problem with virtualenv. I use it regulary, I use it on my development machine and on several servers. But on this last server I tried to use i got a problem. I created a virtualenv with the --no-site-packages argument, and then I installed some python modules inside the virtualenv. I can confirm that the modu...
Import error with virtualenv
0
1.2
1
0
0
24,484
1,909,249
2009-12-15T18:03:00.000
0
0
1
0
0
python,macos,osx-snow-leopard
0
23,410,716
0
4
0
false
0
0
when doing an "port selfupdate", rsync timesout with rsync.macports.org. There are mirror sites available to use.
2
20
0
0
I'm developing on Snow Leopard and going through the various "how tos" to get the MySQLdb package installed and working (uphill battle). Things are a mess and I'd like to regain confidence with a fresh, clean, as close to factory install of Python 2.6. What folders should I clean out? What should I run? What symboli...
How to clean up my Python Installation for a fresh start
0
0
1
0
0
29,101
1,909,249
2009-12-15T18:03:00.000
1
0
1
0
0
python,macos,osx-snow-leopard
0
1,909,283
0
4
0
false
0
0
My experience doing development on MacOSX is that the directories for libraries and installation tools are just different enough to cause a lot of problems that you end up having to fix by hand. Eventually, your computer becomes a sketchy wasteland of files and folders duplicated all over the place in an effort to solv...
2
20
0
0
I'm developing on Snow Leopard and going through the various "how tos" to get the MySQLdb package installed and working (uphill battle). Things are a mess and I'd like to regain confidence with a fresh, clean, as close to factory install of Python 2.6. What folders should I clean out? What should I run? What symboli...
How to clean up my Python Installation for a fresh start
0
0.049958
1
0
0
29,101
1,911,615
2009-12-16T01:04:00.000
0
0
1
0
1
python,python-idle
1
1,911,639
0
2
0
false
0
0
Enable the debugger and see if it tells you anything.
1
0
0
0
I am using python 2.5 on windows. All I am doing is unpickling a large file (18MB - a list of dictionaries) and modifiying some of its values. Now this works fine. But when I add a couple of prints, IDLE restarts. And weirdly enough it seems to be happening where I added the print. I figured this out commenting and unc...
Python: How do I find why IDLE restarts?
0
0
1
0
0
705
1,912,229
2009-12-16T04:11:00.000
9
0
1
0
1
python,properties,decorator
0
1,912,265
0
2
0
false
0
0
In Python 3 you WOULD see the print's result -- and then an AttributeError for the last print (because _m has disappeared). You may be using Python 2.6, in which case you need to change the class clause to class M(object): to make M new-style, and then you'll get the same behavior as in Python 3.
1
16
0
0
I'm playing around with property in Python and I was wondering how this @propertyName.deleter decorator works. I'm probably missing something, I could not find clear answers by Google. What I would like to achieve is when this deleter behavior is called, I can trigger other actions (e.g: using my 3d application SDK). ...
deleter decorator using Property in Python
0
1
1
0
0
13,562
1,912,351
2009-12-16T04:44:00.000
18
0
0
0
0
python,django
0
1,914,081
0
4
0
false
1
0
create a reusable app that include your generic functions so you can share between projects. use for example a git repo to store this app and manage deployments and evolution (submodule) use a public git repo so you can share with the community :)
3
80
0
0
I have a couple of functions that I wrote that I need to use in my django app. Where would I put the file with them and how would I make them callable within my views?
Django: Where to put helper functions?
0
1
1
0
0
40,688
1,912,351
2009-12-16T04:44:00.000
13
0
0
0
0
python,django
0
1,912,371
0
4
0
false
1
0
If they are related to a specific app, I usually just put them in the related app folder and name the file, 'functions.py'. If they're not specific to an app, I make a commons app for components (tests, models, functions, etc) that are shared across apps.
3
80
0
0
I have a couple of functions that I wrote that I need to use in my django app. Where would I put the file with them and how would I make them callable within my views?
Django: Where to put helper functions?
0
1
1
0
0
40,688
1,912,351
2009-12-16T04:44:00.000
2
0
0
0
0
python,django
0
13,270,468
0
4
0
false
1
0
I am using new python file service.py in app folder. The file contains mostly helper queries for specific app. Also I used to create a folder inside Django application that contains global helper functions and constants.
3
80
0
0
I have a couple of functions that I wrote that I need to use in my django app. Where would I put the file with them and how would I make them callable within my views?
Django: Where to put helper functions?
0
0.099668
1
0
0
40,688
1,918,420
2009-12-16T23:00:00.000
0
0
1
0
0
python,pdf,pypdf
0
6,202,708
0
4
0
false
0
0
Darrell's class can be modified slightly to produce a multi-level table of contents for a pdf (in the manner of pdftoc in the pdftk toolkit.) My modification adds one more parameter to _setup_page_id_to_num, an integer "level" which defaults to 1. Each invocation increments the level. Instead of storing just the page ...
1
5
0
0
i would like to use pyPdf to split a pdf file based on the outline where each destination in the outline refers to a different page within the pdf. example outline: main --> points to page 1 sect1 --> points to page 1 sect2 --> points to page 15 sect3 --> points to page 22 it is easy within pyPd...
split a pdf based on outline
0
0
1
0
0
5,099
1,925,974
2009-12-18T02:49:00.000
0
0
0
1
0
python,sockets,ip-address
0
1,926,048
0
2
0
false
0
0
quick answer - socket.getpeername() (provided that socket is a socket object, not a module) (playing around in python/ipython/idle/... interactive shell is very helpful) .. or if I read you question carefully, maybe socket.getsockname() :)
1
0
0
0
I need some code to get the address of the socket i just created (to filter out packets originating from localhost on a multicast network) this: socket.gethostbyname(socket.gethostname()) works on mac but it returns only the localhost IP in linux... is there anyway to get the LAN address thanks --edit-- is it possible ...
How to get the LAN IP that a socket is sending (linux)
1
0
1
0
1
626
1,929,018
2009-12-18T15:55:00.000
1
0
0
1
0
python,user-interface,glade
0
1,929,138
0
3
0
false
0
0
glade is only a program to build gui with gtk so when you ask for a glade object maybe you should ask for gtk widget and in this case textbuffer and textview chould be a solution or maybe treeview and liststore. subprocess.Popen has stdout and stderr arguments that can accept a file-like object. you can create an adapt...
1
2
0
0
I'm writing a python application that runs several subprocesses using subprocess.Popen objects. I have a glade GUI and want to display the output of these commands (running in subprocess.Popen) in the gui in real time. Can anyone suggest a way to do this? What glade object do I need to use and how to redirect the outpu...
Python GUI (glade) to display output of shell process
0
0.066568
1
0
0
3,524
1,934,088
2009-12-19T20:46:00.000
6
0
0
0
1
python,proxy,screen-scraping,web-crawler,squid
0
1,934,198
0
3
0
true
0
0
Make your crawler have a list of proxies and with each HTTP request let it use the next proxy from the list in a round robin fashion. However, this will prevent you from using HTTP/1.1 persistent connections. Modifying the proxy list will eventually result in using a new or not using a proxy. Or have several connection...
1
10
0
0
I've got a python web crawler and I want to distribute the download requests among many different proxy servers, probably running squid (though I'm open to alternatives). For example, it could work in a round-robin fashion, where request1 goes to proxy1, request2 to proxy2, and eventually looping back around. Any idea ...
Rotating Proxies for web scraping
0
1.2
1
0
1
16,640
1,935,290
2009-12-20T08:52:00.000
3
0
1
1
0
python,macos,module-search-path
0
1,935,323
0
4
1
true
0
0
I think by default /Library/Python/2.5/site-packages/ is part of your search path. This directory is usually used for third party libraries.
1
1
0
0
I'm trying to use pywn, a python library for using WordNet. I've played about with python a little under Windows, but am completely new at MacOS X stuff. I'm running under MacOS 10.5.8, so my default Python interpreter is 2.5.1 The pywn instructions say: "Put each of the .py files somewhere in your python search path."...
how do I add a python module on MacOS X?
0
1.2
1
0
0
28,430
1,960,155
2009-12-25T00:25:00.000
0
1
0
0
0
python,mysql,unit-testing,ubuntu
0
1,960,164
0
2
0
false
0
0
You can try the Blackhole and Memory table types in MySQL.
2
2
0
0
If I want to be able to test my application against a empty MySQL database each time my application's testsuite is run, how can I start up a server as a non-root user which refers to a empty (not saved anywhere, or in saved to /tmp) MySQL database? My application is in Python, and I'm using unittest on Ubuntu 9.10.
Start a "throwaway" MySQL session for testing code?
0
0
1
1
0
287
1,960,155
2009-12-25T00:25:00.000
1
1
0
0
0
python,mysql,unit-testing,ubuntu
0
1,960,160
0
2
0
true
0
0
--datadir for just the data or --basedir
2
2
0
0
If I want to be able to test my application against a empty MySQL database each time my application's testsuite is run, how can I start up a server as a non-root user which refers to a empty (not saved anywhere, or in saved to /tmp) MySQL database? My application is in Python, and I'm using unittest on Ubuntu 9.10.
Start a "throwaway" MySQL session for testing code?
0
1.2
1
1
0
287
1,962,447
2009-12-26T02:05:00.000
4
0
0
0
0
python
0
1,964,328
0
4
0
false
1
0
File / New Project / enter your project name. In the Project Browser, create a package named "source" Right-click the source package, "Code Engineering", "Import Source Directory". Pick the directory containing your module(s) as the "Root Directory" Set "Source Type" to Python Enable "Recursively Process Subdirectories...
2
2
0
0
Please let me know how to create a uml diagram along with its equivalent documentation for the source code(.py format) using enterprise architecture 7.5 Please help me find the solution, I have read the solution for the question on this website related to my topic but in vain
python source code conversion to uml diagram with Sparx Systems Enterprise Architect
0
0.197375
1
0
0
4,824
1,962,447
2009-12-26T02:05:00.000
1
0
0
0
0
python
0
45,345,997
0
4
0
false
1
0
Go to project browser Create a model Right-click model > Add > Add View > Class Right-click class > Code Engineering > Import Source Directory... Check "one package per folder" The last one ensures you'll have an interesting diagram full of classes.
2
2
0
0
Please let me know how to create a uml diagram along with its equivalent documentation for the source code(.py format) using enterprise architecture 7.5 Please help me find the solution, I have read the solution for the question on this website related to my topic but in vain
python source code conversion to uml diagram with Sparx Systems Enterprise Architect
0
0.049958
1
0
0
4,824
1,962,592
2009-12-26T04:02:00.000
1
0
0
0
0
python,wxpython
0
1,962,595
0
3
0
false
0
1
You can take a look at the wxPython examples, they also include code samples for almost all of the widgets supported by wxPython. If you use Windows they can be found in the Start Menu folder of WxPython.
1
4
0
0
I'm starting to learn both Python and wxPython and as part of the app I'm doing, I need to have a simple browser on the left pane of my app. I'm wondering how do I do it? Or at least point me to the right direction that'll help me more on how to do one. Thanks in advance! EDIT: a sort of side question, how much of wxPy...
How do I make a simple file browser in wxPython?
0
0.066568
1
0
0
6,299
1,977,521
2009-12-29T23:15:00.000
1
0
0
0
0
python,audio,pyglet
0
1,980,577
0
2
0
true
1
0
It doesn't appear that pyglet has support for setting a stop time. Your options are: Poll the current time and stop playback when you've reached your desired endpoint. This may not be precise enough for you. Or, use a sound file library to extract the portion you want into a temporary sound file, then use pyglet to ...
1
1
0
0
How can I use the pyglet API for sound to play subsets of a sound file e.g. from 1 second in to 3.5seconds of a 6 second sound clip? I can load a sound file and play it, and can seek to the start of the interval desired, but am wondering how to stop playback at the point indicated?
Play Subset of audio file using Pyglet
0
1.2
1
0
0
1,156
1,990,502
2010-01-02T03:19:00.000
0
0
0
0
0
python,django,login,signals
0
1,991,497
0
7
0
false
1
0
Rough idea - you could use middleware for this. This middleware could process requests and fire signal when relevant URL is requested. It could also process responses and fire signal when given action actually succeded.
2
84
0
0
In my Django app, I need to start running a few periodic background jobs when a user logs in and stop running them when the user logs out, so I am looking for an elegant way to get notified of a user login/logout query user login status From my perspective, the ideal solution would be a signal sent by each django.co...
Django: signal when user logs in?
0
0
1
0
0
38,642
1,990,502
2010-01-02T03:19:00.000
1
0
0
0
0
python,django,login,signals
0
1,991,512
0
7
0
false
1
0
The only reliable way (that also detects when the user has closed the browser) is to update some last_request field every time the user loads a page. You could also have a periodic AJAX request that pings the server every x minutes if the user has a page open. Then have a single background job that gets a list of recen...
2
84
0
0
In my Django app, I need to start running a few periodic background jobs when a user logs in and stop running them when the user logs out, so I am looking for an elegant way to get notified of a user login/logout query user login status From my perspective, the ideal solution would be a signal sent by each django.co...
Django: signal when user logs in?
0
0.028564
1
0
0
38,642
1,993,060
2010-01-02T22:14:00.000
0
1
0
0
0
python,authentication,file-upload,automation
0
1,993,139
0
3
0
false
0
0
You mention they do not offer FTP, but I went to their site and found the following: How to upload with FTP? ftp.hotfile.com user: your hotfile username pass: your hotfile password You can upload and make folders, but cant rename,move files Try it. If it works, using FTP from within Python will be a very simp...
1
2
0
0
I want to upload a file from my computer to a file hoster like hotfile.com via a Python script. Because Hotfile is only offering a web-based upload service (no ftp). I need Python first to login with my username and password and after that to upload the file. When the file transfer is over, I need the Download and Dele...
Upload file to a website via Python script
1
0
1
0
1
7,457
1,994,507
2010-01-03T10:14:00.000
7
0
0
0
0
python,django,multithreading
0
1,994,563
0
2
0
false
1
0
Why would you want to do that? runserver is for development only, it should never be used in production. And if you're running via Apache, it should manage threads/processes for you anyway.
2
0
0
0
I want to start a thread when django project runserver successfully. where can I put the create-thread-and-start code? Is there any hook for the django runserver?
how to start a thread when django runserver?
0
1
1
0
0
2,758
1,994,507
2010-01-03T10:14:00.000
0
0
0
0
0
python,django,multithreading
0
1,997,921
0
2
0
false
1
0
Agree with the above answer, you probably don't want to do this. Runserver should be used for development only. Once you deploy, you'll want to move to Apache/WSGI. On my dev machine (where I do use runserver), I usually throw it in a screen session, so it doesn't get in the way, but I can pull it back up if I need to ...
2
0
0
0
I want to start a thread when django project runserver successfully. where can I put the create-thread-and-start code? Is there any hook for the django runserver?
how to start a thread when django runserver?
0
0
1
0
0
2,758
2,007,908
2010-01-05T17:36:00.000
0
0
0
0
0
c#,python,django,soap,wsdl
0
2,008,000
0
2
0
false
1
0
One thing you can do is start by building a manual proxy using WebClient, or WebRequest/WebResponse. Construct your manual proxy to send the desired data to the WS for testing. Couple of things to check on the WSDL implementation: The WSDL definition needs to match exactly, including case, for the C# proxy to recogniz...
2
3
0
0
I have a C# command-line client that I'm testing the consumption of SOAP/WSDL via Django/Python/soaplib created WSDL. I've managed to successfully connect to the web service by adding a service reference. I then call one of service's methods, and the service processes the data I send, but it returns null instead of the...
How to use C# client to consume Django/Python web service (all methods are returning null)?
0
0
1
0
0
1,555
2,007,908
2010-01-05T17:36:00.000
0
0
0
0
0
c#,python,django,soap,wsdl
0
2,008,062
0
2
0
false
1
0
We faced the similar problem while consuming a web service it was the type of data returned we were getting data in UTF-16 format. Please check if you have proper data type in use.
2
3
0
0
I have a C# command-line client that I'm testing the consumption of SOAP/WSDL via Django/Python/soaplib created WSDL. I've managed to successfully connect to the web service by adding a service reference. I then call one of service's methods, and the service processes the data I send, but it returns null instead of the...
How to use C# client to consume Django/Python web service (all methods are returning null)?
0
0
1
0
0
1,555
2,010,255
2010-01-06T00:47:00.000
4
1
1
0
0
python
0
2,010,309
0
5
0
false
0
0
The first things that come to mind are: Try a smaller path Make sure your modules are pyc's so they'll load faster Make sure you don't double import, or import too much Other than that, are you sure that the disk operations are what's bogging you down? Is your disk/operating system really busy or old and slow? Mayb...
3
24
0
0
I'm getting seriously frustrated at how slow python startup is. Just importing more or less basic modules takes a second, since python runs down the sys.path looking for matching files (and generating 4 stat() calls - ["foo", "foo.py", "foo.pyc", "foo.so"] - for each check). For a complicated project environment, wit...
Speeding up the python "import" loader
0
0.158649
1
0
0
12,690
2,010,255
2010-01-06T00:47:00.000
1
1
1
0
0
python
0
2,010,759
0
5
0
false
0
0
Something's missing from your premise--I've never seen some "more-or-less" basic modules take over a second to import, and I'm not running Python on what I would call cutting-edge hardware. Either you're running on some seriously old hardware, or you're running on an overloaded machine, or either your OS or Python ins...
3
24
0
0
I'm getting seriously frustrated at how slow python startup is. Just importing more or less basic modules takes a second, since python runs down the sys.path looking for matching files (and generating 4 stat() calls - ["foo", "foo.py", "foo.pyc", "foo.so"] - for each check). For a complicated project environment, wit...
Speeding up the python "import" loader
0
0.039979
1
0
0
12,690
2,010,255
2010-01-06T00:47:00.000
11
1
1
0
0
python
0
2,010,354
0
5
0
false
0
0
zipping up as many pyc files as feasible (with proper directory structure for packages), and putting that zipfile as the very first entry in sys.path (on the best available local disk, ideally) can speed up startup times a lot.
3
24
0
0
I'm getting seriously frustrated at how slow python startup is. Just importing more or less basic modules takes a second, since python runs down the sys.path looking for matching files (and generating 4 stat() calls - ["foo", "foo.py", "foo.pyc", "foo.so"] - for each check). For a complicated project environment, wit...
Speeding up the python "import" loader
0
1
1
0
0
12,690
2,013,835
2010-01-06T15:09:00.000
1
0
0
0
0
python,django,django-models,decimal,currency
0
2,013,893
0
10
0
false
1
0
You store it as a DecimalField and manually add the decimals if you need to, as Valya said, using basic formatting techniques. You can even add a Model Method to you product or transaction model that will spit out the DecimalField as an appropriately formatted string.
2
66
0
0
I'm running into a paradigm problem here. I don't know whether I should store money as a Decimal(), or if I should store it as a string and convert it to a decimal myself. My reasoning is this: PayPal requires 2 decimal places, so if I have a product that is 49 dollars even, PayPal wants to see 49.00 come across the wi...
Django: How should I store a money value?
0
0.019997
1
0
0
37,694
2,013,835
2010-01-06T15:09:00.000
10
0
0
0
0
python,django,django-models,decimal,currency
0
2,013,866
0
10
0
false
1
0
I suggest to avoid mixing representation with storage. Store the data as a decimal value with 2 places. In the UI layer, display it in a form which is suitable for the user (so maybe omit the ".00"). When you send the data to PayPal, format it as the interface requires.
2
66
0
0
I'm running into a paradigm problem here. I don't know whether I should store money as a Decimal(), or if I should store it as a string and convert it to a decimal myself. My reasoning is this: PayPal requires 2 decimal places, so if I have a product that is 49 dollars even, PayPal wants to see 49.00 come across the wi...
Django: How should I store a money value?
0
1
1
0
0
37,694
2,015,065
2010-01-06T17:57:00.000
2
0
0
0
0
jquery,python,ajax,asynchronous,cherrypy
0
2,015,344
0
2
0
true
1
0
The same way you would do them using any other webserver - by getting your javascript to call a URL which is handled by the server-side application.
1
1
0
0
I'm using cherrypy's standalone server (cherrypy.quickstart()) and sqlite3 for a database. I was wondering how one would do ajax/jquery asynchronous calls to the database while using cherrypy?
How does one do async ajax calls using cherrypy?
0
1.2
1
1
0
3,741
2,020,318
2010-01-07T12:45:00.000
0
1
0
1
1
python,tar
0
2,020,334
0
5
0
false
0
0
This answer seems irrelevant, since I seem to have misunderstood the question, which has now been clarified. However, should someone find this question, while searching with pretty much the same terms, this answer may still be relevant: Just open the file in binary mode f = open(filename, 'rb') read/skip a bunch and pr...
2
1
0
0
i am facing some problem with files with huge data. i need to skip doing some execution on those files. i get the data of the file into a variable. now i need to get the byte of the variable and if it is greater than 102400 , then print a message. update : i cannot open the files , since it is present in a tar file. ...
how do i get the byte count of a variable in python just like wc -c gives in unix
0
0
1
0
0
1,889
2,020,318
2010-01-07T12:45:00.000
1
1
0
1
1
python,tar
0
2,020,425
0
5
0
false
0
0
len(data) gives you the size in bytes if it's binary data. With strings the size depends on the encoding used.
2
1
0
0
i am facing some problem with files with huge data. i need to skip doing some execution on those files. i get the data of the file into a variable. now i need to get the byte of the variable and if it is greater than 102400 , then print a message. update : i cannot open the files , since it is present in a tar file. ...
how do i get the byte count of a variable in python just like wc -c gives in unix
0
0.039979
1
0
0
1,889
2,021,764
2010-01-07T16:14:00.000
7
0
0
0
0
python,pdf-generation,reportlab
0
2,621,635
0
1
0
false
0
0
Apparently reportlab does not support creating fillable pdf forms. The only thing I found about it being present in the API dates from 2003, afterwards all statements clearly say no. I'm answering this so late because this is one of the highest hits when you enter 'reportlab forms' in google. I do agree with Travis you...
1
3
0
0
can anyone please help me with creating forms in python using the reportlab lib. i am totally new to this and i would appreciate sample code thanks
how to make fillable forms with reportlab in python
0
1
1
0
0
1,976