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
2,846,308
2010-05-17T02:14:00.000
0
0
1
0
0
python,reference,stdout
0
2,846,344
0
5
0
false
0
0
This can't be done. Pass the desired attribute as a string and use getattr() and setattr().
1
1
0
0
I am traditionally a Perl and C++ programmer, so apologies in advance if I am misunderstanding something trivial about Python! I would like to create a reference to a reference. Huh? Ok. All objects in Python are actually references to the real object. So, how do I create a reference to this reference? Why do I need/...
Python: How do I create a reference to a reference?
0
0
1
0
0
382
2,849,118
2010-05-17T12:48:00.000
0
0
0
0
1
python,django,plugins
0
2,849,724
0
1
0
false
1
0
I would make an app with a very abstract definition of a Task model. The Task model might contain properties for: the input arguments, the function to run, the time that the task was submitted, the time that the task has been actually running, and the result (which would be something like a singleton Task.NotFinis...
1
0
0
0
I am developing a website which is aimed at being a GUI for several image processing algorithms (referred to as 'tasks'). At the moment, only one of these algorithms is finished, but there are more to come (which will have a similar, but not quite the same, workflow) Basically, the algorithm works as follows (not that ...
Suggestions for a pluggable task framework in Django
1
0
1
0
0
160
2,851,632
2010-05-17T18:21:00.000
2
0
1
0
0
python,django,virtualenv
0
2,851,741
1
2
0
true
1
0
If you have easy_install, or better yet pip installed, should be as easy as: easy_install/pip install virtualenv mkdir django1.2 virtualenv django1.2 This will put the python binary in a bin folder inside the django1.2 folder. Just use that python binary, and you've got a nice little self-contained environment. You c...
1
1
0
0
Since I have Django 1.1x on my Debian setup - how can I use virtualenv or similar and not have it mess up my system's default django version which in turn would break all my sites? Detailed instructions or a great tutorial link would very much be appreciated - please don't offer vague advice since I'm still a noob. Cur...
Using virtualenv to install different versions of same package
0
1.2
1
0
0
381
2,855,378
2010-05-18T07:52:00.000
10
1
1
0
1
python,emacs,ide,autocomplete
0
2,858,148
0
4
0
false
0
0
You can set the root folder with rope-open-project . Once you've set the root project a .ropeproject dir will be created. Inside it, a config.py file has hooks where you can run (python) code once the project is set. The project_opened(project): function is a good place to run code. I usually activate the virtual envi...
1
78
0
1
There are many sites with instructions on installing ropemacs, but so far I couldn't find any with instructions on how to use it after it's already installed. I have it installed, or at least it seems so, Emacs has "Rope" menu in it's top menu bar. Now what? So far I could use only "Show documentation" (C-c d by defaul...
ropemacs USAGE tutorial
0
1
1
0
0
18,010
2,857,634
2010-05-18T13:24:00.000
0
0
0
0
0
python,xml,user-interface,gtk,glade
0
2,857,711
0
4
1
false
0
1
I don't recommend doing a GUI in XML. All the XML does is give you a mini language for describing a layout. Why use a mini language when you can have the full power of python? As for detecting GTK, I wouldn't suggest that. Instead, add a command line argument to determine whether to create a GUI or not (eg: myprogram -...
1
2
0
0
I am trying to write an app in python to control a motor using serial. This all works in a CLI situation fine and is generally stable. but I was wondering how simple it was to add a GUI on top of this code base? I assume there will be more code, but is there a simple way of detecting something like GTK, so it only appl...
How can I create a GUI on top of a Python APP so it can do either GUI or CLI?
1
0
1
0
0
1,570
2,858,040
2010-05-18T14:14:00.000
2
0
0
0
1
python,django,permissions,inlines
0
3,090,090
0
1
0
true
1
0
If I want a read-only version of what's in the admin, I just write some normal Django views and keep them out of the admin. I don't think the kind of thing you're talking about (allowing changes to an object but not its inlines) is really supported by the admin. Don't get me wrong: the admin is very flexible and usefu...
1
9
0
0
I'm not sure if this is a bug or I'm just missing something (although I have already parsed the documentation about inlines), but: Let's say I have a model A. Model A is an inline of model B. User U has full access to model B, but only change permissions to model A (so, no add, nor delete). However, when editing model ...
Django Inlines user permissions + view only - permissions issues
1
1.2
1
0
0
1,938
2,859,413
2010-05-18T17:06:00.000
8
0
0
0
0
python,packaging,zipapp
1
2,861,524
0
1
0
true
0
1
I figured out by myself, It's sufficient to use pkgutil.get_data to access the data inside a package.
1
4
0
0
I'm doing a little program and I want to distribute it using this recipe: single directory with __main__.py in it zip this directory and adding a shebang on it #!/usr/bin/env python making it executable The problem is that in this package I have also extra files (I'm using pygtk toolkit and I need images and ui xml f...
Distributing an executable zip file with __main__.py, how to access extra data?
0
1.2
1
0
0
2,816
2,861,858
2010-05-18T23:22:00.000
-2
0
0
1
0
python,asynchronous,twisted
0
2,899,163
0
2
0
false
0
0
You might also like the txRDQ (Resizable Dispatch Queue) I wrote. Google it, it's in the tx collection on LaunchPad. Sorry I don't have more time to reply - about to go onstage. Terry
1
11
0
0
The strength of Twisted (for python) is its asynchronous framework (I think). I've written an image processing server that takes requests via Perspective Broker. It works great as long as I feed it less than a couple hundred images at a time. However, sometimes it gets spiked with hundreds of images at virtually the sa...
Queue remote calls to a Python Twisted perspective broker?
0
-0.197375
1
0
0
6,156
2,876,181
2010-05-20T17:17:00.000
0
0
0
1
0
python,asynchronous,file-upload
0
19,850,039
0
2
0
false
0
0
See if you can push the files straight from the user's browser to a static file store, like Amazon S3 or rackspace's cloudfiles service. Then you can handle a ton of parallel users.
1
3
0
1
We have a web application that takes file uploads for some parts. The file uploads aren't terribly big (mostly word documents and such), but they're much larger than your typical web request and they tend to tie up our threaded servers (zope 2 servers running behind an Apache proxy). I'm mostly in the brainstorming p...
What's the most scalable way to handle somewhat large file uploads in a Python webapp?
0
0
1
0
0
672
2,890,564
2010-05-23T03:10:00.000
1
0
0
0
0
python,matplotlib,sqlalchemy
0
2,891,001
0
1
0
true
0
0
It looks like matplotlib takes simple python data types -- lists of numbers, etc, so you'll be need to write custom code to massage what you pull out of mysql/sqlalchemy for input into the graphing functions...
1
1
0
0
After running a bunch of simulations I'm going to be outputting the results into a table created using SQLAlchemy. I plan to use this data to generate statistics - mean and variance being key. These, in turn, will be used to generate some graphs - histograms/line graphs, pie-charts and box-and-whisker plots specificall...
How to generate graphs and statistics from SQLAlchemy tables?
0
1.2
1
1
0
1,415
2,893,686
2010-05-23T22:09:00.000
9
0
1
0
0
python
0
2,893,714
0
3
0
false
0
0
Python bytecode requires Python to run, cannot be ran standalone without Python, and is specific to a particular x.y release of Python. It should be portable across platforms for the same version. There is not a common reason for you to use it; Python uses it to optimize out parsing of your .py file on repeated imports...
1
14
0
0
I want to know what a pyc file(python bytecode) is. I want to know all the details. I want to know about how pyc files interface with the compiler. Is it a replacement for exe? Does it need to be run by python? Is it as portable as the .py file is? Where should I use this?
Where to use a pyc file
0
1
1
0
0
9,508
2,894,235
2010-05-24T01:07:00.000
0
0
1
0
0
python,import,modular
0
2,896,137
0
5
0
false
0
0
Alex's answer and the others cover the general case. However, since these modules you're working on are your own and you'll edit only them, it's possible to implement some kind of a local reloading mechanism rather than rely on the builtin reload. You can architect your module loader as something that loads up the fil...
1
2
0
0
scenario: a modular app that loads .py modules on the fly as it works. programmer (me) wishes to edit the code of a module and then re-load it into the program without halting execution. can this be done? i have tried running import a second time on an updated module.py, but the changes are not picked up
how do i edit a running python program?
0
0
1
0
0
325
2,900,358
2010-05-24T21:11:00.000
3
0
1
0
0
python,matlab,mlabwrap
0
2,900,462
0
1
0
true
0
0
Never mind. I found out how. Use mlab.addpath().
1
2
0
0
I tried to use mlab.path(path,'/my/path') but failed. Got NameError: name 'path' is not defined in python. Anyone has an idea?
how to set MATLABPATH in Python and using mlabwrap?
0
1.2
1
0
0
408
2,907,498
2010-05-25T18:43:00.000
0
0
0
0
0
python,metaprogramming
0
2,907,750
0
5
0
false
1
0
SQLalchemy also uses them for declarative database models. Sorry my answer isn't very different from your example, but if you're looking for example code, I found declarative to be pretty readable.
1
13
0
0
I'm learning about metaclasses in Python. I think it is a very powerful technique, and I'm looking for good uses for them. I'd like some feedback of good useful real-world examples of using metaclasses. I'm not looking for example code on how to write a metaclass (there are plenty examples of useless metaclasses out th...
Good real-world uses of metaclasses (e.g. in Python)
0
0
1
0
0
2,053
2,909,423
2010-05-26T00:21:00.000
10
0
1
0
0
python,shell,performance,getattr
0
2,909,510
0
2
0
false
0
0
does getattr have the same problems as eval? No -- code using eval() is terribly annoying to maintain, and can have serious security problems. Calling getattr(x, "foo") is just another way to write x.foo. will I be taking a hit to the efficiency of my shell It will be imperceptibly slower if the command isn't found...
1
10
0
0
I'm creating a shell-like environment. My original method of handleing user input was to use a dictionary mapping commands (strings) to methods of various classes, making use of the fact that functions are first class objects in python. For flexibility's sake (mostly for parsing commands), I'm thinking of changing my s...
Is it bad practice to use python's getattr extensively?
0
1
1
0
0
6,796
2,911,991
2010-05-26T10:16:00.000
1
0
0
0
0
python,pyqt4,qlistview
0
2,912,399
0
2
0
false
0
1
Imho, an easier way to achieve this would be to use a QListWidget instead of a QListView, this way you could use the itemClicked signal, which sends the selected item to the callback function.
1
1
0
0
I have a working QListView, but from the documentation, I can't figure out how to get a signal to fire with the index of the newly selected item. Any ideas?
clicked() signal for QListView in PyQt4
0
0.099668
1
0
0
3,622
2,916,116
2010-05-26T19:30:00.000
1
0
1
0
0
python,argparse
0
2,916,155
0
3
0
false
0
0
It would be best for the user to install it so that only one copy is present on the system and so that it can be updated if there are any issues, but including it with your project is a viable option if you abide by all requirements specified in the license. Try to import it from the public location, and if that fails ...
1
2
0
0
For my project I would be using the argparse library. My question is, how do I distribute it with my project. I am asking this because of the technicalities and legalities involved. Do I just: Put the argparse.py file along with my project. That is, in the tar file for my project. Create a package for it for my distr...
Distributing a Python library (single file)
0
0.066568
1
0
0
228
2,925,230
2010-05-27T21:48:00.000
1
0
1
0
0
python,datetime,time,formatting
0
2,925,269
0
8
0
false
1
0
I know it's pretty cheap, but you could just discard the first character if it's a zero :)
1
29
0
0
I'm still a bit slow with Python, so I haven't got this figured out beyond what's obviously in the docs, etc. I've worked with Django a bit, where they've added some datetime formatting options via template tags, but in regular python code how can I get the 12-hour hour without a leading zero? Is there a straightforw...
Get "2:35pm" instead of "02:35PM" from Python date/time?
0
0.024995
1
0
0
13,086
2,932,007
2010-05-28T19:46:00.000
0
0
0
0
0
python,linux,administration,func
0
3,130,135
0
4
0
false
1
0
It really depends what you're intending to do, as the question is a little vague. The other answers cover the tools available; choosing one over the other comes down to purpose. Are you intending to manage servers, and services on those servers? If so, try Puppet, CFEngine, or some other tool for managing server conf...
1
0
0
0
We're writing a web-based tool to configure our services provided by multiple servers. This includes interfaces configuration, dhcp configs etc. etc. Having configs in database and views that generate proper output, how to send it/make it available for servers? I'm thinking about sending it through scp and invoking rel...
Methods of sending web-generated config files to servers and restarting services
1
0
1
0
1
226
2,935,631
2010-05-29T15:35:00.000
1
0
0
1
0
python,google-app-engine,task-queue
0
2,935,659
0
2
0
true
1
0
The development server won't run tasks automatically, you have to set them off yourself. It's a design feature, so you can see what happens when you run them, instead of them running at any point. Essentially, there's nothing wrong with your application, it's a feature of development server.
1
1
0
0
I was playing with Goole App Engine Task Queue API to learn how to use it. But I couldn't make it trigger locally. My application is working like a charm when I upload to Google servers. But it doesn't trigger locally. All I see from the admin is the list of the tasks. But when their ETA comes, they just pass it. It's ...
Task Queue stopped working
0
1.2
1
0
0
391
2,935,836
2010-05-29T16:46:00.000
1
0
1
1
1
python,multithreading,command-line,ipc,interprocess
0
2,935,858
0
4
0
false
0
0
Perhaps try using sockets for communication?
2
14
0
0
I'd like to prevent multiple instances of the same long-running python command-line script from running at the same time, and I'd like the new instance to be able to send data to the original instance before the new instance commits suicide. How can I do this in a cross-platform way? Specifically, I'd like to enable t...
can a python script know that another instance of the same script is running... and then talk to it?
1
0.049958
1
0
0
3,867
2,935,836
2010-05-29T16:46:00.000
0
0
1
1
1
python,multithreading,command-line,ipc,interprocess
0
2,936,096
0
4
0
false
0
0
Sounds like your best bet is sticking with a pid file but have it not only contain the process Id - have it also include the port number that the prior instance is listening on. So when starting up check for the pid file and if present see if a process with that Id is running - if so send your data to it and quit othe...
2
14
0
0
I'd like to prevent multiple instances of the same long-running python command-line script from running at the same time, and I'd like the new instance to be able to send data to the original instance before the new instance commits suicide. How can I do this in a cross-platform way? Specifically, I'd like to enable t...
can a python script know that another instance of the same script is running... and then talk to it?
1
0
1
0
0
3,867
2,937,619
2010-05-30T05:06:00.000
2
0
0
0
0
python,sql,r,large-files,large-data-volumes
0
2,942,419
0
8
0
false
0
0
When you say "accumulating" then solution (2) looks most suitable to problem. After initial load up to database you only update database with new files (daily, weekly? depends how often you need this). In cases (1) and (3) you need to process files each time (what was stated earlier as most time/resources-consuming), u...
4
32
0
0
I have large amounts of data (a few terabytes) and accumulating... They are contained in many tab-delimited flat text files (each about 30MB). Most of the task involves reading the data and aggregating (summing/averaging + additional transformations) over observations/rows based on a series of predicate statements, and...
large amount of data in many text files - how to process?
0
0.049958
1
1
0
5,360
2,937,619
2010-05-30T05:06:00.000
4
0
0
0
0
python,sql,r,large-files,large-data-volumes
0
2,937,664
0
8
0
false
0
0
With terabytes, you will want to parallelize your reads over many disks anyway; so might as well go straight into Hadoop. Use Pig or Hive to query the data; both have extensive support for user-defined transformations, so you should be able to implement what you need to do using custom code.
4
32
0
0
I have large amounts of data (a few terabytes) and accumulating... They are contained in many tab-delimited flat text files (each about 30MB). Most of the task involves reading the data and aggregating (summing/averaging + additional transformations) over observations/rows based on a series of predicate statements, and...
large amount of data in many text files - how to process?
0
0.099668
1
1
0
5,360
2,937,619
2010-05-30T05:06:00.000
1
0
0
0
0
python,sql,r,large-files,large-data-volumes
0
2,937,660
0
8
0
false
0
0
Yes. You are right! I/O would cost most of your processing time. I don't suggest you to use distributed systems, like hadoop, for this task. Your task could be done in a modest workstation. I am not an Python expert, I think it has support for asynchronous programming. In F#/.Net, the platform has well support for tha...
4
32
0
0
I have large amounts of data (a few terabytes) and accumulating... They are contained in many tab-delimited flat text files (each about 30MB). Most of the task involves reading the data and aggregating (summing/averaging + additional transformations) over observations/rows based on a series of predicate statements, and...
large amount of data in many text files - how to process?
0
0.024995
1
1
0
5,360
2,937,619
2010-05-30T05:06:00.000
14
0
0
0
0
python,sql,r,large-files,large-data-volumes
0
2,937,630
0
8
0
true
0
0
(3) is not necessarily a bad idea -- Python makes it easy to process "CSV" file (and despite the C standing for Comma, tab as a separator is just as easy to handle) and of course gets just about as much bandwidth in I/O ops as any other language. As for other recommendations, numpy, besides fast computation (which you...
4
32
0
0
I have large amounts of data (a few terabytes) and accumulating... They are contained in many tab-delimited flat text files (each about 30MB). Most of the task involves reading the data and aggregating (summing/averaging + additional transformations) over observations/rows based on a series of predicate statements, and...
large amount of data in many text files - how to process?
0
1.2
1
1
0
5,360
2,942,375
2010-05-31T08:47:00.000
0
0
1
0
0
python,arrays,data-structures,dictionary
0
2,943,067
0
2
0
false
0
0
You might try using std::map. Boost.Python provides a Python wrapping for std::map out-of-the-box.
1
3
1
0
I bumped into a case where I need a big (=huge) python dictionary, which turned to be quite memory-consuming. However, since all of the values are of a single type (long) - as well as the keys, I figured I can use python (or numpy, doesn't really matter) array for the values ; and wrap the needed interface (in: x ; ou...
python dictionary with constant value-type
0
0
1
0
0
1,303
2,945,074
2010-05-31T17:30:00.000
0
0
0
0
0
python,networking,communication
0
2,945,291
0
2
0
false
0
0
You could use wireshark from wireshark.org to sniff the network traffic (or any other packet sniffer).
1
2
0
0
lets say you run third party program on your computer whitch create a process named example.exe how do i determinate if this process is running and how many windows does he open? How do i intercept network communication between this windows and server? my goal is to create an app whitch will be monitoring network trafi...
python intercepting communication
0
0
1
0
1
620
2,947,049
2010-06-01T02:54:00.000
6
0
0
0
0
python-imaging-library
0
7,326,477
0
1
0
false
0
0
PIL won't automatically do this, but you could easily do it yourself using the getsize method in the ImageFont module. That is, if the text is too big, just split it so that it's not, and put the rest on the next line. (You may want to do this recursively in case the text spans multiple lines.)
1
2
0
0
i have a word that will be putted on a image but the problem is that the word continues even though the word exceeds the width of the image is there anyway that the word shift's down if the word exceeds the width of the image or on a certain point the word shift's down if it exceeds the given point
python imaging library draw text new line how to?
1
1
1
0
0
1,435
2,961,402
2010-06-02T20:36:00.000
1
0
0
0
0
php,python,django
0
2,961,525
0
4
0
false
1
0
No. You can only do a LOT better. Awesome, popular. Supported by best hosters like Mediatemple. No. You can just change 'mysql' to 'postgresql' or 'sqlite' in your settings.py. NO! Python would never give you the right to mix up everything in one file and make the shittest shit in the world. Templates, static server. ...
2
4
0
0
Here's my background: Decent experience with PHP/MySql. Beginner's experience with OOP Why I want to learn Python Django? I gave in, based on many searches on SO and reading over some of the answers, Python is a great, clean, and structured language to learn. And with the framework Django, it's easier to write codes ...
How to transition from PHP to Python Django?
0
0.049958
1
0
0
3,852
2,961,402
2010-06-02T20:36:00.000
6
0
0
0
0
php,python,django
0
2,961,490
0
4
0
true
1
0
Can i do everything in Django as in PHP? Always Is Django a "big" hit in web development as PHP? Only time will tell. With PHP, PHP and Mysql are VERY closely related, is there a close relation between Django and Mysql? Django supports several RDBMS interfaces. MySQL is popular, so is SQLite and Postgres. In PHP...
2
4
0
0
Here's my background: Decent experience with PHP/MySql. Beginner's experience with OOP Why I want to learn Python Django? I gave in, based on many searches on SO and reading over some of the answers, Python is a great, clean, and structured language to learn. And with the framework Django, it's easier to write codes ...
How to transition from PHP to Python Django?
0
1.2
1
0
0
3,852
2,962,571
2010-06-03T00:28:00.000
13
0
1
0
0
python,graphics,pyopengl
0
2,962,599
0
2
0
true
0
1
With the caveat that I have done very little OpenGL programming myself, I believe that for the purposes of learning, PyOpenGL is a good choice. The main reason is that PyOpenGL, like most other OpenGL wrappers, is just that: a thin wrapper around the OpenGL API. One large benefit of PyOpenGL is that while in C you ha...
2
9
0
0
I want to start learning OpenGL but I don't really want to have to learn another language to do it. I already am pretty proficient in python and enjoy the language. I just want to know how close it is to the regular api? Will I be able to pretty easily follow tutorials and books without too much trouble? I know C++ giv...
Is PyOpenGL a good place to start learning opengl programming?
0
1.2
1
0
0
3,573
2,962,571
2010-06-03T00:28:00.000
0
0
1
0
0
python,graphics,pyopengl
0
2,963,034
0
2
0
false
0
1
PyOpenGL I don't think it is a good choice. In my opinon in C/C++ it is easier to play around around with your OpenGL code - start with simple app, then add shader, then add some geometry functions, make a texture/geometry generator, build scene via CSG, etc. You know - to have fun, play around with code, experiment a...
2
9
0
0
I want to start learning OpenGL but I don't really want to have to learn another language to do it. I already am pretty proficient in python and enjoy the language. I just want to know how close it is to the regular api? Will I be able to pretty easily follow tutorials and books without too much trouble? I know C++ giv...
Is PyOpenGL a good place to start learning opengl programming?
0
0
1
0
0
3,573
2,966,618
2010-06-03T13:57:00.000
1
1
0
1
0
c++,python,code-generation
0
2,966,999
0
8
0
false
0
0
A few years ago I worked on a project to simplify interprocess shared memory management for large scale simulation systems. We used a related approach where the layout of data in shared memory was defined in XML files and a code generator, written in python, read the XML and spit out a set of header files defining stru...
1
12
0
0
Can anyone point me to some documentation on how to write scripts in Python (or Perl or any other Linux friendly script language) that generate C++ code from XML or py files from the command line. I'd like to be able to write up some xml files and then run a shell command that reads these files and generates .h files ...
C++ code generation with Python
0
0.024995
1
0
0
23,299
2,970,207
2010-06-03T22:20:00.000
2
0
0
0
1
python,string,image,opencv,byte
1
2,980,849
0
2
0
false
0
1
I actually solved this problem and forgot to post the solution. Here's how I did it, though it may not be entirely robust: I analyzed the headers coming from the MJPEG of the network camera I was doing this to, then I just read from the stream 1 byte at a time, and, when I detected that the header of the next image was...
1
3
0
0
I am streaming some data down from a webcam. When I get all of the bytes for a full image (in a string called byteString) I want to display the image using OpenCV. Done fast enough, this will "stream" video from the webcam to an OpenCV window. Here's what I've done to set up the window: cvNamedWindow('name of window', ...
from string of bytes to OpenCV's IplImage in Python?
0
0.197375
1
0
0
1,712
2,975,473
2010-06-04T15:19:00.000
2
0
1
0
0
python,import,cross-platform
0
2,975,495
0
1
1
true
0
0
You use import to include the function in other programs. Just say import mymodule where the code is located in file mymodule.py. Then say mymodule.fib to use the function. To answer your second question: The syntax print "any string" is acceptable in Python 2, but is no longer allowed in Python 3.
1
0
0
0
i've a small user defined function in python, say fib(n), how do i use that in other programs or modules? def fib(n): should i use import or is there any other feature? Also i'm learning python in eclipse IDE, it wont support print "any string" but i'm forced to use like, print("string") in python manual online, it...
include udf in python?
1
1.2
1
0
0
136
2,977,779
2010-06-04T21:01:00.000
1
0
0
0
0
python,xml
0
2,977,799
0
2
1
false
0
0
The safest way to add nodes to an XML document is to load it into a DOM, add the nodes programmatically and write it out again. There are several Python XML libraries. I have used minidom, but I have no reason to recommend it specifically over the others.
1
4
0
0
I wonder if it is better add an element by opening file, search 'good place' and add string which contains xml code. Or use some library... i have no idea. I know how can i get nodes and properties from xml through for example lxml but what's the simpliest and the best way to add?
add xml node to xml file with python
0
0.099668
1
0
1
4,733
2,979,697
2010-06-05T08:31:00.000
0
0
0
0
0
python,geometry,tkinter
0
2,979,705
0
4
0
false
0
1
I'd start with identifying the concentrations of the spots in the plane. Find the centers of those agglomerations and assign them each unique color. Then for other spots you could simply calculate the color using the linear principle. For example, if one center is red and the other is yellow, a point somewhere in the m...
2
4
0
0
I have a dense set of points in the plane. I want them colored so that points that are close to each other have the same color, and a different color if they're far away. For simplicity assume that there are, say, 5 different colors to choose from. Turns out I've not the slightest idea how to do that .. I'm using Tkint...
Coloring close points
0
0
1
0
0
270
2,979,697
2010-06-05T08:31:00.000
0
0
0
0
0
python,geometry,tkinter
0
2,979,707
0
4
0
false
0
1
One approach is to go through your points and partition them into sets with a "center". Since you have 5 colours, you'll have 5 sets. You compare the distance of the new point from each of the centers and then put it in the same group as the closest one. Each set corresponds to a different colour so you can just plot i...
2
4
0
0
I have a dense set of points in the plane. I want them colored so that points that are close to each other have the same color, and a different color if they're far away. For simplicity assume that there are, say, 5 different colors to choose from. Turns out I've not the slightest idea how to do that .. I'm using Tkint...
Coloring close points
0
0
1
0
0
270
2,985,678
2010-06-06T19:53:00.000
1
0
1
0
0
python,xlwt,pyexcelerator
0
2,985,689
0
4
0
false
0
0
The 00.0% number format expects percentages, so multiplying by 100 to display it is the correct behavior. To get the results you want, you could either put the data in the cell as a string in whatever format you choose or you could divide by 100.0 before you store the value in the cell.
2
2
0
0
just a quick question, how to add percent sign to numbers without modifying number. I have tried format percent with myStyleFont.num_format_str = '0.00%' but it multiplies with 100 but I need just to append percent. Ty in advance. Regards.
Adding percentage in python - xlwt / pyexcelerator
0
0.049958
1
0
0
5,708
2,985,678
2010-06-06T19:53:00.000
5
0
1
0
0
python,xlwt,pyexcelerator
0
2,986,184
0
4
0
true
0
0
Note carefully: "modifying" and "multiplies with 100" affect the displayed result, they affect neither the value stored in the file nor the value used in formula calculations. The technique of making an operator be treated as a literal is known as "escaping". The escape character in Excel number format strings is the ...
2
2
0
0
just a quick question, how to add percent sign to numbers without modifying number. I have tried format percent with myStyleFont.num_format_str = '0.00%' but it multiplies with 100 but I need just to append percent. Ty in advance. Regards.
Adding percentage in python - xlwt / pyexcelerator
0
1.2
1
0
0
5,708
2,986,766
2010-06-07T02:24:00.000
1
0
0
1
0
python,google-app-engine,openid,integration
0
2,988,807
0
1
1
false
1
0
I understand your question. You wish to be able to maintain a list of users that have signed up with your service, and also want to record users using OpenID to authenticate. In order to solve this I would do either of the following: Create a new user in your users table for each new user logged in under OpenID, and s...
1
0
0
0
how to integration local user and openid(or facebook twitter) user , did you know some framework have already done this , updated my mean is : how to deal with 'local user' and 'openid user', and how to mix them in one model . please give me a framework that realize 'local user' and 'openid user'
what should i do after openid (or twitter ,facebook) user login my site ,on gae
0
0.197375
1
0
0
264
2,988,211
2010-06-07T09:11:00.000
1
0
1
0
0
python,file-io,character
0
2,988,272
0
14
0
false
0
0
You should try f.read(1), which is definitely correct and the right thing to do.
1
90
0
0
Can anyone tell me how can I do this?
How to read a single character at a time from a file in Python?
0
0.014285
1
0
0
190,751
3,002,999
2010-06-09T03:55:00.000
23
0
0
1
0
python,google-app-engine,google-cloud-datastore
0
3,003,170
0
2
0
true
1
0
Assign each entity a random number and store it in the entity. Then query for ten records whose random number is greater than (or less than) some other random number. This isn't totally random, however, since entities with nearby random numbers will tend to show up together. If you want to beat this, do ten queries bas...
1
21
0
0
I have a datastore with around 1,000,000 entities in a model. I want to fetch 10 random entities from this. I am not sure how to do this? can someone help?
Fetching a random record from the Google App Engine Datastore?
0
1.2
1
0
0
5,002
3,005,522
2010-06-09T11:54:00.000
4
0
0
0
0
python,clipboard,pygtk,monitor
0
3,010,018
0
1
0
true
0
1
Without a proper notification API, such as WM_DrawClipboard messages, you would probably have to resort to a polling loop. And then you will cause major conflicts with other apps that are trying to use this shared resource. Do not resort to a polling loop.
1
6
0
0
How can I make a simple clipboard monitor in Python using the PyGTK GUI? I found gtk.clipboard class and but I couldn't find any solution to get the "signals" to trigger the event when the clipboard content has changed. Any ideas?
PyGTK: how to make a clipboard monitor?
0
1.2
1
0
0
1,505
3,006,769
2010-06-09T14:28:00.000
3
1
1
0
0
python,optimization
0
3,006,810
0
5
1
false
0
0
As a general strategy, it's best to keep this data in an in-memory cache if it's static, and relatively small. Then, the 10k calls will read an in-memory cache rather than a file. Much faster. If you are modifying the data, the alternative might be a database like SQLite, or embedded MS SQL Server (and there are others...
4
1
0
0
in my program i have a method which requires about 4 files to be open each time it is called,as i require to take some data.all this data from the file i have been storing in list for manupalation. I approximatily need to call this method about 10,000 times.which is making my program very slow? any method for handling ...
how to speed up the code?
1
0.119427
1
0
0
209
3,006,769
2010-06-09T14:28:00.000
2
1
1
0
0
python,optimization
0
3,006,800
0
5
1
false
0
0
Opening, closing, and reading a file 10,000 times is always going to be slow. Can you open the file once, do 10,000 operations on the list, then close the file once?
4
1
0
0
in my program i have a method which requires about 4 files to be open each time it is called,as i require to take some data.all this data from the file i have been storing in list for manupalation. I approximatily need to call this method about 10,000 times.which is making my program very slow? any method for handling ...
how to speed up the code?
1
0.07983
1
0
0
209
3,006,769
2010-06-09T14:28:00.000
0
1
1
0
0
python,optimization
0
3,006,875
0
5
1
false
0
0
Call the open to the file from the calling method of the one you want to run. Pass the data as parameters to the method
4
1
0
0
in my program i have a method which requires about 4 files to be open each time it is called,as i require to take some data.all this data from the file i have been storing in list for manupalation. I approximatily need to call this method about 10,000 times.which is making my program very slow? any method for handling ...
how to speed up the code?
1
0
1
0
0
209
3,006,769
2010-06-09T14:28:00.000
0
1
1
0
0
python,optimization
0
3,006,895
0
5
1
false
0
0
If the files are structured, kinda configuration files, it might be good to use ConfigParser library, else if you have other structural format then I think it would be better to store all this data in JSON or XML and perform any necessary operations on your data
4
1
0
0
in my program i have a method which requires about 4 files to be open each time it is called,as i require to take some data.all this data from the file i have been storing in list for manupalation. I approximatily need to call this method about 10,000 times.which is making my program very slow? any method for handling ...
how to speed up the code?
1
0
1
0
0
209
3,007,678
2010-06-09T16:11:00.000
2
1
1
0
0
python,optimization
0
3,008,037
0
4
0
false
0
0
So it seems you don't want to speed up the compile but want to speed up the execution. If that is the case, my mantra is "do less." Save off results and keep them around, don't re-read the same file(s) over and over again. Read a lot of data out of the file at once and work with it. On files specifically, your perfor...
1
0
0
0
i want to speed my code compilation..I have searched the internet and heard that psyco is a very tool to improve the speed.i have searched but could get a site for download. i have installed any additional libraries or modules till date in my python.. can psyco user,tell where we can download the psyco and its installa...
how to speed up code?
0
0.099668
1
0
0
1,091
3,012,661
2010-06-10T08:07:00.000
0
0
0
1
0
python,google-app-engine,audio,chat
0
3,020,384
0
4
0
false
1
0
You'll need two things: A browser plugin to get audio. You could build this on top of eg. http://code.google.com/p/libjingle/'>libjingle which has the advantage of being cross-platform and allowing P2P communication, not to mention being able to talk to arbitrary other XMPP endoints. Or you could use Flash to grab the ...
3
0
0
0
i want to make a chat room on gae ,(audio chat) has any framework to do this ? thanks
how to make a chat room on gae ,has any audio python-framework to do this?
0
0
1
0
0
749
3,012,661
2010-06-10T08:07:00.000
1
0
0
1
0
python,google-app-engine,audio,chat
0
3,080,160
0
4
0
false
1
0
Try Adobe Stratus (it works with p2p connections) and you could use Google App Engine only for exchanging peer ids.
3
0
0
0
i want to make a chat room on gae ,(audio chat) has any framework to do this ? thanks
how to make a chat room on gae ,has any audio python-framework to do this?
0
0.049958
1
0
0
749
3,012,661
2010-06-10T08:07:00.000
1
0
0
1
0
python,google-app-engine,audio,chat
0
3,013,054
0
4
0
true
1
0
App Engine doesn't directly support audio chat of any sort, and since it's based around a request-response system with (primarily) HTTP requests, you can't implement it yourself.
3
0
0
0
i want to make a chat room on gae ,(audio chat) has any framework to do this ? thanks
how to make a chat room on gae ,has any audio python-framework to do this?
0
1.2
1
0
0
749
3,013,134
2010-06-10T09:21:00.000
2
0
0
0
0
python,linux,pdf,merge,jpeg
0
3,013,162
0
1
0
false
1
0
Not exactly knowing what you mean my sequence - ImageMagick, esp. its 'montage' is probably the tool you need. IM has python interface, too, altough I have never used it. EDIT: As after your edit I do not get the point of this any more, I cannot recommend anything, either. :(
1
1
0
0
im doing a project as part of academic programme.Im doing this in linux platform.here i wanted to create a application which retrieve some information from some pdf files .for eg i have pdfs of subject2,subject1,in both the whole pdf is divided in to 4 modules and i want to get the data of module 1 from pdf..for this ...
Sequence and merge jpeg images using Python?
0
0.379949
1
0
0
634
3,014,686
2010-06-10T13:19:00.000
0
1
0
1
0
python,testing,sockets,wrapper
0
3,019,494
0
2
0
false
0
0
Another option is to mock the socket module before importing the asyncore module. Of course, then you have to make sure that the mock works properly first.
1
0
0
0
I am looking for a way of programmatically testing a script written with the asyncore Python module. My test consists of launching the script in question -- if a TCP listen socket is opened, the test passes. Otherwise, if the script dies before getting to that point, the test fails. The purpose of this is knowing if a ...
How can I build a wrapper to wait for listening on a port?
0
0
1
0
1
838
3,015,874
2010-06-10T15:31:00.000
0
0
1
0
0
python,stage,fast-esp
0
3,421,127
0
2
0
true
1
0
The FAST documentation (ESP Document Processor Integration Guide) has a pretty good example of how to write a custom document processor. FAST does not provide the source code to any of it's software, but the AttributeFilter stage functionality should be very straightforward.
2
0
0
0
I am working on Enterprise Search and we are using Fast ESP and for now i have 4 projects but i have no information about stages and python. But i realize that i have learn custom stage development. Because we have a lot of difficulties about document processing. I want to know how can i develop custom stage and especi...
Fast Esp Custom Stage Development
0
1.2
1
0
0
816
3,015,874
2010-06-10T15:31:00.000
0
0
1
0
0
python,stage,fast-esp
0
47,027,134
0
2
0
false
1
0
I had worked with FAST ESP for document processing and we used to modify the python files. you can modify them but you need to restart the document processor each time you modify any file. You need to search for document processing in the admin UI, there you go to the pipelines, and you can create a custom pipeline bas...
2
0
0
0
I am working on Enterprise Search and we are using Fast ESP and for now i have 4 projects but i have no information about stages and python. But i realize that i have learn custom stage development. Because we have a lot of difficulties about document processing. I want to know how can i develop custom stage and especi...
Fast Esp Custom Stage Development
0
0
1
0
0
816
3,020,267
2010-06-11T04:53:00.000
2
0
0
1
0
python,perl,scripting,cross-platform,shebang
0
3,020,285
0
4
0
false
0
0
The shebang line will be interpreted as a comment by Perl or Python. The only thing that assigns it a special meaning is the UNIX/Linux shell; it gets ignored on Windows. The way Windows knows which interpreter to use to run the file is through the file associations in the registry, a different mechanism altogether.
2
11
0
0
I was wondering how to make a python script portable to both linux and windows? One problem I see is shebang. How to write the shebang so that the script can be run on both windows and linux? Are there other problems besides shebang that I should know? Is the solution same for perl script? Thanks and regards!
how to make a python or perl script portable to both linux and windows?
0
0.099668
1
0
0
5,770
3,020,267
2010-06-11T04:53:00.000
14
0
0
1
0
python,perl,scripting,cross-platform,shebang
0
3,020,286
0
4
0
true
0
0
Windows will just ignore the shebang (which is, after all, a comment); in Windows you need to associate the .py extension to the Python executable in the registry, but you can perfectly well leave the shebang on, it will be perfectly innocuous there. There are many bits and pieces which are platform-specific (many only...
2
11
0
0
I was wondering how to make a python script portable to both linux and windows? One problem I see is shebang. How to write the shebang so that the script can be run on both windows and linux? Are there other problems besides shebang that I should know? Is the solution same for perl script? Thanks and regards!
how to make a python or perl script portable to both linux and windows?
0
1.2
1
0
0
5,770
3,020,979
2010-06-11T07:35:00.000
1
0
0
0
0
python,xml,http
0
3,021,000
0
2
0
false
0
0
You can achieve that through a standard http post request.
1
7
0
0
how can i send an xml file on my system to an http server using python standard library??
send xml file to http using python
0
0.099668
1
0
1
5,264
3,024,191
2010-06-11T15:44:00.000
1
0
0
0
0
python,session,e-commerce,web.py
0
3,024,470
0
1
0
false
1
0
If very much depends on your system ofcourse. But personally I always try to merge the data and immediately store it in the same way as it would be stored as when the user would be logged in. So if you store it in a session for an anonymous user and in the database for any authenticated user. Just merge all data as soo...
1
0
0
0
This is a general question, or perhaps a request for pointers to other open source projects to look at: I'm wondering how people merge an anonymous user's session data into the authenticated user data when a user logs in. For example, someone is browsing around your websites saving various items as favourites. He's not...
How to merge or copy anonymous session data into user data when user logs in?
0
0.197375
1
0
0
140
3,028,561
2010-06-12T11:52:00.000
1
0
1
0
0
python
0
3,028,597
0
1
0
true
0
0
Yes, just do setup.py install again.
1
2
0
0
I have downloaded and install a python library, via setup.py , python2.5 setup.py install ... now the version is changed at the source . a newer library is available. originally , i have clone it via mercurial, and install it. right now , i have updated repository. how do i use the newer version ? overwrite the instal...
Newbie : installing and upgrading python module
1
1.2
1
0
0
122
3,031,483
2010-06-13T07:47:00.000
2
0
0
0
1
python,django
1
3,031,565
0
2
0
true
1
0
Something else to remember: You need to maintain a browser session with the remote site so that site knows which CAPTCHA you're trying to solve. Lots of webclients allow you to store your cookies and I'd suggest you dump them in the Django Session of the user you're doing the screen scraping for. Then load them back up...
2
1
0
0
I have a tricky Django problem which didn't occur to me when I was developing it. My Django application allows a user to sign up and store his login credentials for a sites. The Django application basically allows the user to search this other site (by scraping content off it) and returns the result to the user. For ea...
Raising events and object persistence in Django
0
1.2
1
0
0
267
3,031,483
2010-06-13T07:47:00.000
0
0
0
0
1
python,django
1
6,689,964
0
2
0
false
1
0
request.session['name'] = variable will store it then, variable = request.session['name'] will retrieve it. Remember though, its not a database, just a simple session store and shouldn't be relied on for anything critical
2
1
0
0
I have a tricky Django problem which didn't occur to me when I was developing it. My Django application allows a user to sign up and store his login credentials for a sites. The Django application basically allows the user to search this other site (by scraping content off it) and returns the result to the user. For ea...
Raising events and object persistence in Django
0
0
1
0
0
267
3,032,378
2010-06-13T13:29:00.000
0
0
0
1
0
python
0
3,032,409
0
2
0
false
0
0
Well here is an idea... place a status somewhere else, that can be polled/queried. when the process starts, post the 'running' status. have the script check here to see if the process is running. I would also use a seperate place to post control values. e.g. set a value to the 'control set' and have the process lo...
2
0
0
0
I want a script to start and interact with a long running process. The process is started first time the script is executed, after that the script can be executed repeatedly, but will detect that the process is already running. The script should be able to interact with the process. I would like this to work on Unix an...
Detecting and interacting with long running process
1
0
1
0
0
317
3,032,378
2010-06-13T13:29:00.000
2
0
0
1
0
python
0
3,032,536
0
2
0
true
0
0
Sockets are easier to make portable between Windows and any other OS, so that's what I would recommend it over named pipes (that's why e.g. IDLE uses sockets rather than named pipes -- the latter require platform-dependent code on Windows, e.g. via ctypes [[or third-party win32all or cython &c]], while sockets just wor...
2
0
0
0
I want a script to start and interact with a long running process. The process is started first time the script is executed, after that the script can be executed repeatedly, but will detect that the process is already running. The script should be able to interact with the process. I would like this to work on Unix an...
Detecting and interacting with long running process
1
1.2
1
0
0
317
3,034,304
2010-06-13T23:32:00.000
0
0
1
0
1
python,macos,installation
0
3,034,631
0
2
0
false
0
0
You should be able to delete the packages you've installed from /Library/Python/2.*/site-packages/. I do not think any package installers will install by default to /System/Library, which should save you from needing to remove Python itself. That said, you could also use virtualenv with --no-site-packages, and just ign...
1
3
0
0
I was wondering if anyone had tips on how to completely remove a python installation form Mac OSX (10.5.8) ... including virtual environments and its related binaries. Over the past few years I've completely messed up the installed site-packages, virtual-environments, etc. and the only way I can see to fix it is to ju...
Removing python and then re-installing on Mac OSX
0
0
1
0
0
6,935
3,035,152
2010-06-14T05:41:00.000
0
0
1
0
0
python,zope.interface
1
3,035,237
0
2
0
true
0
0
vcvarsall.bat is a batch file that comes with MSVC. Make sure that it is in your %PATH%.
1
2
0
0
During setup, I'm like missing vcvarsall.bat running build running build_py running build_ext building '_zope_interface_coptimizations' extension error: Unable to find vcvarsall.bat
how do i install zope interface with python 2.6?
0
1.2
1
0
0
1,515
3,036,680
2010-06-14T11:05:00.000
0
0
0
0
0
python,django,django-admin
0
3,052,792
0
4
0
false
1
0
Well, that's how I've done it. I made custom admin template "change_list.html". Custom template tag creates a list of all existing galleries. Filtering is made like this: class PhotoAdmin(admin.ModelAdmin): ... def queryset(self, request): if request.COOKIES.has_key("gallery"): gallery = Ga...
1
1
0
0
There's photologue application, simple photo gallery for django, implementing Photo and Gallery objects. Gallery object has ManyToMany field, which references Photo objects. I need to be able to get list of all Photos for a given Gallery. Is it possible to add Gallery filter to Photo's admin page? If it's possible, ho...
Django admin, filter objects by ManyToMany reference
1
0
1
0
0
2,800
3,037,273
2010-06-14T12:44:00.000
2
0
0
0
1
python,django,django-orm
0
42,020,136
0
3
0
false
1
0
Count Works on RawQuerySet ModelName.objects.raw("select 1 as id , COUNT(*) from modelnames_modelname")
1
10
0
0
I'm using a raw query and i'm having trouble finding out how to get the number of results it returns. Is there a way? edit .count() doesnt work. it returns: 'RawQuerySet' object has no attribute 'count'
Get number of results from Django's raw() query function
0
0.132549
1
0
0
10,644
3,042,304
2010-06-15T03:15:00.000
1
1
0
1
0
python,unix,permissions
1
3,042,340
0
3
0
false
0
0
os.getgid() and os.getuid() can be useful. For other environment variables, look into os.getenv. For example, os.getenv('USER') on my Mac OS X returns the username. os.getenv('USERNAME') would return the username on Windows machines.
1
31
0
0
I have a CGI script that is getting an "IOError: [Errno 13] Permission denied" error in the stack trace in the web server's error log. As part of debugging this problem, I'd like to add a little bit of code to the script to print the user and (especially) group that the script is running as, into the error log (presuma...
How to determine what user and group a Python script is running as?
0
0.066568
1
0
0
29,300
3,045,745
2010-06-15T13:49:00.000
15
0
1
0
0
python,qt
0
3,045,754
0
3
0
false
0
1
Qt (ideally) provides source compatibility, not binary compatibility. You still have to compile the application separately for each platform, and use the appropriate dynamic Qt libraries (which also need to be compiled separately, and have some platform-specific code). For your final question, the user would need Py...
1
13
0
0
When you write an application using Qt, can it just be run right away in different operating systems? And (correct me if I'm wrong) you don't need to have Qt already installed in all of the different platforms where you want to execute your application? How exactly does this work? Does Qt compile to the desired platfor...
How does Qt work (exactly)?
1
1
1
0
0
3,747
3,046,036
2010-06-15T14:19:00.000
0
0
0
0
0
python,django,sites
0
8,602,597
0
2
0
false
1
0
The django site framework will do that, but it can't server the site according to the domain name. You'll have to do that using you server such as Apache, Nginx, etc.
1
1
0
0
I need to create an application for the company where I can create sites dynamically. For example, I need an admin interface (Django's admin is enough) where I can setup a new site and add some settings to it. Each site must hold a domain (domains can be manually added to apache conf, but if Django can handle it too wo...
Django: how to create sites dynamically?
0
0
1
0
0
737
3,046,183
2010-06-15T14:37:00.000
4
0
1
1
0
python,macos,terminal
0
3,046,210
0
3
0
false
0
0
When you run python in a shell or command prompt it will execute the first executable file which is found in your PATH environment variable. To find out what file is being executed use which python or where python.
1
1
0
0
When I enter in python in Terminal it loads up Python 2.6.2. However there are folders by the name of Python 2.6 in different places on my drive. I'm not sure if that's because Python 2.6 has been installed in different places or because Python just likes to have lots of folers in different places. If there are multipl...
I suspect I have multiple version of Python 2.6 installed on Mac OS X 10.6.3; how do I set which one Terminal should launch?
0
0.26052
1
0
0
1,464
3,050,477
2010-06-16T03:07:00.000
0
0
0
0
0
javascript,python
0
3,051,343
0
1
0
true
1
0
It can work like this: on air ticket booking system you have a html form pointing on certain airline booking website (by action parameter). If user submits data then data lands on airline booking website and this website proceed the request. Usuallly people want to get back to the first site. This can be done by sendin...
1
0
0
0
just wonder how those air ticket booking website redirect the user to the airline booking website and then fill up(i suppose doing POST) the required information so that the users will land on the booking page with origin/destination/date selected? Is the technique used is to open up new browser window and do a ajax PO...
redirection follow by post
0
1.2
1
0
1
81
3,050,512
2010-06-16T03:18:00.000
10
0
1
1
0
python,ubuntu,installation,gnu,configure
0
3,050,521
0
4
0
true
0
0
When you install from source, by default, the installation goes in /usr/local -- the executable in particular becomes /usr/local/bin/pythonX.Y with a symlink to it that's named /usr/local/python. Ubuntu's own installation is in /usr/ (e.g., /usr/bin/python), so the new installation won't overwrite it. Take care that t...
1
8
0
0
Background: I am using Ubuntu The newer python version is not in the apt-get repository (or synaptic) I plan on keeping the old version as the default python when you call "python" from the command line I plan on calling the new python using pythonX.X (X.X is the new version). Given the background, how do you install...
On Ubuntu, how do you install a newer version of python and keep the older python version?
0
1.2
1
0
0
11,229
3,053,923
2010-06-16T14:01:00.000
1
0
0
0
0
python,django,cookies,django-authentication
0
3,054,422
0
1
0
true
1
0
I think you should be able to access this via request.session.session_key
1
0
0
0
In case of views that contain login or logout, this sessionid is different from the one submitted in request's Coockie header. I need to retrieve it before returning response for some purpose. How can I do this ?
Django : In a view how do I obtain the sessionid which will be part of the Set-Cookie header of following response?
0
1.2
1
0
0
501
3,057,805
2010-06-16T23:04:00.000
0
0
1
0
0
python,shell,command-line-interface
0
3,057,864
0
3
0
false
0
0
You just need to stick something like this on the first line: #/usr/local/bin/python Just make yours be wherever your python binary is located. As for args look at getopt or optparser And remember to chmod your file to make it executable.
1
3
0
0
If possible I would like to use the following structure for a command however I can't seem to figure out how to achieve this in Python: ./somescript.py arg <optional argument> -- "some long argument" Would it be possible to achieve this in a feasible manner without too much dirty code? Or should I just reconsider the s...
Python CLI tool - general parsing question
1
0
1
0
0
236
3,066,438
2010-06-18T00:05:00.000
1
0
1
1
0
python,login,restart,boot
0
3,066,480
0
3
0
true
0
0
I can't think of any way to do strictly what you want off the top of my head other than the registry, at least not without even more drastic measures. But doing this registry modification isn't a big deal; just change the autologon username/password and reboot the computer. To have the computer reboot when the user log...
2
1
0
0
I know how to reboot machines remotely, so that's the easy part. However, the complexity of the issue is trying to setup the following. I'd like to control machines on a network for after-hours use such that when users logoff and go home, or shutdown their computers, whatever, python or some combination of python + win...
Reboot windows machines at a certain time of day and automatically login with Python
0
1.2
1
0
0
1,489
3,066,438
2010-06-18T00:05:00.000
0
0
1
1
0
python,login,restart,boot
0
3,076,111
0
3
0
false
0
0
Thanks for the responses. To be more clear on what I'm doing, I have a program that automatically starts on bootup, so getting logged in would be preferred. I'm coding a manager for a render-farm for work which will take all the machines that our guys use during the day and turn them into render servers at night (or wh...
2
1
0
0
I know how to reboot machines remotely, so that's the easy part. However, the complexity of the issue is trying to setup the following. I'd like to control machines on a network for after-hours use such that when users logoff and go home, or shutdown their computers, whatever, python or some combination of python + win...
Reboot windows machines at a certain time of day and automatically login with Python
0
0
1
0
0
1,489
3,072,934
2010-06-18T20:43:00.000
0
0
0
1
1
python,linux,bonjour,zeroconf,chatbot
0
3,072,977
0
2
0
false
0
0
The easiest thing to do is to use Telepathy Salut or Pidgin/libpurple, and talk with it over D-Bus.
1
0
0
0
I am trying to set up a Bonjour (or Ahavi) chatbot for our helpdesk system that would answer basic questions based on a menu system. The basis of my question is how do I get python to create the bot so that it connects to the network as a chat client. Basically, anyone on my network with iChat or Empathy (or any chat p...
ZeroConf Chat with Python
0
0
1
0
0
1,923
3,074,103
2010-06-19T02:38:00.000
0
1
0
0
0
php,javascript,python
0
3,074,113
0
6
1
false
1
0
Looking at your tags, web games are mostly client side, and since you aren't going to use flash, i would say JavaScript would work for 2D. With all the libraries and plug-ins out there, JavaScript can actually handle it.
4
6
0
0
I'm a basic web developer. I know PHP, a little bit of Python and Ruby. JavaScript as well [some stuff]. I'm not a hardcore developer. I know what it takes do develop most of web cases. Now, I have this desire to go deeper and start developing games. I know it sounds a huge leap, but that is why I'm asking here. I alre...
From the web to games
0
0
1
0
0
471
3,074,103
2010-06-19T02:38:00.000
0
1
0
0
0
php,javascript,python
0
3,074,138
0
6
1
false
1
0
Taking a look at OpenGL may not be a terrible idea. You can use the library in many languages, and is supported with in HTML5 (WebGL). There are several excellent tutorials out there.
4
6
0
0
I'm a basic web developer. I know PHP, a little bit of Python and Ruby. JavaScript as well [some stuff]. I'm not a hardcore developer. I know what it takes do develop most of web cases. Now, I have this desire to go deeper and start developing games. I know it sounds a huge leap, but that is why I'm asking here. I alre...
From the web to games
0
0
1
0
0
471
3,074,103
2010-06-19T02:38:00.000
0
1
0
0
0
php,javascript,python
0
3,074,736
0
6
1
false
1
0
If you want to learn more Python while doing so, you may want to take PyGame or an equivalent program. PHP, Ruby and JavaScript aren't going to help you in the video game section, though. They're all related to the internet. If you want to start of real easy, try out Genesis3D. you can make awesome 3D FPS games, and i...
4
6
0
0
I'm a basic web developer. I know PHP, a little bit of Python and Ruby. JavaScript as well [some stuff]. I'm not a hardcore developer. I know what it takes do develop most of web cases. Now, I have this desire to go deeper and start developing games. I know it sounds a huge leap, but that is why I'm asking here. I alre...
From the web to games
0
0
1
0
0
471
3,074,103
2010-06-19T02:38:00.000
3
1
0
0
0
php,javascript,python
0
3,075,334
0
6
1
false
1
0
Python's Pygame is certainly a good choice as others have said. If you want to get in to deep video game programming though.. move on to something like C++ or another lower level language.. from experience, most higher level languages tend to put artificial hurdles up in regards to decent video games. Though for a simp...
4
6
0
0
I'm a basic web developer. I know PHP, a little bit of Python and Ruby. JavaScript as well [some stuff]. I'm not a hardcore developer. I know what it takes do develop most of web cases. Now, I have this desire to go deeper and start developing games. I know it sounds a huge leap, but that is why I'm asking here. I alre...
From the web to games
0
0.099668
1
0
0
471
3,077,156
2010-06-19T20:38:00.000
4
0
0
1
0
python,google-app-engine,gql
0
3,078,018
0
3
0
false
1
0
An object has a Key, part of which is either an automatically-generated numeric ID, or an assigned key name. IDs are not guaranteed to be increasing, and they're almost never going to be consecutive because they're allocated to an instance in big chunks, and IDs unused by the instance to which they're allocated will n...
2
1
0
0
I currently work with Google's AppEngine and I could not find out, whether a Google DataStorage Object Entry has an ID by default, and if not, how I add such a field and let it increase automatically? regards,
Does GQL automatically add an "ID" Property
0
0.26052
1
1
0
282
3,077,156
2010-06-19T20:38:00.000
3
0
0
1
0
python,google-app-engine,gql
0
3,077,170
0
3
0
true
1
0
Yes, they have id's by default, and it is named ID as you mentioned.
2
1
0
0
I currently work with Google's AppEngine and I could not find out, whether a Google DataStorage Object Entry has an ID by default, and if not, how I add such a field and let it increase automatically? regards,
Does GQL automatically add an "ID" Property
0
1.2
1
1
0
282
3,079,368
2010-06-20T13:24:00.000
0
0
0
0
0
python,ruby,django,haml
0
3,144,408
0
4
0
false
1
0
While this could end up being more trouble than it is worth, it is PROBABLY possible to leverage the Java or .NET platform and still run your Django application in Jython or IronPython (with some minor adjustments I'm sure) and also be able to leverage Ruby's HAML gem via jRuby or IronRuby. I'm sure there will be some ...
2
19
0
0
Ok, so I really love HAML. Particularly, I love the integration with RedCloth and BlueCloth, so I can use Markdown and Textile intermixed with my HAML. I also love Python and Django. So, I would like to use HAML with Django. Now, I already understand that there are some attempts at cloning HAML-like syntax in Python ...
Ruby HAML with Django?
0
0
1
0
0
3,831
3,079,368
2010-06-20T13:24:00.000
1
0
0
0
0
python,ruby,django,haml
0
7,147,104
0
4
0
false
1
0
I strongly recommend that you do not fork any processes out of your django views, because the overhead is significant. You should have a persistent ruby process to serve your templates for you, and invoke it from your django code. I leave the IPC technology to you, but the obvious choices would either be some kind of ...
2
19
0
0
Ok, so I really love HAML. Particularly, I love the integration with RedCloth and BlueCloth, so I can use Markdown and Textile intermixed with my HAML. I also love Python and Django. So, I would like to use HAML with Django. Now, I already understand that there are some attempts at cloning HAML-like syntax in Python ...
Ruby HAML with Django?
0
0.049958
1
0
0
3,831
3,081,749
2010-06-21T02:05:00.000
0
0
0
0
0
python,tkinter
0
3,084,235
0
1
0
false
0
0
Every object in a canvas has an id. You can reference that object by that id to delete it, modify it, move it, etc. Objects can also have one or more tags. A tag can be associated with a single object, in which case it is just another name for that object. For example, if you draw a red rectangle and a blue rectangle, ...
1
1
0
0
i tried to figure out what tags were in canvas however i am having a hard time understanding it. can someone explain what tags do and how to use them in canvas when using python.
can someone help me with tags in canvas?
0
0
1
0
0
186
3,083,167
2010-06-21T08:47:00.000
0
1
1
0
0
c#,python,cpython
0
3,083,261
0
1
0
true
0
1
If you need strict CPython behavior and do not want to change Python program I am afraid that in this case you should spawn separate CPython process and interact with it via some RPC protocol (there are plenty to choose from) via pipe or network connection to localhost. As alternative to "serialized" RPC you might use...
1
0
0
0
If it doesn't use ironpython, how C# use cpython program(py file)? Because there are some bugs that ironpython load cpython code.
How C# use python program?
0
1.2
1
0
0
189
3,083,784
2010-06-21T10:17:00.000
0
0
0
0
1
python,tags,visualization,keyword
0
3,250,807
0
1
0
false
1
0
What you have is a rough 1st order approximation. I think if you then go back through the data and search for frequency of 2-word phrases, then 3 word phrases, up till the total number of words that can be considered a tag, you'll get a better representation of keyword frequency. You can refine this rough search patter...
1
1
0
0
I have to build a tag cloud out of a webpage/feed. Once you get the word frequency table of tags, it's easy to build the tagcloud. But my doubt is how do I retrieve the tags/keywords from the webpage/feed? This is what I'm doing now: Get the content -> strip HTML -> split them with \s\n\t(space,newline,tab) -> Keyword...
How do I get tags/keywords from a webpage/feed?
0
0
1
0
1
226
3,094,618
2010-06-22T15:29:00.000
1
0
1
0
0
python,file
0
3,094,661
0
3
0
false
0
0
A 4MB file is very small, it fits in memory for sure. The fastest approach would be to read it all and then iterate over each line searching for the pattern, writing out the line to the appropriate file depending on the pattern (your approach for small files.)
1
1
0
0
I have file about 4MB (which i called as big one)...this file has about 160000 lines..in a specific format...and i need to cut them at regular interval(not at equal intervals) i.e at the end of a certain format and write the part into another file.. Basically,what i wanted is to copy the information for the big file in...
how to load a big file and cut it into smaller files?
1
0.066568
1
0
0
246
3,096,953
2010-06-22T20:38:00.000
0
0
1
0
1
python,time,python-datetime
0
72,463,310
0
16
0
false
0
0
you could try this: from datetime import datetime start = datetime.now() print(start) #some code here end = datetime.now() print(end) print(end - start)
2
224
0
1
I have two times, a start and a stop time, in the format of 10:33:26 (HH:MM:SS). I need the difference between the two times. I've been looking through documentation for Python and searching online and I would imagine it would have something to do with the datetime and/or time modules. I can't get it to work properl...
How to calculate the time interval between two time strings
0
0
1
0
0
542,575
3,096,953
2010-06-22T20:38:00.000
2
0
1
0
1
python,time,python-datetime
0
3,096,997
0
16
0
false
0
0
Take a look at the datetime module and the timedelta objects. You should end up constructing a datetime object for the start and stop times, and when you subtract them, you get a timedelta.
2
224
0
1
I have two times, a start and a stop time, in the format of 10:33:26 (HH:MM:SS). I need the difference between the two times. I've been looking through documentation for Python and searching online and I would imagine it would have something to do with the datetime and/or time modules. I can't get it to work properl...
How to calculate the time interval between two time strings
0
0.024995
1
0
0
542,575
3,099,244
2010-06-23T05:58:00.000
0
0
0
0
0
python,user-interface,gtk,pygtk,gtktreeview
0
60,073,336
0
5
1
false
0
1
Calling both ModifyBase and ModifyText worked for me. Calling just ModifyBase changes the text color to White Example in GTK C#: treeViewList.ModifyBase(StateType.Selected, treeViewList.Style.Base(StateType.Normal)); treeViewList.ModifyText(StateType.Selected, treeViewList.Style.Text(StateType.Normal));
2
9
0
0
I have a dialog which contains a pygtk.treeview for listing tasks by priority. Each row has the background colour set based on that priority, so for example the highest priority has a light red background. The row selection color is not so easy to change. I can set it using treeview.modify_base(gtk.STATE_SELECTED, "#C4...
Changing the selected item colour in a GtkTreeview using python
1
0
1
0
0
3,920
3,099,244
2010-06-23T05:58:00.000
0
0
0
0
0
python,user-interface,gtk,pygtk,gtktreeview
0
3,099,780
0
5
1
false
0
1
Not sure what you mean by flickering. A border would require subclassing TreeView. I'd make the STATE_SELECTED color identical to STATE_NORMAL to disable the built-in highlighting. Then set a data_func on each column and change some color on the cell renderer depending on whether it's in the selection or not. You're pr...
2
9
0
0
I have a dialog which contains a pygtk.treeview for listing tasks by priority. Each row has the background colour set based on that priority, so for example the highest priority has a light red background. The row selection color is not so easy to change. I can set it using treeview.modify_base(gtk.STATE_SELECTED, "#C4...
Changing the selected item colour in a GtkTreeview using python
1
0
1
0
0
3,920
3,106,736
2010-06-24T01:43:00.000
9
0
1
0
0
python,pip
0
3,106,793
1
2
0
false
0
0
Pip has some great features for this. It lets you save all requirements from an environment in a file using pip freeze > reqs.txt You can then later do : pip install -r reqs.txt and you'll get the same exact environnement. You can also bundle several libraries into a .pybundle file with the command pip bundle MyApp.pyb...
2
2
0
0
I had one machine with my commonly used python package installed. and i would like to install the same package on another machine or same machine with different python version. I would like to know whether pip or easy-install or some other method can let me install those packages in a batch. When i use perl, it has som...
Any productive way to install a bunch of packages
0
1
1
0
0
824
3,106,736
2010-06-24T01:43:00.000
0
0
1
0
0
python,pip
0
3,106,755
1
2
0
false
0
0
I keep a requirements.txt file in one of my repositories that has all my basic python requirements and use PIP to install them on any new machine. Each of my projects also has it's own requirements.txt file that contains all of it's dependencies for use w/virtualenv.
2
2
0
0
I had one machine with my commonly used python package installed. and i would like to install the same package on another machine or same machine with different python version. I would like to know whether pip or easy-install or some other method can let me install those packages in a batch. When i use perl, it has som...
Any productive way to install a bunch of packages
0
0
1
0
0
824
3,108,285
2010-06-24T08:25:00.000
-4
0
1
1
0
python,linux,unix,environment-variables
0
48,543,222
0
6
0
false
0
0
you can set PYTHONPATH, by os.environ['PATHPYTHON']=/some/path, then you need to call os.system('python') to restart the python shell to make the newly added path effective.
1
146
0
0
I know how to set it in my /etc/profile and in my environment variables. But what if I want to set it during a script? Is it import os, sys? How do I do it?
In Python script, how do I set PYTHONPATH?
0
-1
1
0
0
173,492