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
3,687,715
2010-09-10T19:29:00.000
0
0
1
0
0
python,information-retrieval,inverted-index
0
3,688,556
0
6
0
false
0
0
You could store the repr() of the dictionary and use that to re-create it.
2
5
1
0
I am working on a project on Info Retrieval. I have made a Full Inverted Index using Hadoop/Python. Hadoop outputs the index as (word,documentlist) pairs which are written on the file. For a quick access, I have created a dictionary(hashtable) using the above file. My question is, how do I store such an index on disk ...
Storing an inverted index
0
0
1
0
0
3,666
3,687,715
2010-09-10T19:29:00.000
0
0
1
0
0
python,information-retrieval,inverted-index
0
5,341,353
0
6
0
false
0
0
I am using anydmb for that purpose. Anydbm provides the same dictionary-like interface, except it allow only strings as keys and values. But this is not a constraint since you can use cPickle's loads/dumps to store more complex structures in the index.
2
5
1
0
I am working on a project on Info Retrieval. I have made a Full Inverted Index using Hadoop/Python. Hadoop outputs the index as (word,documentlist) pairs which are written on the file. For a quick access, I have created a dictionary(hashtable) using the above file. My question is, how do I store such an index on disk ...
Storing an inverted index
0
0
1
0
0
3,666
3,689,766
2010-09-11T04:11:00.000
1
1
0
0
0
python,nginx,pylons,production-environment,paste
0
3,711,301
0
1
0
false
1
0
Your app will be the bottleneck in performance not Apache or Paste. Nginx is used in lots of production servers so that bit will be fine. I don't know about mod_wsgi but uWSGI is used in production environments and plays well with both nginx and Paste applications. I currently run a server using Apache + Paste using Ap...
1
2
0
0
I've developed a website in Pylons (Python web framework) and have it running, on my production server, under Apache + mod_wsgi. I've been hearing a lot of good things about nginx recently and wanted to give it a try. Currently, it's running as a forwarding proxy to create a front end to Paste. It seems to be running ...
Will nginx+paste hold up in a production environment?
0
0.197375
1
0
0
693
3,694,031
2010-09-12T06:55:00.000
0
0
1
0
0
python,information-retrieval
0
3,694,041
0
6
0
false
0
0
Something like this? word = 'something' l = [0,2,4,5,8] myDict = {} myDict[word] = l #Parse some more myDict[word].append(DocID)
1
2
0
0
I know how python dictionaries store key: value tuples. In the project I'm working on, I'm required to store key associated with a value that's a list. ex: key -> [0,2,4,5,8] where, key is a word from text file the list value contains ints that stand for the DocIDs in which the word occurs. as soon as I find the same...
Python: Storing a list value associated with a key in dictionary
0
0
1
0
0
14,894
3,694,051
2010-09-12T07:07:00.000
1
0
1
1
0
python,windows,directory,traversal
0
3,696,438
0
1
0
false
0
0
In a nutshell, here's what you'll need to do. You can delete the files and folders by using the remove() and rmdir() or removedirs() methods in the os module (assuming your user/program has administrative rights). To restart your script you will first need to add some command line argument handling to it that allows it...
1
0
0
0
I want to remove a incorrectly installed program and reinstall it. I can remove the program with subprocess.Popen calling the msiexe on it and install new program the same way BUT ONLY with two independent scripts. But i also need to remove some folders in C:\Programs files and also in C:\Doc& Settings. How can i trave...
windows python script to traverse directory to remove folders, restart PC and continue the next line of the script?
0
0.197375
1
0
0
472
3,694,226
2010-09-12T08:35:00.000
0
0
1
0
0
python-3.x
0
3,701,970
0
2
0
false
0
0
You can use sys.stderr from the sys module. print() uses sys.stdout by default. import sys # Print to standard output stream print("Normal output...") # Print to standard error stream print("Error output...", file=sys.stderr)
1
0
0
0
how can i receive the console output of any python file (errors, everything printed using the print() command)? example: main.py starts test.py and gets its output
get console output
0
0
1
0
0
1,180
3,696,124
2010-09-12T18:56:00.000
0
0
0
1
0
python,macos
0
61,142,084
0
4
0
false
0
0
i managed to fixed mine by removing python2, i don't if it's a good practice
1
18
0
0
I would like to change my PATH from Python 2.6.1 to 3.1.2. I have both versions installed on my computer, but when I type python --version in the terminal I get Python 2.6.1. So, thats the current version it's "pointing" to. Now if I type python3.1 it loads the version I want to use, although the PATH is still pointi...
changing python path on mac?
0
0
1
0
0
91,910
3,697,628
2010-09-13T02:57:00.000
7
0
1
0
0
python,textmate
0
3,697,633
0
2
0
true
0
0
Option+Shift+Tab (or Cmd+]). Omitting shift (or changing ] to [) will indent instead of reverse-indent.
1
4
0
0
I have a block of code selected, I want to un-indent this selected code. On a pc, I would do a shift-tab and it would un-indent.
In textmate, how do I reverse indent a block of selected code?
0
1.2
1
0
0
4,349
3,698,051
2010-09-13T05:46:00.000
0
0
1
0
1
python,session,queue,multiprocessing
0
3,698,555
0
3
0
false
0
0
I am not sure about the requirement to open a separate process for every message received from the sockets. I guess, you have a reason for doing all that you have mentioned. My understanding is, you have written a server side socket that listens for client connection, accepts the client connection, receives the data an...
1
0
0
0
I have a script receiveing data from a socket, each data contains a sessionid that a have to keep track of, foreach incomming message, i'm opening a new process with the multiprocessing module, i having trouble to figure out a way to keep track of the new incoming messages having the same sessionid. For example: 100100...
Python multiprocessing handling sessions
0
0
1
0
0
1,058
3,699,268
2010-09-13T09:41:00.000
0
0
0
1
0
python,django,web-services,api,soap
0
3,699,299
0
3
0
false
0
0
Depends on how you want to design your software. You could do stand-alone scripts as servers listening for requests on specific ports, or you could use a webserver which runs python scripts so you just have to access a URL. REST is one option to implement the latter. You should then look for frameworks for REST develop...
1
1
0
1
How can we call the CLI executables commands using Python For example i have 3 linux servers which are at the remote location and i want to execute some commands on those servers like finding the version of the operating system or executing any other commands. So how can we do this in Python. I know this is done throug...
How can we call the CLI executables commands using Python
0
0
1
0
1
170
3,703,704
2010-09-13T19:29:00.000
2
1
1
0
0
java,python,dynamic-languages
0
3,703,964
0
3
0
false
0
0
Some things that struck me when first trying out Python (coming from a mainly Java background): Write Pythonic code. Use idioms recommended for Python, rather than doing it the old Java/C way. This is more than just a cosmetic or dogmatic issue. Pythonic code is actually hugely faster in practice than C-like code prac...
2
6
0
0
What are the top gotchas for someone moving from a static lang (java/c#) to dynamic language like python? It seems cool how things can be done, but renaming a method, or adding/removing parameters seems so risky! Is the only solution to write tests for each method?
top gotchas for someone moving from a static lang (java/c#) to dynamic language like python
0
0.132549
1
0
0
248
3,703,704
2010-09-13T19:29:00.000
3
1
1
0
0
java,python,dynamic-languages
0
3,703,732
0
3
0
false
0
0
"Is the only solution to write tests for each method?" Are you saying you didn't write tests for each method in Java? If you wrote tests for each method in Java, then -- well -- nothing changes, does it? renaming a method, seems so risky! Correct. Don't do it. adding/removing parameters seems so risky! What? Are...
2
6
0
0
What are the top gotchas for someone moving from a static lang (java/c#) to dynamic language like python? It seems cool how things can be done, but renaming a method, or adding/removing parameters seems so risky! Is the only solution to write tests for each method?
top gotchas for someone moving from a static lang (java/c#) to dynamic language like python
0
0.197375
1
0
0
248
3,706,128
2010-09-14T04:25:00.000
0
0
0
0
0
python,windows
0
5,380,835
0
2
0
false
0
0
If you are using pyhook, event.WindowName in your OnKeyboardEvent etc function contains the value xx
1
1
0
0
How can I get the window name? I want to make a script where I have some keyboard event, and I want it to happens only if the window name has something in the name, like, Firefox. how can I do it? the simplest way
how can I get the window name? [Python]
0
0
1
0
0
4,493
3,712,992
2010-09-14T21:17:00.000
0
0
0
1
0
python,windows
0
3,954,806
0
2
0
true
0
0
I had to use remote registry... HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion ProductName, EditionID, CurrentVersion, CurrentBuild
1
1
0
1
So of course I'm new to Python and to programming in general... I am trying to get OS version information from the network. For now I only care about the windows machines. using PyWin32 I can get some basic information, but it's not very reliable. This is an example of what I am doing right now: win32net.NetWkstaGetInf...
Python: How to use platform.win32_ver() on a remote machine?
1
1.2
1
0
0
1,156
3,718,322
2010-09-15T13:56:00.000
1
0
1
0
0
python
0
3,718,337
0
3
0
false
0
0
use %%..........
1
1
0
0
I am trying to pass a string which has a '%' in it (its actually a sql query string). How do I pass the % (do I have to use a specific escape character? eg: compute_answertime("%how do I%")
What is the escape character for % in python's string method
0
0.066568
1
0
0
179
3,724,238
2010-09-16T06:35:00.000
1
0
1
1
0
python,process,subprocess,parent-child
0
3,724,308
0
2
0
false
0
0
I guess, you are asking, how do you find if the child process is hung while operating. You can't tell easily. A process could be doing a long running operation. The context is important to understand when a process is hung. If you are expecting a process to respond to a user input and is not responsive for a long perio...
2
2
0
0
How do I know is there my child process got hang while operating?
Python subprocess how to determine if child process hangs?
0
0.099668
1
0
0
2,476
3,724,238
2010-09-16T06:35:00.000
2
0
1
1
0
python,process,subprocess,parent-child
0
3,724,322
0
2
0
true
0
0
Well, how do you tell the difference between a stuck process and a process that takes longer than usual to complete? The short answer is: No, you can't detect if your child process is stuck. I would say that to be able to detect this you need some kind of continuous communication with the process (e.g. look at log file...
2
2
0
0
How do I know is there my child process got hang while operating?
Python subprocess how to determine if child process hangs?
0
1.2
1
0
0
2,476
3,728,310
2010-09-16T15:42:00.000
0
0
1
1
1
python,netbeans
1
3,743,725
0
1
0
false
1
0
You probably want to ask this question on www.serverfault.com rather than stackoverflow as it is more of a configuration issue rather than a programming issue. Include the version of Netbeans and the Java you are using - and whether you using native python and/or Jython as well. Also include at which point you see the ...
1
1
0
0
I have x64 Windows XP machine. I use Netbeans to code Java. I am now trying to use it for Python, but I get this error: \NetBeans was unexpected at this time. Any idea how to fix it?
Using Python in Netbeans
0
0
1
0
0
486
3,731,681
2010-09-16T23:41:00.000
2
0
1
0
0
python,linux,input,interrupt
0
3,731,809
0
6
0
false
0
0
You need a separate process (or possibly a thread) to read the terminal and send it to the process of interest via some form of inter-process communication (IPC) (inter-thread communication may be harder -- basically the only thing you do is send a KeyboardInterrupt from a secondary thread to the main thread). Since y...
2
3
0
0
Is there a way to send an interrupt to a python module when the user inputs something in the console? For example, if I'm running an infinite while loop, i can surround it with a try/except for KeyboardInterrupt and then do what I need to do in the except block. Is there a way to duplicate this functionality with any a...
Capturing user input at arbitrary times in python
0
0.066568
1
0
0
2,997
3,731,681
2010-09-16T23:41:00.000
1
0
1
0
0
python,linux,input,interrupt
0
3,731,716
0
6
0
false
0
0
KeyboardInterrupt is special in that it can be trapped (i.e. SIGINT under operating systems with respective POSIX support, SetConsoleCtrlHandler on Windows) and handled accordingly. If you want to process user input while at the same time doing work in a otherwise blocking loop, have a look at the threading or subproce...
2
3
0
0
Is there a way to send an interrupt to a python module when the user inputs something in the console? For example, if I'm running an infinite while loop, i can surround it with a try/except for KeyboardInterrupt and then do what I need to do in the except block. Is there a way to duplicate this functionality with any a...
Capturing user input at arbitrary times in python
0
0.033321
1
0
0
2,997
3,736,311
2010-09-17T14:39:00.000
1
0
1
0
1
python,pychecker
0
4,782,453
0
3
0
false
0
0
On the bonus extra question: pychecker always imports the files you pass it, which causes it to import whatever those import. This is just like Python. This is a first pass in pychecker. Then pychecker will actually go through the loaded modules, disassemble the code, and run through all the opcodes. This is a seco...
1
1
0
1
One of the modules I import into my python project triggers lots of warnings under Pychecker. Fixing up this external module isn't really an option, so I want to tell Pychecker to ignore it. Does anyone know how to do this? I'm sure it's possible, and probably quite simple, but after trawling Google for a while I've no...
How can I tell Pychecker to ignore an imported library?
0
0.066568
1
0
0
1,754
3,736,606
2010-09-17T15:15:00.000
4
1
0
0
0
python,http,cherrypy
0
3,737,124
0
2
0
true
0
0
CherryPy has a caching Tool, but it's never on by default. Most HTTP responses are cacheable by default, though, so look for an intermediate cache between your client and server. Look at the browser first. If you're not sure whether or not your content is being cached, compare the Date response header to the current ti...
1
3
0
0
Is it possible that CherryPy, in its default configuration, is caching the responses to one or more of my request handlers? And, if so, how do I turn that off?
How to determine if CherryPy is caching responses?
1
1.2
1
0
1
2,007
3,739,296
2010-09-17T21:47:00.000
1
0
0
0
0
javascript,python,streaming,real-time
0
3,739,311
0
5
0
false
0
0
You could have the python script write an xml file that you get with an ajax request in your web page, and get the status info from that.
1
4
0
0
I have a simple workflow [Step 0]->[1]->[2]->...->[Step N]. The master program knows the step (state) it is currently at. I want to stream this in real time to a website (in the local area network) so that when my colleagues open, say, http://thecomputer:8000, they can see a real time rendering of the current state of ...
Streaming the state of a Python script to a website
0
0.039979
1
0
1
880
3,740,903
2010-09-18T08:29:00.000
2
0
0
0
0
python,dbus
0
13,629,355
0
2
0
false
0
0
this example does not work I think because : ''' The available properties and whether they are writable can be determined by calling org.freedesktop.DBus.Introspectable.Introspect, see the section called “org.freedesktop.DBus.Introspectable”. ''' and in introspection data the property are missing: I use dbus-python-1...
1
6
0
0
In all python dbus documentations there are info on how to export objects, interfaces, signals, but there is nothing how to export interface property. Any ideas how to do that ?
Python Dbus : How to export Interface property
0
0.197375
1
0
0
5,868
3,742,583
2010-09-18T16:55:00.000
1
0
1
1
0
python,windows-installer,metadata,md5
0
3,742,782
0
4
0
false
0
0
To answer your second question: no, there is no way to hash a PE file or ZIP file, ignoring the metadata, without locating and reading the metadata. This is because the metadata you're interested in is stored at variable locations in the file. In the case of PE files (EXE, DLL, etc), it's stored in a resource block, t...
1
7
0
0
I am writing a Python script to index a large set of Windows installers into a DB. I would like top know how to read the metadata information (Company, Product Name, Version, etc) from EXE, MSI and ZIP files using Python running on Linux. Software I am using Python 2.6.5 on Ubuntu 10.04 64-bit with Django 1.2.1. Found ...
Read EXE, MSI, and ZIP file metadata in Python in Linux
0
0.049958
1
0
0
4,161
3,743,329
2010-09-18T20:13:00.000
5
0
0
0
0
python,database,django,class
0
3,743,351
0
2
0
true
1
0
Do not store code in the database!!! Imagine a class with a malicious __init__ method finding it's way in your "class repository" in the database. This means whoever has write access to those database tables has the ability to read any file from your web server and even nuke it's file system, since they have the abilit...
1
2
0
0
I'm using Django and want to be able to store classes in a database for things like forms and models so that I can easily make them creatable through a user interface since they are just stored in the database as opposed to a regular file. I don't really know a whole lot about this and am not sure if this is a situatio...
Python, how to instantiate classes from a class stored in a database?
1
1.2
1
0
0
262
3,743,812
2010-09-18T22:43:00.000
0
0
0
1
0
python,linux,windows,shell,osx-leopard
0
3,743,825
0
2
0
false
0
0
All of those operating systems should support a PATH environment variable which specifies directories that have executables that should be available everywhere. Make your script executable by chmod +x and place it into one of those directories (or add a new one to your PATH - I have ~/bin for instance). I don't know ho...
1
3
0
0
Can someone tell me how to make my script callable in any directory? My script simply returns the number of files in a directory. I would like it to work in any directory by invoking it, instead of first being copied there and then typing python myscript.py I am using Mac OS X, but is there a common way to get it insta...
Making Python script accessible system wide
1
0
1
0
0
3,533
3,746,790
2010-09-19T17:50:00.000
0
0
0
0
0
python,django,django-models
0
3,746,881
0
2
0
false
1
0
If you are okay with changing these setting programmatically via settings.py you should do that. However, if you want to change these settings via the Admin Console, you should use models.
1
1
0
0
I want to keep some global settings for my project in Django. I need to have access to these settings from the code. For example, I need to set a current theme for my site that I can set using admin console or from the code. Or I need to set a tagline that will show in the header of all pages. I suppose I should use mo...
How to work with settings in Django
0
0
1
0
0
108
3,748,720
2010-09-20T04:31:00.000
7
1
1
0
0
python
0
3,748,735
0
2
0
false
0
0
Assuming you're already familiar with another programming language: Time to learn python basics: 1 week. Total time to figure out email module: 2 days. Total time to figure out httplib module: 1 days. Total time to figure out creating database: 3 days. Total time to learn about SQL: 2 weeks. Total time to figure o...
2
1
0
0
I have been wanting to get into Python for a while now and have accumulated quite a few links to tutorials, books, getting started guides and the like. I have done a little programming in PERL and PHP, but mostly just basic stuff. I'd like to be able to set expectations for myself, so based on the following requirement...
Complete newbie excited about Python. How hard would this app be to build?
0
1
1
0
0
221
3,748,720
2010-09-20T04:31:00.000
0
1
1
0
0
python
0
3,748,731
0
2
0
false
0
0
Assuming that you don't write everything from the ground up and reuse basic components, this shouldn't be too hard. Probably the most difficult aspect will be authentication, because that requires domain specific knowledge and is hard to get right in any language. I would suggest starting with the basic functionality, ...
2
1
0
0
I have been wanting to get into Python for a while now and have accumulated quite a few links to tutorials, books, getting started guides and the like. I have done a little programming in PERL and PHP, but mostly just basic stuff. I'd like to be able to set expectations for myself, so based on the following requirement...
Complete newbie excited about Python. How hard would this app be to build?
0
0
1
0
0
221
3,752,154
2010-09-20T13:58:00.000
0
0
1
0
0
python
0
3,777,996
0
1
0
true
1
0
should be 'className' in IE...
1
0
0
0
I wrote the sentence as follows: allLinkValues = ie.getLinksValue('class') but the return values are all None, don't know why...
how to get the value of the 'class' attribute in a link?
0
1.2
1
0
0
34
3,758,468
2010-09-21T08:20:00.000
1
0
0
0
0
python,wxpython
0
3,758,497
0
1
1
true
0
1
I think you could do 2 progress bars, one for files, and second for line in just read file. This will be similar to copy progress in TotalCommander. If you want one progress bar you could just count file sizes using os.path.getsize(path) and then show how many bytes have you processed/bytes total.
1
0
0
0
I have wxpython application that run over a list of files on some directory and proccess the files line by line I need to build a progress bar that show the status how records already done with wx.gauge control I need to count the number of the records before i use the wx.guage in order to build the progress bar , is ...
counting records of files on directory with python
1
1.2
1
0
0
222
3,758,509
2010-09-21T08:28:00.000
9
0
0
0
1
python,django,customization,admin
0
3,759,347
0
2
0
true
1
0
Slow down. Relax. Follow the Django philosophy. You have an "app". It presents data. Focus on presentation. You have a default, built-in admin for your "app". It updates data and it's already there. If the admin app doesn't meet your needs update Forms and update Models to get close. But don't strain yourself me...
1
1
0
0
I am new to django and have gotten a bit stuck on trying to make the admin site work as I'd like it to. I am wondering if for making the admin functionality I want it is better to make a custom admin app with a template inheriting from admin/base_site.html, using the frontend login with a redirect when is_staff is tru...
Customizing Django Admin Interface functionality
0
1.2
1
0
0
4,748
3,758,648
2010-09-21T08:48:00.000
13
0
0
0
1
python,pyqt,pyside
0
3,761,216
0
1
0
true
0
1
u need to import QtCore so the code will look like this : self.setWindowFlags(QtCore.Qt.FramelessWindowHint) whenever you see Qt.something put in mind that they are talking about the Qt class inside QtCore module . hope this helps
1
7
0
0
I've been looking for how to do this and I've found places where the subject comes up, but none of the suggestions actually work for me, even though they seem to work out okay for the questioner (they don't even list what to import). I ran across self.setWindowFlags(Qt.FramelessWindowHint) but it doesn't seem to work r...
Setting window style in PyQT/PySide?
0
1.2
1
0
0
6,028
3,758,658
2010-09-21T08:49:00.000
1
0
0
0
0
javascript,jquery,python,matplotlib,hyperlink
0
3,759,346
0
2
1
false
0
0
You can do this with an imagemap or HTML element overlay controlled by JavaScript/jQuery. Essentially, send your chart data to the page along with the chart image, and use JS to create the elements with the links according to the specification of the data. It's a bit harder than the bar graphs I've done this to before,...
1
3
0
0
I want to do a pie chart in matplotlib. This pie chart will be a representation of two variables: male and female. That's easy to do :) What I would like to do next, I'm not even sure if it's possible to do with matplotlib, I would like to make these two variables clickable so if I click on male, I would see another pa...
how to create hyperlink in piechart
0
0.099668
1
0
0
1,491
3,759,003
2010-09-21T09:37:00.000
0
0
0
0
0
python,django,google-app-engine,django-models,google-cloud-datastore
1
3,808,459
0
3
0
true
1
0
Two possible solutions: Check if the reference still exists, before you access it: if not obj.reference: # Referenced entity was deleted When you delete a model object that may be referenced, query all models that might reference it, and set their reference property to None.
3
1
0
0
I am working on an application on Django and google application engine. In my application I have several models with several ReferenceProperty fields. The issue is that if any of the ReferenceProperty field gets deleted it produces a ReferenceProperty related errors in all the other models where it has been used. What...
Django Google app engine reference issues
0
1.2
1
0
0
249
3,759,003
2010-09-21T09:37:00.000
0
0
0
0
0
python,django,google-app-engine,django-models,google-cloud-datastore
1
3,759,035
0
3
0
false
1
0
When I have the same problem ago, I could not find a general solution. The only way I found is to do try/except for every reference property. If you find another answer post it here.
3
1
0
0
I am working on an application on Django and google application engine. In my application I have several models with several ReferenceProperty fields. The issue is that if any of the ReferenceProperty field gets deleted it produces a ReferenceProperty related errors in all the other models where it has been used. What...
Django Google app engine reference issues
0
0
1
0
0
249
3,759,003
2010-09-21T09:37:00.000
1
0
0
0
0
python,django,google-app-engine,django-models,google-cloud-datastore
1
3,808,505
0
3
0
false
1
0
You could also just set a flag, say deleted, on the entity you're deleting, and then leave it in the datastore. This has the advantage of avoiding all referential integrity problems in the first place, but it comes at the cost of two main disadvantages: All your existing queries need to be changed to deal with entitie...
3
1
0
0
I am working on an application on Django and google application engine. In my application I have several models with several ReferenceProperty fields. The issue is that if any of the ReferenceProperty field gets deleted it produces a ReferenceProperty related errors in all the other models where it has been used. What...
Django Google app engine reference issues
0
0.066568
1
0
0
249
3,774,772
2010-09-23T01:21:00.000
2
1
0
1
0
python,cron,package,execute,at-job
0
3,774,794
0
4
0
false
0
0
type man at, it will explain how to use it. Usage will slighty differ from system to system, so there's no use to tell you here exactly.
1
2
0
0
When I try to use cron to execute my python script in a future time, I found there is a command at, AFAIK, the cron is for periodically execute, but what my scenario is only execute for once in specified time. and my question is how to add python script to at command, also it there some python package for control the a...
How to use at command to set python script execute at specified time
0
0.099668
1
0
0
2,030
3,780,379
2010-09-23T16:14:00.000
0
1
0
0
0
ironpython
0
3,780,791
0
1
0
false
0
0
Resolved. Turns out that you need to rebuild IronPython from source, with the command line options –X:Frames or –X:FullFrames.
1
0
0
0
I'm trying to use a module that requires sys._getframe(), which, as I understand it, is not enabled by default. I've seen a lot of material that suggests that there is a way to enable _getframe(), but I've yet to find anything that tells me how to do so. What is the proper method for enabling this function in IronPyt...
How can I enable sys._getframe in IronPython 2.6.1?
1
0
1
0
0
905
3,781,873
2010-09-23T19:33:00.000
0
0
1
1
0
python,pywin32,python-embedding
0
3,782,055
0
1
0
false
0
0
I previously used py2exe to freeze the application and all the DLLs. Then use Innosetup to create an installer. Work like a charm.
1
2
0
0
I have python as an embedded scripting environment in my application. I supply the python bits (python26.dll, DLLs & Lib folders) with my application. All this to avoid asking users to install python (you know how it goes in big corporations). All works nice except pywin32. It installs pythoncom26.dll and pywintypes26....
pywin32 captive installation (avoid py*.dll getting installed in system32 directory)
0
0
1
0
0
573
3,785,502
2010-09-24T08:48:00.000
2
0
0
0
0
python,django
0
3,787,861
0
1
0
true
1
0
Well I found the answer. It was quite easy actually. you just need to set the FileField value to some string and it will point to that file. The point is that the path specified should be correct otherwise you get a 404 error when trying to access it.
1
1
0
0
I wanted to know how is it possible in django to bind an already uploaded file (stored in the file system of server) to a Model FileField. This way I want to have my edit page of that model to prepopulate the FileField with this file. Thanks
Prepopulating a Django FileField
1
1.2
1
0
0
669
3,793,424
2010-09-25T10:34:00.000
1
0
0
0
1
python,django,subdomain
0
3,794,000
0
1
0
true
1
0
You may be able to do what you need with apache mod_rewrite. Obviously I didn't read the question clearly enough. As for how to do it in django: you could have some middleware that looks at the server name, and redirects according to that (or even sets a variable). You can't do it with the bare url routing system, as t...
1
2
0
0
What are the best practices and solutions for managing dynamic subdomains in different technologies and frameworks? I am searching for something to implement in my Django project but those solutions that I saw, don't work. I also tried to use Apache rewrite mod to send requests from subdomain.domain.com to domain.com/s...
Managing subdomains
0
1.2
1
0
0
347
3,794,868
2010-09-25T17:54:00.000
8
0
1
0
0
python,multithreading,thread-safety,thread-local
0
3,794,914
0
1
0
true
0
0
No -- thread local means that each thread gets its own copy of that variable. Using it is (at least normally) thread-safe, simply because each thread uses its own variable, separate from variables by the same name that's accessible to other threads. OTOH, they're not (normally) useful for communication between threads...
1
5
0
0
Specifically I'm talking about Python. I'm trying to hack something (just a little) by seeing an object's value without ever passing it in, and I'm wondering if it is thread safe to use thread local to do that. Also, how do you even go about doing such a thing?
Does thread-local mean thread safe?
0
1.2
1
0
0
718
3,798,067
2010-09-26T13:49:00.000
0
0
0
0
0
python
0
3,805,092
0
4
0
false
0
0
Dcolish's answer is good. I'm not sure the idea of executing code that comes in on a network interface is good in itself, though - you will need to take care to verify that you can trust the sending party, especially if this interface is going to be exposed to the Internet or really any production network.
1
0
0
0
how do i run a python program that is received by a client from server without writing it into a new python file?
network programming in python
0
0
1
0
1
387
3,801,379
2010-09-27T05:48:00.000
61
0
0
0
0
python,django,redis
0
7,722,260
0
5
0
false
1
0
Just because Redis stores things in-memory does not mean that it is meant to be a cache. I have seen people using it as a persistent store for data. That it can be used as a cache is a hint that it is useful as a high-performance storage. If your Redis system goes down though you might loose data that was not been writ...
1
107
0
0
I've heard of redis-cache but how exactly does it work? Is it used as a layer between django and my rdbms, by caching the rdbms queries somehow? Or is it supposed to be used directly as the database? Which I doubt, since that github page doesn't cover any login details, no setup.. just tells you to set some config pro...
How can I use redis with Django?
0
1
1
1
0
75,541
3,808,581
2010-09-27T23:17:00.000
0
1
0
0
0
python,apache,embedded,beagleboard
0
3,811,703
0
4
0
false
1
0
the device will be mobile and will be moving locations every few days. So, I can't guarantee a static IP address for the device. Your device can be a client of the web site. Your web site has two interfaces. HTML interface to people. A non-HTML interface to the device. As a client of a web site, the device will nee...
1
5
0
0
I'm currently working on a project where I'm trying to control an embedded device through an Internet facing website. The idea is is that a user can go to a website and tell this device to preform some kind of action. An action on the website would be translated into a series of CLI commands and then sent to the device...
Creating a website to communicate with an embedded device
0
0
1
0
0
1,776
3,809,314
2010-09-28T02:40:00.000
3
0
1
0
0
python,windows,compatibility,backwards-compatibility,build-environment
0
3,809,331
0
19
0
false
0
0
You can install multiple versions of Python one machine, and during setup, you can choose to have one of them associate itself with Python file extensions. If you install modules, there will be different setup packages for different versions, or you can choose which version you want to target. Since they generally inst...
8
234
0
0
I do most of my programming in Python 3.x on Windows 7, but now I need to use the Python Imaging Library (PIL), ImageMagick, and wxPython, all of which require Python 2.x. Can I have both Python 2.x and Python 3.x installed in Windows 7? When I run a script, how would I "choose" which version of Python should run it? W...
How to install both Python 2.x and Python 3.x in Windows
0
0.031568
1
0
0
242,246
3,809,314
2010-09-28T02:40:00.000
81
0
1
0
0
python,windows,compatibility,backwards-compatibility,build-environment
0
22,626,734
0
19
0
false
0
0
What I did was download both 2.7.6 and 3.3.4. Python 3.3.4 has the option to add the path to it in the environment variable so that was done. So basically I just manually added Python 2.7.6. How to... Start > in the search type in environment select "Edit environment variables to your account"1 Scroll down to Path, se...
8
234
0
0
I do most of my programming in Python 3.x on Windows 7, but now I need to use the Python Imaging Library (PIL), ImageMagick, and wxPython, all of which require Python 2.x. Can I have both Python 2.x and Python 3.x installed in Windows 7? When I run a script, how would I "choose" which version of Python should run it? W...
How to install both Python 2.x and Python 3.x in Windows
0
1
1
0
0
242,246
3,809,314
2010-09-28T02:40:00.000
13
0
1
0
0
python,windows,compatibility,backwards-compatibility,build-environment
0
48,239,658
0
19
0
false
0
0
To install and run any version of Python in the same system follow my guide below. For example say you want to install Python 2.x and Python 3.x on the same Windows system. Install both of their binary releases anywhere you want. When prompted do not register their file extensions and do not add them automatical...
8
234
0
0
I do most of my programming in Python 3.x on Windows 7, but now I need to use the Python Imaging Library (PIL), ImageMagick, and wxPython, all of which require Python 2.x. Can I have both Python 2.x and Python 3.x installed in Windows 7? When I run a script, how would I "choose" which version of Python should run it? W...
How to install both Python 2.x and Python 3.x in Windows
0
1
1
0
0
242,246
3,809,314
2010-09-28T02:40:00.000
0
0
1
0
0
python,windows,compatibility,backwards-compatibility,build-environment
0
64,577,951
0
19
0
false
0
0
I use a simple solution to switch from a version to another version of python, you can install all version you want. All you have to do is creating some variable environment. In my case, I have installed python 2.7 and python 3.8.1, so I have created this environment variables: PYTHON_HOME_2.7=<path_python_2.7> PYTHON...
8
234
0
0
I do most of my programming in Python 3.x on Windows 7, but now I need to use the Python Imaging Library (PIL), ImageMagick, and wxPython, all of which require Python 2.x. Can I have both Python 2.x and Python 3.x installed in Windows 7? When I run a script, how would I "choose" which version of Python should run it? W...
How to install both Python 2.x and Python 3.x in Windows
0
0
1
0
0
242,246
3,809,314
2010-09-28T02:40:00.000
-1
0
1
0
0
python,windows,compatibility,backwards-compatibility,build-environment
0
43,160,074
0
19
0
false
0
0
I have installed both python 2.7.13 and python 3.6.1 on windows 10pro and I was getting the same "Fatal error" when I tried pip2 or pip3. What I did to correct this was to go to the location of python.exe for python 2 and python 3 files and create a copy of each, I then renamed each copy to python2.exe and python3.exe...
8
234
0
0
I do most of my programming in Python 3.x on Windows 7, but now I need to use the Python Imaging Library (PIL), ImageMagick, and wxPython, all of which require Python 2.x. Can I have both Python 2.x and Python 3.x installed in Windows 7? When I run a script, how would I "choose" which version of Python should run it? W...
How to install both Python 2.x and Python 3.x in Windows
0
-0.010526
1
0
0
242,246
3,809,314
2010-09-28T02:40:00.000
1
0
1
0
0
python,windows,compatibility,backwards-compatibility,build-environment
0
33,527,329
0
19
0
false
0
0
Check your system environment variables after installing Python, python 3's directories should be first in your PATH variable, then python 2. Whichever path variable matches first is the one Windows uses. As always py -2 will launch python2 in this scenario.
8
234
0
0
I do most of my programming in Python 3.x on Windows 7, but now I need to use the Python Imaging Library (PIL), ImageMagick, and wxPython, all of which require Python 2.x. Can I have both Python 2.x and Python 3.x installed in Windows 7? When I run a script, how would I "choose" which version of Python should run it? W...
How to install both Python 2.x and Python 3.x in Windows
0
0.010526
1
0
0
242,246
3,809,314
2010-09-28T02:40:00.000
-1
0
1
0
0
python,windows,compatibility,backwards-compatibility,build-environment
0
21,692,110
0
19
0
false
0
0
Only Works if your running your code in your Python IDE I have both Python 2.7 and Python 3.3 installed on my windows operating system. If I try to launch a file, it will usually open up on the python 2.7 IDE. How I solved this issue, was when I choose to run my code on python 3.3, I open up python 3.3 IDLE(Python GUI)...
8
234
0
0
I do most of my programming in Python 3.x on Windows 7, but now I need to use the Python Imaging Library (PIL), ImageMagick, and wxPython, all of which require Python 2.x. Can I have both Python 2.x and Python 3.x installed in Windows 7? When I run a script, how would I "choose" which version of Python should run it? W...
How to install both Python 2.x and Python 3.x in Windows
0
-0.010526
1
0
0
242,246
3,809,314
2010-09-28T02:40:00.000
0
0
1
0
0
python,windows,compatibility,backwards-compatibility,build-environment
0
17,660,471
0
19
0
false
0
0
Install the one you use most (3.3 in my case) over the top of the other. That'll force IDLE to use the one you want. Alternatively (from the python3.3 README): Installing multiple versions On Unix and Mac systems if you intend to install multiple versions of Python using the same installation prefix (--prefix argument ...
8
234
0
0
I do most of my programming in Python 3.x on Windows 7, but now I need to use the Python Imaging Library (PIL), ImageMagick, and wxPython, all of which require Python 2.x. Can I have both Python 2.x and Python 3.x installed in Windows 7? When I run a script, how would I "choose" which version of Python should run it? W...
How to install both Python 2.x and Python 3.x in Windows
0
0
1
0
0
242,246
3,811,197
2010-09-28T09:04:00.000
1
1
0
1
0
python,file-permissions
0
3,811,219
0
4
0
false
0
0
Start your program with a user that is allowed to write there. For example login to root first (su) or run the script with sudo myscript.py.
1
6
0
0
I m using shutil.copy from python to copy a list of files. But when i copy the files to /usr/lib/ location, i m getting permission denied as i need to be an administrator to do that. So How could i copy files with admin permission or how could i get the admin password from the user to copy the files? Ideas would be ap...
Getting admin password while copy file using shutil.copy?
0
0.049958
1
0
0
7,772
3,814,365
2010-09-28T15:28:00.000
1
0
0
0
1
python,xml.etree
0
3,814,788
0
1
0
true
0
0
register_namespace was only introduced in lxml 2.3 (still beta) I believe you can provide an nsmap parameter (dictionary with prefix-uri mappings) when creating an element, but I don't think you can change it for an existing element. (there is an .nsmap property on the element, but changing that doesn't seem to work. T...
1
3
0
0
I wish to set the namespace prefix in xml.etree. I found register_namespace(prefix, url) on the Web but this threw "unknown attribute". I have also tried nsmap=NSMAP but this also fails. I'd be grateful for example syntax that shows how to add specified namespace prefixes
how to set namespace prefixes in xml.etree
0
1.2
1
0
1
1,128
3,821,636
2010-09-29T12:41:00.000
2
0
0
1
0
python,google-app-engine
0
3,823,052
0
1
0
true
1
0
I've solved this in the past by keeping the status for the tasks in memcached, and polling (via Ajax) to determine when the tasks are finished. If you go this way, it's best if you can always "manually" determine the status of the tasks without looking in memcached, since there's always the (slim) chance that memcach...
1
1
0
0
I need to import some data to show it for user but page execution time exceeds 30 second limit. So I decided to split my big code into several tasks and try Task Queues. I add about 10-20 tasks to queue and app engine executes tasks in parallel while user is waiting for data. How can I determine that my tasks are compl...
Python App Engine: Task Queues
0
1.2
1
0
0
284
3,822,857
2010-09-29T14:55:00.000
1
0
0
0
0
python,django-admin,customization
0
3,831,573
0
2
0
false
1
0
If I were you (and I am), I would stop trying to integrate this functionality with the Django admin site. Speaking from experience, you'll find that what you're trying to do is much easier to implement as regular views. Sure, it isn't be as pretty, but something that works beats something that's pretty but doesn't work...
1
0
0
0
I am trying to create a Django admin filter that will get random groups of users. At this point, I have two problems: Applying a custom filter to the User model, and Displaying a random set of users. On #1, I've tried using User.username.random_filter = True, but it comes back with an AttributeError saying that User ...
Django randomly order users in admin
0
0.099668
1
0
0
235
3,823,420
2010-09-29T15:57:00.000
1
0
0
0
0
python,network-protocols
0
3,824,612
0
2
0
false
0
0
It wasn't obvious from your question but if getting answers back synchronously doesn't matter to you (i.e., you are just asking for work to be performed) you might want to consider just using a job queue. It's generally the easiest way to communicate between hosts. If you don't mind depending on AWS using SQS is super ...
1
0
0
0
The situation is that I have a small datacenter, with each server running python instances. It's not your usual distributed worker setup, as each server has a specific role with an appropriate long-running process. I'm looking for good ways to implement the the cross-server communication. REST seems like overkill. XML-...
What are good specs/libraries for closed network communication in python?
0
0.099668
1
0
1
196
3,824,923
2010-09-29T18:59:00.000
13
0
0
0
0
python,apache,logging,mod-wsgi
0
3,825,257
0
1
0
true
1
0
Mostly, we use logging and write to sys.stderr. That seems to write to the Apache error_log.
1
12
0
0
I have a Django project where I have been logging to a file using the standard library logging module. For a variety of reasons I would like to change it so that it writes to the Apache log files. I've seen quite a bit of discussion of how to do this with mod_python, but not mod_wsgi. How do I do this for a project ...
How do I write to the apache log files when using mod_wsgi
0
1.2
1
0
0
3,241
3,829,405
2010-09-30T09:40:00.000
0
0
0
0
1
python,code-generation,web-crawler,robot
0
3,829,743
0
1
0
true
1
0
You need to separate out the idea of what code to generate from the events triggering generation. What code is generated is governed by the combined set of all the checkboxes that are checked. Triggering code generation occurs each time any of them are changed. You need to regenerate everything at that time. In detail:...
1
1
0
0
I want to write a web-based code generator for a Python crawler. Its aim is to automatically generate code so a developer doesn't need to write it, but I've run into this problem: in one of my project's webpages, there are some checkboxes, buttons, etc. Each of them generates some Python code and writes it to a common ...
Problem with web code generator designer
0
1.2
1
0
0
82
3,836,620
2010-10-01T04:51:00.000
0
0
0
0
0
python,continuous
0
3,836,650
0
3
0
false
0
0
If you really wanted to (and wanted to waste a lot of resources), you could cut your loop into 200 ms chunks. So sleep 200 ms, check input, repeat until five minutes elapse, and then check your inbox. I wouldn't recommend it, though. While it's sleeping, though, the process is blocked and won't receive input until the ...
1
4
0
0
I have a script that runs continuously when invoked and every 5 minutes checks my gmail inbox. To get it to run every 5 minutes I am using the time.sleep() function. However I would like user to end the script anytime my pressing q, which it seems cant be done when using time.sleep(). Any suggestions on how i can do th...
Continous loop and exiting in python
0
0
1
0
1
5,470
3,839,216
2010-10-01T12:41:00.000
0
0
0
0
0
javascript,python,html,css,user-interface
0
3,839,449
0
10
0
true
1
0
update: This is an old answer, nowadays you want to go with an embedded browser in your app (*webkit projects etc.), but at the time of writing, no such technology existed. The answer is still valid if you don't want to add quite a few megabytes to your packaged app though. Find a lightweight server, or better - embed...
1
11
0
0
Different languages have different GUI toolkits, but it looks very difficult to achieve attractive user interfaces as good as we can using HTML and CSS with less effort. I don't do my application in javascript as I doubt if it has all the required libraries and I want to do it in python. How do I use rendering engines...
how to write a desktop application which uses HTML and CSS for user interface and python/perl/c++/java for the processing?
0
1.2
1
0
0
4,636
3,844,158
2010-10-02T02:49:00.000
8
1
1
0
0
python,oop
0
3,844,175
0
2
0
true
0
0
What are these kinda classes classified under OOdesign? Can I do it in a more elegant way? You do have better alternatives, IMHO. I use a class that has just named constants , this class is used directly other classes to get values of constants in it.I dont instantiate the class. For e.g. in this case you don't nece...
1
2
0
0
I just want to know how I can call certian classes in design pattern here, like which type are they classified in OO design (1) I use a class that has just named constants , this class is used directly other classes to get values of constants in it.I dont instantiate the class. (2) I use a class with full of static met...
Static or constant or what are they?
0
1.2
1
0
0
705
3,853,038
2010-10-04T05:22:00.000
0
0
0
1
0
python,macos,command-line
0
3,853,095
0
2
0
false
0
0
have you tried using the nohup? lets say you have a launch script to start your program: launch.sh: nohup your_program & exit
1
2
0
0
For great help from stackoverflow, the development for the Mac version of my program is done. Now I need to deploy my program, and I was wondering if there is any way to "hide" my running Python code (it also runs .so library and it seems it makes a dock item to appear). The program is supposed to be running in the ba...
Run a python script and a compiled c code without terminal or dock item in Mac OS X
1
0
1
0
0
1,064
3,867,377
2010-10-05T20:17:00.000
3
1
1
0
0
ironpython
0
3,869,625
0
1
0
true
0
0
It's interesting, there's actually no support for this at all right now. For the most part this has been used to implement built-in modules that exist in CPython and there's simply been no need for submodules yet. You could have a nested static class in the class used for the module but it wouldn't import as a module...
1
2
0
0
While I'm familiar with making .net assemblies with the PythonModule assembly attribute, I'm a little curious as to how you could make submodules. Would this be a class within a class? i.e: if I have a class defined as an IronPython module such as: [assembly: PythonModule(mymodule),typeof(namespace.mymodule)] How cou...
submodules in ironpython
0
1.2
1
0
0
183
3,867,500
2010-10-05T20:34:00.000
1
0
0
1
0
python,user-interface,wxpython,wxwidgets,command-line-interface
0
3,867,843
0
2
0
false
0
0
If you can call your data model's methods from your GUI and they don't depend on anything in the GUI, then yes, you should be able to call those same methods from another GUI, be it CLI, pyGTK or whatever.
1
0
0
0
HI, guys. I am developing a GUI to configure and call several external programs with Python and I use wxPython for the GUI toolkits. Basically, instead of typing commands and parameters in each shell for each application (one application via one shell), the GUI is visualizing these parameters and call them as subproces...
how to make a Command Line Interface from a given data model used for GUI
1
0.099668
1
0
0
440
3,873,212
2010-10-06T13:56:00.000
1
0
1
0
0
.net,vb.net,ironpython
0
3,873,713
0
1
0
true
0
0
The full name for the method is Microsoft.VisualBasic.DateAndTime.Year(DateTime). This is a compat function. Since you need to pass a DateTime argument anyway, you might as well use its Year property. Albeit that the VB version can be different because it uses the current culture calendar's GetYear() method. In othe...
1
0
0
0
Since it's possible using the IsNumeric() and others VB.NET functions from IronPython by importing Microsoft.VisualBasic and using it as an object method, is it possible somehow to use the Year() VB.NET function from IronPython?
using the VB.NET Year function from IronPython
1
1.2
1
0
0
163
3,874,837
2010-10-06T16:37:00.000
0
0
1
0
0
python,compression,gzip,tar
0
3,874,884
0
4
0
false
0
0
As larsmans says, gzip compression is not used for directories, only single files. The usual way of doing things with linux is to put the directory in a tarball first and then compress it.
1
12
0
0
I'm creating Python software that compresses files/folders... How would I create a section of the code that asks for the user input of the folder location and then compresses it. I currently have the code for a single file but not a folder full of files. Please explain in detail how to do this.
How do I compress a folder with the Python GZip module?
0
0
1
0
0
24,451
3,877,631
2010-10-06T23:28:00.000
0
1
0
0
1
python,google-app-engine,ip-address
0
3,877,766
1
1
1
true
1
0
I believe that I have figured out the reason for seeing so many warnings from google server IP addresses. It seems that immediately after a new user registers, the google crawlers are going to the same (registration) webpage (which I send information to as a GET instead of a POST for reasons which I will not get into)....
1
0
0
0
In order to make the registration process on my website easy, I allow users to enter their email address which I will send a verification code to or alternatively they can solve a captcha. The problem is that in order to prevent robots from registering accounts (with fake emails) I limit the number of registrations all...
Google App Engine (Python)- Strange behaviour of REMOTE_ADDR
1
1.2
1
0
0
438
3,881,951
2010-10-07T13:10:00.000
0
0
0
0
0
python
0
3,882,193
0
2
0
false
0
0
The IP addresses are assigned to your VPSes, no possibility to change them on the fly. You have to open a SSH tunnel to or install a proxy on your VPSes. I think a SSH tunnel would be the best way how to do it, and then use it as SOCKS5 proxy from Python.
1
1
0
0
I am running my code on multiple VPSes (with more than one IP, which are set up as aliases to the network interfaces) and I am trying to figure out a way such that my code acquires the IP addresses from the network interfaces on the fly and bind to it. Any ideas on how to do it in python without adding a 3rd party libr...
figuring out how to get all of the public ips of a machine
0
0
1
0
1
118
3,883,497
2010-10-07T15:57:00.000
18
0
0
0
0
python,django
0
3,883,556
0
3
0
true
1
0
Just run two instances of ./manage.py runserver. You can set a port by simply specifying it directly: ./manage.py runserver 8002 to listen on port 8002. Edit I don't really understand why you want to do this. If you want two servers serving different parts of your site, then you have in effect two sites, which will nee...
2
8
0
0
Could someone tell me how I can run Django on two ports simultaneously? The default Django configuration only listens on port 8000. I'd like to run another instance on port xxxx as well. I'd like to redirect all requests to this second port to a particular app in my Django application. I need to accomplish this with t...
Run Django on multiple ports
0
1.2
1
0
0
14,240
3,883,497
2010-10-07T15:57:00.000
2
0
0
0
0
python,django
0
3,883,557
0
3
0
false
1
0
The built-in web-server is intended for development only, so you should really be using apache or similar in an situation where you need to run on multiple ports. On the other hand you should be able to start up multiple servers just by starting multiple instances of runserver. As long as you are using a separate datab...
2
8
0
0
Could someone tell me how I can run Django on two ports simultaneously? The default Django configuration only listens on port 8000. I'd like to run another instance on port xxxx as well. I'd like to redirect all requests to this second port to a particular app in my Django application. I need to accomplish this with t...
Run Django on multiple ports
0
0.132549
1
0
0
14,240
3,883,619
2010-10-07T16:12:00.000
0
0
1
0
0
python,django,shell,ipython
0
34,309,424
0
5
0
false
1
0
The easiest solution I've found is combination of shell_plus and iPython which automatically reloads functions. pip install ipython pip install django-extensions add 'django_extensions' to your INSTALLED_APPS python manage.py shell_plus
1
6
0
0
I work in the django IPython-shell, which can be started with manage.py shell. When i load an extern function in the shell for testing, everything is alright. But when i make changes to the function, the shell still has the old version of the function. Even if i make a new import. Does anyone know how to reload the act...
django, python: reload function in shell
0
0
1
0
0
8,233
3,884,881
2010-10-07T18:53:00.000
0
0
1
1
1
python,windows-xp
0
3,884,931
0
3
0
false
0
0
You need to map it as a drive.
1
2
0
0
How can I open a Python interpreter at a specific network path in Windows? In the Explorer address bar the path is in UNC form: \\myhost\myshare\.... I can't work out how to change to this directory from the Windows command line, nor in what format I could pass it as an argument to os.chdir. I'm running Python 2.5 on W...
How can I open a Python shell at a network path in Windows?
0
0
1
0
0
2,258
3,885,160
2010-10-07T19:24:00.000
0
0
0
1
0
python,linux,networking,ip-address
0
3,885,255
0
2
0
false
0
0
If the default gateway for the system is reliable, then grab that from the output from route -n the line that contains " UG " (note the spaces) will also contain the IP of the gateway and interface name of the active interface.
1
1
0
0
On my linux machine, 1 of 3 network interfaces may be actually connected to the internet. I need to get the IP address of the currently connected interface, keeping in mind that my other 2 interfaces may be assigned IP addresses, just not be connected. I can just ping a website through each of my interfaces to determin...
Determine IP address of CONNECTED interface (linux) in python
0
0
1
0
1
2,443
3,886,402
2010-10-07T22:38:00.000
7
0
1
0
0
python,floating-point,decimal
0
66,605,212
0
36
0
false
0
0
To make it work with both positive and negative numbers: try abs(x)%1. For negative numbers, without with abs, it will go wrong. 5.55 % 1 output 0.5499999999999998 -5.55 % 1 output 0.4500000000000002
1
164
0
0
How do I get the numbers after a decimal point? For example, if I have 5.55, how do i get .55?
How to get numbers after decimal point?
0
1
1
0
0
285,621
3,886,500
2010-10-07T22:56:00.000
0
0
0
0
0
python,multithreading,pyqt,copy-paste
0
3,886,510
0
1
0
false
0
1
In Qt you would overload the OnClose method for the widget/frame or hook the lastwindowsdclosed signal to do whatever you need to shut down the app - don't know if it's diiferent from python
1
0
0
0
I have a programs that runs several threads (on a while loop until Ctrl C is pressed). The app also has a GUI that I developed in PyQt. However, I am facing the following problem: If I press Ctrl C on the console, and then close the GUI, the program exits fine. However, if I close the GUI first, the other threads wo...
PyQT4 and Ctrl C
0
0
1
0
0
722
3,890,321
2010-10-08T12:11:00.000
8
0
1
0
0
python,grammar
0
3,890,344
0
2
0
true
0
0
Grammars are generally of the same form: Backus-Naur Form (BNF) is typical. Lexer/parsers can take very different forms. The lexer breaks up the input file into tokens. The parser uses the grammar to see if the stream of tokens is "valid" according to its rules. Usually the outcome is an abstract syntax tree (AST) t...
1
4
0
0
I wonder how is generated the grammar of the Python language and how it is understood by the interpreter. In python, the file graminit.c seems to implement the grammar, but i don't clearly understand it. More broadly, what are the different ways to generate a grammar and are there differences between how the grammar is...
How is generated the python grammar and how the interpreter understand it
1
1.2
1
0
0
841
3,890,390
2010-10-08T12:22:00.000
7
0
1
0
0
javascript,python,sockets,encoding
0
3,890,407
0
2
1
false
1
0
JSON is definitely the way to go. It has a very small overhead and is capable of storing almost any kind of data. I am not a python expert, but i am sure that there is some kind of en/decoder available.
1
1
0
1
OK so im using websockets to let javascript talk to python and that works very well BUT the data i need to send often has several parts like an array, (username,time,text) but how could i send it ? I originally though to encode each one in base64 or urlencode then use a character like | which those encoding methods wil...
Python to javascript communication
0
1
1
0
1
1,908
3,897,140
2010-10-09T17:31:00.000
0
1
0
1
1
python,apache
1
3,898,807
0
2
0
false
1
0
You'd need to show your apache configuration to say for certain, but it seems that Apache isn't actually using mod_cgi to serve the index.cgi script. In your configuration there should be something like 'LoadModule mod_cgi'. It should be uncommented (i.e., it shouldn't have a '#' at the beginning of the line). If you ...
2
0
0
0
I have a CGI script (pwyky) that I called index.cgi, put in directory wiki/, and setup Apache to call localhost/wiki/index.cgi when I access localhost/wiki. I'm getting errors when I'm trying to use this application -- it creates a page with links like "http://localhost/wiki/@edit/index", but when I click that link, Ap...
URL rewriting question
0
0
1
0
0
762
3,897,140
2010-10-09T17:31:00.000
0
1
0
1
1
python,apache
1
3,908,016
0
2
0
true
1
0
I found the problem, it turned out this is done through RewriteEngine. Pwyky puts .htaccess file in the directory with all the settings for RewriteEngine, but because AllowOverride is "None" by default on MacOS, they were ignored. The solution was to change all "AllowOverride" directives to "All"
2
0
0
0
I have a CGI script (pwyky) that I called index.cgi, put in directory wiki/, and setup Apache to call localhost/wiki/index.cgi when I access localhost/wiki. I'm getting errors when I'm trying to use this application -- it creates a page with links like "http://localhost/wiki/@edit/index", but when I click that link, Ap...
URL rewriting question
0
1.2
1
0
0
762
3,898,988
2010-10-10T04:11:00.000
1
0
0
0
0
python,wxpython,frame,send
0
3,906,746
0
2
0
false
0
1
I'd definitely use PubSub as it's probably the cleanest way I can think of to do it. You can also do it with wx.PostEvent or use a modal frame.
1
1
0
0
I'm writing a small app which has 2 separate frames. The first frame is like a video player controller. It has Play/Stop/Pause buttons etc. It's named controller.py. The second frame contains OpenGL rendering and many things inside it, but everything is wrapped inside a Frame() class as the above. It's named model.py. ...
How to control a frame from another frame?
0
0.099668
1
0
0
669
3,900,403
2010-10-10T13:03:00.000
1
0
0
0
0
python,sockets,serial-port
0
3,900,446
0
2
0
false
0
0
The simplest way is to simply accept a connection, handle the request, and close the connection. This way, your program handles only one request at a time. An alternative is to use locking or semaphores, to prevent multiple clients accessing the RS232 port simultaneously.
1
1
0
0
I need to expose an RS232 connection to clients via a network socket. I plan to write in python a TCP socket server which will listen on some port, allow client to connect and handle outgoing and manage and control requests and replies to from the R2232 port. My question is, how do I synchronize the clients, each clie...
Writing a TCP to RS232 driver
0
0.099668
1
0
1
1,048
3,902,996
2010-10-11T01:28:00.000
-2
0
1
0
0
python,debugging,ide
0
3,903,016
0
6
0
false
0
0
To start coding in a file, just open a new file and start typing.
4
3
0
0
This obviously an extremely novice question, but I've installed Python 2.7 and started reading the manual. However I looked and looked, and couldn't understand how to start programming a file rather than writing in interactive mode. One book that was online suggested quit(), which surprise -- quit the program. Should c...
How to get out of interactive mode in Python
0
-0.066568
1
0
0
7,387
3,902,996
2010-10-11T01:28:00.000
0
0
1
0
0
python,debugging,ide
0
16,851,751
0
6
0
false
0
0
use new window tool in the file icon,in the python idle itself to write a program
4
3
0
0
This obviously an extremely novice question, but I've installed Python 2.7 and started reading the manual. However I looked and looked, and couldn't understand how to start programming a file rather than writing in interactive mode. One book that was online suggested quit(), which surprise -- quit the program. Should c...
How to get out of interactive mode in Python
0
0
1
0
0
7,387
3,902,996
2010-10-11T01:28:00.000
0
0
1
0
0
python,debugging,ide
0
3,903,066
0
6
0
false
0
0
Push new to start making your own script file. Then when you are ready to test click run and then you can watch the results in the interactive mode, and even try new things as if you were adding code to the end of your script file, its a very useful app for debugging, testing and trying new things. Also in the options...
4
3
0
0
This obviously an extremely novice question, but I've installed Python 2.7 and started reading the manual. However I looked and looked, and couldn't understand how to start programming a file rather than writing in interactive mode. One book that was online suggested quit(), which surprise -- quit the program. Should c...
How to get out of interactive mode in Python
0
0
1
0
0
7,387
3,902,996
2010-10-11T01:28:00.000
2
0
1
0
0
python,debugging,ide
0
3,903,006
0
6
0
false
0
0
Yes, coding should be done in a different program. The interactive shell is very useful but it's not an editor.
4
3
0
0
This obviously an extremely novice question, but I've installed Python 2.7 and started reading the manual. However I looked and looked, and couldn't understand how to start programming a file rather than writing in interactive mode. One book that was online suggested quit(), which surprise -- quit the program. Should c...
How to get out of interactive mode in Python
0
0.066568
1
0
0
7,387
3,905,791
2010-10-11T11:33:00.000
1
0
0
1
0
python,twisted,factory
0
3,906,174
0
1
0
false
1
0
No. Write a class that does the interaction with one user. In connectionMade you check if a instance of this class already exists, if not you make a new one and store it on the factory, ie in a { addr : handler } dict. If the connection exists alreay you get the old handler from the factory.
1
0
0
0
Hey, I got a ReconnectingClientFactory and I wonder if I can somehow define protocol-instance-based connectionMade/connectionLost callbacks so that i can use the factory to connect to different hosts ans distinguish between each connection. Thanks in advance.
Twisted factory protocol instance based callback
0
0.197375
1
0
0
499
3,912,579
2010-10-12T07:53:00.000
2
0
0
0
0
python,django,installation
0
3,912,677
0
1
0
true
1
0
It is very likely that the py extension is linked with the editor rather than the Python interpreter. Right-click on a py file and click "Open with" then select the default program and choose 'C:...\Python2x\python.exe' That should fix the pb
1
1
0
0
I've got an issue when installing Django. The official guide says open cmd with administrator privileges and run "setup.py install" I did this but then the system default python editor came out, I don't know how to do anymore, please help me~
Issue happens when installing Django on Windows 7
0
1.2
1
0
0
494
3,913,217
2010-10-12T09:30:00.000
-1
1
1
0
0
python,programming-languages,namespaces
0
3,913,281
0
6
0
false
0
0
If you make a big program with someone else, you could write your own part of the program as you want. All variables in the file will be private, there will be no collisions. When you write PHP programs, it is easy to rewrite global variables by mistake. In python you can import other modules variables if you want, and...
2
47
0
0
I have just started learning Python & have come across "namespaces" concept in Python. While I got the jist of what it is, but am unable to appreciate the gravity of this concept. Some browsing on the net revealed that one of the reasons going against PHP is that it has no native support for namespaces. Could someone ...
What are Python namespaces all about
0
-0.033321
1
0
0
29,735
3,913,217
2010-10-12T09:30:00.000
49
1
1
0
0
python,programming-languages,namespaces
0
3,913,488
0
6
0
true
0
0
Namespace is a way to implement scope. In Java (or C) the compiler determines where a variable is visible through static scope analysis. In C, scope is either the body of a function or it's global or it's external. The compiler reasons this out for you and resolves each variable name based on scope rules. External...
2
47
0
0
I have just started learning Python & have come across "namespaces" concept in Python. While I got the jist of what it is, but am unable to appreciate the gravity of this concept. Some browsing on the net revealed that one of the reasons going against PHP is that it has no native support for namespaces. Could someone ...
What are Python namespaces all about
0
1.2
1
0
0
29,735
3,914,725
2010-10-12T12:35:00.000
5
0
1
0
0
python,number-formatting
0
3,914,765
0
8
0
false
0
0
x = round(293.4662543, 2)
1
32
0
0
How to shorten the float result I got? I only need 2 digits after the dot. Sorry I really don't know how to explain this better in English... Thanks
How to turn a float number like 293.4662543 into 293.47 in python?
0
0.124353
1
0
0
103,306
3,916,553
2010-10-12T15:50:00.000
-5
1
0
0
1
python,garbage-collection,root,performance
0
3,919,321
0
3
1
false
0
1
If your problem really is the garbage collection, try explicitly freeing your objects when you're done with them using del(). In general, this doesn't sound like a garbage collection problem, unless we're talking about terabytes of memory. I agree with S.Lott... profile your app, then bring code snippets and the result...
1
18
0
0
I have a problem with my python application, and I think it's related to the python garbage collection, even if I'm not sure... The problem is that my application takes a lot of time to exit and to switch to one function to the next one. In my application I handle very large dictionaries, containing thousands of large ...
Python garbage collection can be that slow?
0
-1
1
0
0
13,216
3,940,057
2010-10-15T06:45:00.000
1
1
0
0
0
python,snmp,fitnesse,net-snmp,pysnmp
1
3,968,271
0
1
1
true
0
0
The engineTime and engineBoots values are probably what is messing you up because SNMPv3 requires they not go backwards. If you have an agent that is restarting from scratch and not incrementing it's boots count (which is illegal, but under tests I could see why you'd be doing that) then you'd need to reset the intern...
1
1
0
0
I'm trying to create automated integration tests for this hardware+software test subject which runs a SNMP agent as it's command interface. Our test setup looks like this: We're using Fitnesse as a test runner and PyFit to be able to write the tests in Python. We then use netsnmp with Python bindings to send SNMP comma...
Resetting all global internal state of the net-snmp library from the Python bindings
0
1.2
1
0
0
731
3,945,750
2010-10-15T20:11:00.000
9
0
0
0
0
python,beautifulsoup
0
45,193,575
0
2
0
false
1
0
with bs4 things have changed a little. so the code should look like this soup = BeautifulSoup(htmlstring,'lxml') soup.find_all('div', {'style':"width=300px;"})
1
29
0
0
I can traverse generic tags easily with BS, but I don't know how to find specific tags. For example, how can I find all occurances of <div style="width=300px;">? Is this possible with BS?
Find a specific tag with BeautifulSoup
0
1
1
0
1
62,029
3,949,739
2010-10-16T16:33:00.000
0
0
0
0
0
python,html
0
5,693,726
0
2
0
false
1
0
urllib.unquote() on its own may still cause problems by throwing the exception: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position n: ordinal not in range(128) In that case try: print urllib.unquote("Ober%C3%B6sterreich.txt").decode("utf8")
1
0
0
0
I always found links in html source stored in such format, the question is how do I change such links back to what it's normally like? Thanks a lot!
How to turn an encoded link such as "http%3A%2F%2Fexample.com%2Fwhatever" into "http://example.com/whatever" in python?
0
0
1
0
1
797
3,955,077
2010-10-17T20:12:00.000
1
0
0
0
0
python,image,r,analysis
0
3,964,945
0
5
0
false
0
0
Try the rgdal package. You will be able to read (import) and write (export) GeoTiff image files from/to R. Marcio Pupin Mello
1
15
1
0
I would like to know how I would go about performing image analysis in R. My goal is to convert images into matrices (pixel-wise information), extract/quantify color, estimate the presence of shapes and compare images based on such metrics/patterns. I am aware of relevant packages available in Python (suggestions relev...
Image analysis in R
0
0.039979
1
0
0
4,953
3,958,224
2010-10-18T10:24:00.000
1
0
0
1
0
python,google-app-engine
0
3,959,150
0
2
0
false
1
0
Afaik you can not store files in App Engine programmatically. You can just store them, when uploading your app. You can however store information in its data store. So you would need to deploy an app, that authenticates your user and then writs the image to the gae's data store
1
1
0
0
I am not running Django on AppEngine. I just want to use AppEngine as a content delivery network, basically a place I can host and serve images for free. It's for a personal side project. The situation is this: I have the URL of an image hosted on another server/provider. Instead of hotlinking to that image its better ...
Uploading images from a django application to a Google AppEngine application
0
0.099668
1
0
0
269