Q_Id
int64
337
49.3M
CreationDate
stringlengths
23
23
Users Score
int64
-42
1.15k
Other
int64
0
1
Python Basics and Environment
int64
0
1
System Administration and DevOps
int64
0
1
Tags
stringlengths
6
105
A_Id
int64
518
72.5M
AnswerCount
int64
1
64
is_accepted
bool
2 classes
Web Development
int64
0
1
GUI and Desktop Applications
int64
0
1
Answer
stringlengths
6
11.6k
Available Count
int64
1
31
Q_Score
int64
0
6.79k
Data Science and Machine Learning
int64
0
1
Question
stringlengths
15
29k
Title
stringlengths
11
150
Score
float64
-1
1.2
Database and SQL
int64
0
1
Networking and APIs
int64
0
1
ViewCount
int64
8
6.81M
7,712,554
2011-10-10T12:12:00.000
1
1
0
0
python,imap
7,793,784
1
true
1
0
The UID is guaranteed to be unique. Store each one locally.
1
0
0
I am working on an application that is supposed to connect to IMAP account, read through emails and pick out emails sent by lets say "Mark", then it is supposed to respond to mark with an automatic response such as "Got it mate" and then do the same tomorrow, with the only difference that tomorrow it should not respond...
Best way to earmark messages in an IMAP folder?
1.2
0
0
59
7,715,263
2011-10-10T15:38:00.000
1
0
0
0
python,django,django-1.3,django-forms
7,715,301
2
false
1
0
Just exclude the sender field from the ModelForm and, when you instantiate the object in the view on the POST endpoint (just before saving), make sure you populate the sender field with the appropriate session or user ID. When you exclude the field, there is no way to add the field to the post data[1], so a user can't ...
1
0
0
Imagine we're developing a message system, and each Message has a foreign key for sender. We're using ModelForms, and there is a MessageForm that infers its fields from Message. Of course, we don't want the user to be able to spoof sender by posting a different sender ID. Therefore, we must exclude sender from ModelF...
What's the cleanest way to add arbitrary data to ModelForm?
0.099668
0
0
209
7,716,357
2011-10-10T17:22:00.000
1
0
1
1
python,permissions,cygwin
16,814,809
8
false
0
0
This seems to be a late answer, but may be useful for others. I got the same kinda error, when I was trying to run a shell script which used python. Please check \usr\bin for existence of python. If not found, install that to solve the issue. I come to such a conclusion, as the error shows "bad interpreter".
2
10
0
I'm using cygwin on windows 7 to run a bash script that activates a python script, and I am getting the following error: myscript.script: /cydrive/c/users/mydrive/folder/myscript.py: usr/bin/env: bad interpreter: Permission Denied. I'm a total newbie to programming, so I've looked around a bit, and I think this means P...
usr/bin/env: bad interpreter Permission Denied --> how to change the fstab
0.024995
0
0
33,994
7,716,357
2011-10-10T17:22:00.000
0
0
1
1
python,permissions,cygwin
26,632,686
8
false
0
0
You should write your command as 'python ./example.py ',then fix it in your script.
2
10
0
I'm using cygwin on windows 7 to run a bash script that activates a python script, and I am getting the following error: myscript.script: /cydrive/c/users/mydrive/folder/myscript.py: usr/bin/env: bad interpreter: Permission Denied. I'm a total newbie to programming, so I've looked around a bit, and I think this means P...
usr/bin/env: bad interpreter Permission Denied --> how to change the fstab
0
0
0
33,994
7,718,034
2011-10-10T20:05:00.000
4
0
0
0
python,statistics,machine-learning,pseudocode
7,725,290
4
false
0
0
You need a numerical optimisation procedure. Not sure if anything is implemented in Python, but if it is then it'll be in numpy or scipy and friends. Look for things like 'the Nelder-Mead algorithm', or 'BFGS'. If all else fails, use Rpy and call the R function 'optim()'. These functions work by searching the function ...
1
28
1
I need to code a Maximum Likelihood Estimator to estimate the mean and variance of some toy data. I have a vector with 100 samples, created with numpy.random.randn(100). The data should have zero mean and unit variance Gaussian distribution. I checked Wikipedia and some extra sources, but I am a little bit confused si...
Maximum Likelihood Estimate pseudocode
0.197375
0
0
47,657
7,720,130
2011-10-11T00:19:00.000
0
0
1
0
python
7,720,804
3
false
0
0
here is my version: for x in ['abc','123','a1']: print next((f(v.groups()) for p, f in my_map for v in [p(x)] if v), None) this version does not iterate over the whole my_map but stops as soon as the first successful mapping is found.
1
1
0
Given a list of items, and a map from a predicate function to the "value" function, the code below applies "value" functions to the items satisfying the corresponding predicates: my_re0 = re.compile(r'^([a-z]+)$') my_re1 = re.compile(r'^([0-9]+)$') my_map = [ (my_re0.search, lambda x: x), (my_re1.search, lambd...
is there a way to make this code more terse?
0
0
0
522
7,720,932
2011-10-11T02:55:00.000
0
1
0
0
python,tcp,speex,pyaudio
13,102,430
1
false
1
0
Did you run ping or ttcp to test network performance between the 2 hosts? If you have latency spikes or if some packets are dropped your approach to sending voice stream will suffer badly. TCP will wait for missing packet, report it being lost, wait for retransmit, etc. You should be using UDP over lossy links and audi...
1
2
0
Hello I am having problems with audio being sent over the network. On my local system with no distance there is no problems but whenever I test on a remote system there is audio but its not the voice input i want its choppy/laggy etc. I believe its in how I am handling the sending of the audio but I have tried now for ...
Python Audio over Network Problems
0
0
1
2,438
7,721,920
2011-10-11T05:59:00.000
3
0
1
0
python,self
7,721,961
4
false
0
0
For instance variable and for methods it is mandatory to use self anytime.
2
38
0
Are you supposed to use self when referencing a member function in Python (within the same module)? More generally, I was wondering when it is required to use self, not just for methods but for variables as well.
When do you use 'self' in Python?
0.148885
0
0
54,178
7,721,920
2011-10-11T05:59:00.000
4
0
1
0
python,self
7,724,210
4
false
0
0
There is nothing 'special' about the name self. It is the name preferred by convention by Pythonistas, to indicate what that parameter is expected to contain. The Python runtime will pass a 'self' value when you call an instance method on an instance, whether you deliberately provide for it or not. This will usually re...
2
38
0
Are you supposed to use self when referencing a member function in Python (within the same module)? More generally, I was wondering when it is required to use self, not just for methods but for variables as well.
When do you use 'self' in Python?
0.197375
0
0
54,178
7,722,876
2011-10-11T07:48:00.000
2
0
0
0
java,python,web-crawler,web-scraping,web-mining
7,723,049
6
false
1
0
If you are going to builld a crawler you need to (Java specific): Learn how to use the java.net.URL and java.net.URLConnection classes or use the HttpClient library Understand http request/response headers Understand redirects (both HTTP, HTML and Javascript) Understand content encodings (charsets) Use a good librar...
1
2
0
I want to crawl and save some webpages as HTML. Say, crawl into hundreds popular websites and simply save their frontpages and the "About" pages. I've looked into many questions, but didn't find an answer to this from either web crawling or web scraping questions. What library or tool should I use to build the solution...
Web mining or scraping or crawling? What tool/library should I use?
0.066568
0
1
4,419
7,723,399
2011-10-11T08:43:00.000
0
0
0
1
python,ipython
7,723,501
2
false
0
0
I think it is not possible provide full functionality of IPython, such as auto complete,.. Twisted has python shell that works well with telnet.
1
1
0
I am trying to write a simple telned server that will expose a IPython shell to the connected client. Does someone know how to do that ? The question is really about embedding the IPython shell into the Telnet server (I can probably use Twisted for the Telnet server part ) Thx
Writing a telnet server in Python and embedding IPython as shell
0
0
0
830
7,726,852
2011-10-11T13:31:00.000
3
0
1
0
python,matplotlib,fonts
40,742,939
3
false
0
0
On *nix, you can use all your system fonts by enabling matplotlib's fontconfig backend. However matplotlib does not really talk to fontconfig libraries it emulates its behaviour by running fontconfig cli utilities. Therefore, nuking the matplotlib fontconfig cache so it discovers new fonts can be a lifesaver (the exist...
1
47
0
How can I use any type of font in my font library on my computer (e.g. *otf or *ttf) in all my matplotlib figures?
How to use a (random) *.otf or *.ttf font in matplotlib?
0.197375
0
0
19,357
7,727,017
2011-10-11T13:42:00.000
0
0
1
1
python,windows,interpreter,ipython
7,820,862
4
true
0
0
Found a solution: python27.exe c:\Python27\Scripts\ipython-script.py
4
0
0
If I rename the python interpreter from C:\Python27\python.exe to C:\Python27\python27.exe and run it, it will not complain. But if I now try to run C:\Python27\Scripts\ipython.exe, it will fail to start because now the python interpreter has a different filename. My question is: how do I configure IPython (ms windows)...
Running IPython after changing the filename of python.exe
1.2
0
0
550
7,727,017
2011-10-11T13:42:00.000
1
0
1
1
python,windows,interpreter,ipython
7,727,342
4
false
0
0
Try to find Python in windows registry and changes path to python. After that try to reinstall ipython.
4
0
0
If I rename the python interpreter from C:\Python27\python.exe to C:\Python27\python27.exe and run it, it will not complain. But if I now try to run C:\Python27\Scripts\ipython.exe, it will fail to start because now the python interpreter has a different filename. My question is: how do I configure IPython (ms windows)...
Running IPython after changing the filename of python.exe
0.049958
0
0
550
7,727,017
2011-10-11T13:42:00.000
0
0
1
1
python,windows,interpreter,ipython
7,727,120
4
false
0
0
I do not know if there is a config file where you can change, but you may have to recompile Ipython and change the interpreter variables. But why do you need to rename it to python27.exe when it already is in a python27 folder?
4
0
0
If I rename the python interpreter from C:\Python27\python.exe to C:\Python27\python27.exe and run it, it will not complain. But if I now try to run C:\Python27\Scripts\ipython.exe, it will fail to start because now the python interpreter has a different filename. My question is: how do I configure IPython (ms windows)...
Running IPython after changing the filename of python.exe
0
0
0
550
7,727,017
2011-10-11T13:42:00.000
0
0
1
1
python,windows,interpreter,ipython
7,727,290
4
false
0
0
instead of renaming python.exe, make sure the path to the python you want to run is before the path to other pythons
4
0
0
If I rename the python interpreter from C:\Python27\python.exe to C:\Python27\python27.exe and run it, it will not complain. But if I now try to run C:\Python27\Scripts\ipython.exe, it will fail to start because now the python interpreter has a different filename. My question is: how do I configure IPython (ms windows)...
Running IPython after changing the filename of python.exe
0
0
0
550
7,730,207
2011-10-11T17:45:00.000
1
0
1
1
python,macos,macports,homebrew
7,730,290
1
true
0
0
Macports installs the packages in /opt/local/ and /opt/local/bin. You can always find your default OS package installation in /bin and /usr/bin. OS default python installation: /usr/bin/python Of course, you can choose the macports by having /opt/local/bin first in your path. Macport installation works very well for me...
1
0
0
I have already Python 2.7 on my Mac Os 10.7 and i tried to install py27-mysql package that contains MySQLdb interface for Python. I had run sudo ports install py27-mysql and macports began to install all dependencies for that package python2.7, mysql5, etc that I already has. Now the questions: Why that happens? Wher...
Macports duplicate packages
1.2
0
0
156
7,730,257
2011-10-11T17:50:00.000
6
0
0
0
python,django,apache,mod-wsgi
7,732,719
1
true
1
0
It is actually really difficult to terminate a single Python request thread in a multithread application. The best you can do is make a decision to shutdown the whole process and restart it. Because such an action will disrupt concurrent requests, you would as a result really need to restrict yourself to a single threa...
1
6
0
I've got a setup with Apache + mod_wsgi running django code, and I'd like to add a layer of protection in case a non-terminating view slips in. Something that kills-off a requests exceeding, say, 30 seconds would be ideal. For testing I've just put a time.sleep(60) in a view. I've tried the TimeOut 30 setting in Apach...
Auto-Terminating Long-Running Requests in Django
1.2
0
0
1,440
7,731,324
2011-10-11T19:20:00.000
42
0
1
1
python,pydev
7,742,529
2
true
0
0
Ctrl+Shift+G will find all the references to a function in PyDev (F3 will go to the definition of a function).
1
35
0
This has probably been asked before but I can't seem to find the answer. I've moved from windows to Linux and started using PyDev (Aptana) recently but what I cannot seem to find is how to find all references to a function.
pydev: find all references to a function
1.2
0
0
10,065
7,732,779
2011-10-11T21:31:00.000
0
0
0
1
python,html,bash,shell
7,732,882
3
false
0
0
If you're retrieving data over http, there is no guarantee that what you're requesting corresponds to a physical file or anything else with a concept of a "last modified" date, so within the http protocol there's no way (other than Last-Modified) to know. You will probably want to retrieve the file if you don't have a ...
1
3
0
I am attempting to write a bash shell script that will evaluate the modified date of a file on a remote web site and download the file if it is more recent than the local copy. Part of the script is already written. The part that has been developed uses the header Last-Modified parameter. I need to have an alternat...
Get modified date of file on web site without using the Last-Modified header value
0
0
0
2,597
7,733,364
2011-10-11T22:36:00.000
1
0
1
0
python,transparency,python-imaging-library,indexed-image
7,733,515
2
false
0
0
Once you merge the two images, you won't have two colors any more - the colors will combine based on the transparency of each one at every pixel location. Worst case, you will have 256*256=65536 colors, which can't be indexed and wouldn't compress well if you did. I would suggest saving as a PNG and let the lossless co...
1
5
0
I wonder how I could create a image with a transparent background and only 2 indexed colours (red and blue) to minimise the file size? More specifically I have two black and white images that I want to convert, one to transparent and blue and the other to transparent and red. Then I want to merge those 2 images. I coul...
Python PIL: Create indexed color image with transparent background
0.099668
0
0
6,876
7,733,969
2011-10-12T00:15:00.000
2
0
0
0
python,numpy,machine-learning,scipy
7,734,072
4
false
0
0
You can import the random module and call random.random to get a random sample from [0, 1). You can double that and subtract 1 to get a sample from [-1, 1). Draw d values this way and the tuple will be a uniform draw from the cube [-1, 1)^d.
1
7
1
How can I generate a uniformly distributed [-1,1]^d data in Python? E.g. d is a dimension like 10. I know how to generate uniformly distributed data like np.random.randn(N) but dimension thing is confused me a lot.
Uniformly distributed data in d dimensions
0.099668
0
0
13,886
7,736,105
2011-10-12T06:29:00.000
4
0
0
1
javascript,python,google-app-engine,channel-api
7,741,709
1
true
1
0
The amount of time it takes the Channel API front-end servers to "realize" that a channel is disconnected is contingent on browser implementation. On well-behaved browsers, we catch the beforeunload event and post a message to our front-end that says, "this client is going away." On other browsers, we may not get the e...
1
4
0
Im using my GAE application on my phone. I face a problem in getting the disconnect notification to /_ah/channel/disconnected in channels api even if i manually close the socket by socket.close() function. the post occurs after a delay of say one minute. Does anyone know the way to speed things up? In my case socket.c...
Channel disconnect notification in channel api in google app engine
1.2
0
1
1,617
7,736,480
2011-10-12T07:13:00.000
0
0
1
1
python,file,identification,imghdr
7,736,514
3
false
0
0
There are standard modules imghdr and sndhdr for graphic and sound files, respectively.
1
4
0
In linux, we have a utility called “file”, which helps us to determine the identification of a file. Is there any python module that can do the same job? I don't prefer to use subprocess.Popen(['file', 'blah.blah']), because it is platform dependent. For instance, windows do not have “file” (although it can be download...
identifying the format of files
0
0
0
211
7,740,771
2011-10-12T13:24:00.000
2
0
0
0
python,django,rabbitmq
9,051,453
2
false
1
0
In AMQP, you don't create a queue. Instead, you declare a queue, and if the queue doesn't already exist, then it is created. In some cases all you need to do is to declare the queue in the processes that consume messages. But if you want persistent and durable queues then it is best to declare them beforehand with a sh...
1
1
0
I'm working on project that need to control sending queue by code. So I just curious that anybody use to create queue in rabbitmq by python/django code? :)
Can we create queue in rabbitmq with python
0.197375
0
0
1,697
7,740,796
2011-10-12T13:26:00.000
1
0
1
0
python,unit-testing,python-3.x
7,742,929
4
false
0
0
Another way to do it: ranges_equal = str(a)==str(b) The string representation indicates the start, end and step of ranges. This question makes me think that perhaps Python should provide a way to get these attributes from the range object itself!
2
6
0
One of my unittests checks to see if a range is set up correctly after reading a log file, and I'd like to just test var == range(0,10). However, range(0,1) == range(0,1) evaluates to False in Python 3. Is there a straightforward way to test the equivalence of ranges in Python 3?
How to test equivalence of ranges
0.049958
0
0
443
7,740,796
2011-10-12T13:26:00.000
6
0
1
0
python,unit-testing,python-3.x
7,741,846
4
false
0
0
The first proposed solution - use "list" to turn the ranges into lists - is ineffecient, since it will first turn the range objects into lists (potentially consuming a lot of memory, if the ranges are large), then compare each element. Consider e.g. a = range(1000000), the "range" object itself is tiny but if you coe...
2
6
0
One of my unittests checks to see if a range is set up correctly after reading a log file, and I'd like to just test var == range(0,10). However, range(0,1) == range(0,1) evaluates to False in Python 3. Is there a straightforward way to test the equivalence of ranges in Python 3?
How to test equivalence of ranges
1
0
0
443
7,742,965
2011-10-12T15:58:00.000
2
1
0
0
python,ftp
7,743,098
1
true
0
0
You can override the default behaviour or you ftp server by using a custom FTPHandler and overriding the FTPHandler.ftp_TYPE(filetype) method and this way force your server to serve file in binary mode self._current_type = "i".
1
3
0
We have devices that run a proprietary FTP client on them. They retrieve media files (AVI videos and Images) as well as XML files from our web service utilizing a python based FTP server. The problem I'm having is that the FTP client wants to download the media files in ASCII mode instead of binary mode. I'd like to co...
Can you force an FTP client to use binary from the server side
1.2
0
1
1,814
7,743,281
2011-10-12T16:23:00.000
3
0
1
1
python,variables,path,environment
10,164,902
5
false
0
0
I know it's been a while, but I hope this could help someone else. I had the same problem and the only way to making it work was running cmd or powershell as administrator.
2
1
0
So for some reason, my computer refuses to see the environment PATH variable. In the path variable, I have: C:\Python32; listed, along with all of the other programs, but it doesn't work if I type, "python" into the command window. However, I can type "python" into the run window, and have it run the correct interprete...
Can't set Python environment PATH variable?
0.119427
0
0
15,504
7,743,281
2011-10-12T16:23:00.000
4
0
1
1
python,variables,path,environment
53,708,878
5
false
0
0
I faced the same issue. However, in my case, I went through the documentation from python and found where I was making mistake. In the latest python versions, if you type 'python' in cmd, it will show error. At the same time, the command that worked for me was 'py'. So I recommend anyone facing a similar problem to t...
2
1
0
So for some reason, my computer refuses to see the environment PATH variable. In the path variable, I have: C:\Python32; listed, along with all of the other programs, but it doesn't work if I type, "python" into the command window. However, I can type "python" into the run window, and have it run the correct interprete...
Can't set Python environment PATH variable?
0.158649
0
0
15,504
7,743,653
2011-10-12T16:54:00.000
5
0
0
1
python,google-app-engine
7,744,371
1
true
1
0
There is no way to avoid changing the app ID, but you can request that the old ID be aliased so requests to old_appid.appspot.com will be handled by the new application. If you're serving the application on your own domain, of course, the app ID is irrelevant. The Master/Slave datastore will almost certainly never be s...
1
4
0
For tons of reasons, I would like to go ahead and switch to Python 2.7. The new python version requires using the High Replication Datastore. As far as I can see, converting to it is not really possible: the only way is to create a new app, with new ID, and copy over the datastore. Changing my app ID is something I am ...
AppEngine: switching to Python 2.7
1.2
0
0
839
7,744,258
2011-10-12T17:46:00.000
46
0
0
0
python,eclipse,pydev
7,744,283
2
true
0
0
Check in: Preferences > PyDev > Editor > Code Style > Code Formatter and check the "Right trim lines?" check box.
1
39
0
Ideally, eclipse should remove all trailing whitespace when I save the file. I know there is option for this in C++/Java plugins for eclipse, but I couldnt find one for PyDev. Is there one? If not, whats the easiest way to achieve this?
How to remove trailing whitespace in PyDev plugin for Eclipse
1.2
0
0
11,034
7,745,997
2011-10-12T20:13:00.000
0
0
0
1
python,django,crash,interpreter,osx-lion
7,747,494
1
false
1
0
It looks like its the mysql-extension that crashes, if you have XCode you can try to make sure you have the latest one compiled locally and installed.
1
1
0
I'm running Python 2.7.1 on 64-bit Mac OSX Lion. Python keeps crashing while I'm running my local Django 1.3 development server. The error log is below. This is starting to get annoying. Any ideas? Process: Python [22917] Path: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Co...
Python quit unexpectedly while running Django
0
0
0
1,009
7,746,344
2011-10-12T20:44:00.000
23
0
0
0
python,django,metaprogramming
7,747,777
3
false
1
0
It's not my place to speak about its worth or recommendations, but I wrote the book with Django 1.0 in mind precisely to make sure it stayed relevant as long as possible. The aspects of Django that I documented are still present and functional, and the general aspects of Python are also still valid. They may have grown...
2
12
0
I want to dig deeper into Django's internals and the official online documentation only goes so far toward that end. The reviews for Marty Alchin's Pro Django are fantastic (I've read Pro Python and really enjoyed it). However, the book is from 2008 and is based on Django v1.0. My company builds off v1.3. Is this bo...
Is Pro Django book still relevant?
1
0
0
2,272
7,746,344
2011-10-12T20:44:00.000
8
0
0
0
python,django,metaprogramming
7,746,386
3
true
1
0
Yes, it's definitely still relevant. Although a lot has changed in Django since version 1, the internal parts and the concepts that Pro Django deals with are mostly the same. I'd have no hesitation in recommending the book - it's a really useful insight into how Django works and teaches some very useful methods as well...
2
12
0
I want to dig deeper into Django's internals and the official online documentation only goes so far toward that end. The reviews for Marty Alchin's Pro Django are fantastic (I've read Pro Python and really enjoyed it). However, the book is from 2008 and is based on Django v1.0. My company builds off v1.3. Is this bo...
Is Pro Django book still relevant?
1.2
0
0
2,272
7,746,484
2011-10-12T20:57:00.000
0
0
1
0
python,multiprocessing
7,746,882
2
false
0
0
The error you're seeing could be caused by passing the wrong kind of function to the multiprocessing.Pool methods. The passed function must be directly importable from its parent module. It cannot be a method of a class, for instance.
1
0
1
I have a complex Python program. I'm trying to use the multiprocess Pool to parallelize it. I get the error message PicklingError: Can't pickle <type 'function'>: attribute lookup __builtin__.function failed. The traceback shows the statemen return send(obj) My hypothesis is that its the "obj" that is causing the probl...
in Python using the multiprocessing module, how can I determine which object caused a PicklingError?
0
0
0
82
7,747,852
2011-10-12T23:43:00.000
0
0
0
0
javascript,python,macos,unix,controls
7,747,962
3
false
1
0
On the client side (the browser), you can do it with the simplest approach. Just an html form. javascript would make it nicer for validation and to do ajax calls so the page doesnt have to refresh. But your main focus is handling it on the server. You could receive the form request in the language of your choice. If yo...
2
0
0
I want to have a "control panel" on a website, and when a button is pressed, I want it to run a command on the server (my computer). The panel is to run different python scripts I wrote (one script for each button), and I want to run the panel on my Mac, my iPod touch, and my wii. The best way I see for this is a web...
Running command with browser
0
0
1
198
7,747,852
2011-10-12T23:43:00.000
0
0
0
0
javascript,python,macos,unix,controls
7,747,896
3
true
1
0
Here are three options: Have each button submit a form with the name of the script in a hidden field. The server will receive the form parameters and can then branch off to run the appropriate script. Have each button hooked to it's own unique URL and use javascript on the button click to just set window.location to ...
2
0
0
I want to have a "control panel" on a website, and when a button is pressed, I want it to run a command on the server (my computer). The panel is to run different python scripts I wrote (one script for each button), and I want to run the panel on my Mac, my iPod touch, and my wii. The best way I see for this is a web...
Running command with browser
1.2
0
1
198
7,750,560
2011-10-13T07:07:00.000
4
1
0
1
python,logging,syslog
31,257,970
3
false
0
0
The advantages of using syslog where available (all modern *nix systems, including Linux, FreeBSD, OS-X etc.) are numerous: Performance is better: syslog is compiled C and most importantly it works as a separate process so all your logging operations become non-blocking to the applications, processes, and threads that...
1
6
0
We are using a basic python log server based on BaseHTTPServer to aggregate our python logs on an ubunutu server. This solution has fulfilled our needs... until now. The number of programs dumping to this log server has grown and now the logger is crippling the system. Now that we are back to the drawing board, we ...
What are the advantages of using syslog over other logging facilites?
0.26052
0
0
3,342
7,751,767
2011-10-13T09:06:00.000
6
0
1
0
python,python-3.x,ironpython
7,753,276
2
true
0
0
There is as far as I know no planned release date for 3.0 support in IronPython. The migration process for IronPython 2 -> IronPython 3 is the same as for CPython 2 -> CPython 3, afaik.
2
13
0
I love the Python language and mainly use the standard CPython 3.+ version for simple scripting and as an algorithm sandbox. Sometimes I need .NET intergration, so I use IronPython which is now in 2.7 version. I like 3.+ better and am therefore reluctant to use the older 2.7. Is there any info on when will it be relea...
IronPython 3 compatibility
1.2
0
0
4,532
7,751,767
2011-10-13T09:06:00.000
19
0
1
0
python,python-3.x,ironpython
7,757,810
2
false
0
0
IronPython has one big step towards Py3k support - its strings are already unicode. Many of the native modules are already in place because they were backported to Python 2.7. The re-arranged standard library is free because it's just copied from CPython. The time-consuming part are the parser changes such as function ...
2
13
0
I love the Python language and mainly use the standard CPython 3.+ version for simple scripting and as an algorithm sandbox. Sometimes I need .NET intergration, so I use IronPython which is now in 2.7 version. I like 3.+ better and am therefore reluctant to use the older 2.7. Is there any info on when will it be relea...
IronPython 3 compatibility
1
0
0
4,532
7,752,532
2011-10-13T10:09:00.000
1
0
1
0
python,ipython
7,754,105
1
true
0
0
If you give the script a .ipy extension, ipython's special syntax (like !ls) should work when you do ipython myscript.ipy.
1
1
0
It's so convenient to use shell escape from interactive environment in ipython, but is it possible to call python script containing shell escape from ipython?
how can i run a script containing shell escape from ipython?
1.2
0
0
178
7,755,325
2011-10-13T14:03:00.000
2
0
1
0
shortcut,python
7,755,411
3
false
0
0
One shortcut is the space bar - it displays the next page of the help text (instead of the next line like Enter).
3
3
0
What are shortcuts of Python help() function used in Python interpreter? I'm interested for help content that doesn't fit to window and shows "-- More --" at the bottom. I found q quits help(). What is a shortcut to show the whole article w/o pressing Enter many times?
python help() function shortcuts
0.132549
0
0
2,499
7,755,325
2011-10-13T14:03:00.000
4
0
1
0
shortcut,python
7,755,394
3
true
0
0
On my (Linux) machine help seems to be using "less". Press "h" when in help to see a complete list of shortcuts/commands. I'm not sure if this will work on Windows though.
3
3
0
What are shortcuts of Python help() function used in Python interpreter? I'm interested for help content that doesn't fit to window and shows "-- More --" at the bottom. I found q quits help(). What is a shortcut to show the whole article w/o pressing Enter many times?
python help() function shortcuts
1.2
0
0
2,499
7,755,325
2011-10-13T14:03:00.000
3
0
1
0
shortcut,python
7,755,622
3
false
0
0
The help() function in Python interactive interpreter is based on the pydoc module. There's a function called getpager() in this module that decides what to use to display the help depending on various factors. In most cases it will use the less command on Linux and more on Windows.
3
3
0
What are shortcuts of Python help() function used in Python interpreter? I'm interested for help content that doesn't fit to window and shows "-- More --" at the bottom. I found q quits help(). What is a shortcut to show the whole article w/o pressing Enter many times?
python help() function shortcuts
0.197375
0
0
2,499
7,756,132
2011-10-13T14:58:00.000
2
0
0
1
python,google-app-engine,namespaces,user-accounts
7,757,039
1
true
1
0
If 'user identity' can span tenants (your apps), then keep user entities in a common namespace (the default namespace works fine for that, and that's the default when a request begins). Anything specific to a tenant (e.g., what authorization a user identity has for a specific tenant) can be stored where it is most conv...
1
2
0
i have an app with multiple tenants on GAE. over the 'master' (which is a tenant on its own) i let people register and create a subapp/tenant where the creator is the owner of the app. what is the best way to manage the user accounts? lets say USER_A creates APP_A and USER_B creates APP_B. so there are 2 users and 2 ...
account(s) management over multiple tenants
1.2
0
0
126
7,756,981
2011-10-13T16:00:00.000
0
0
0
1
python,eclipse,google-app-engine,pydev
17,769,623
5
false
1
0
adding ${GOOGLE_APP_ENGINE}/lib/webapp2-2.5.2 to the "External Libraries" worked for me. App Engine SDK ver:1.8.2 Python version: 2.7
3
6
0
I am attempting to try out Google App Engine with python. Being familiar with Eclipse, I decided to use PyDev. After some trouble, I have a hello world program working... almost. It cannot find the webapp2 import, telling me it is unresolved. I have followed all of the instructions I can find, and have the google a...
PyDev project for Google App Engine not finding webapp2
0
0
0
5,907
7,756,981
2011-10-13T16:00:00.000
3
0
0
1
python,eclipse,google-app-engine,pydev
7,789,156
5
false
1
0
The current SDK does not support the Python 2.7 runtime on the dev_appserver, so it doesn't bundle new libraries like webapp2. If all you need is the libraries, you can download them and include them in your app yourself, but if you need extra runtime features like multithreading and PIL, you will need to do your devel...
3
6
0
I am attempting to try out Google App Engine with python. Being familiar with Eclipse, I decided to use PyDev. After some trouble, I have a hello world program working... almost. It cannot find the webapp2 import, telling me it is unresolved. I have followed all of the instructions I can find, and have the google a...
PyDev project for Google App Engine not finding webapp2
0.119427
0
0
5,907
7,756,981
2011-10-13T16:00:00.000
3
0
0
1
python,eclipse,google-app-engine,pydev
8,238,441
5
false
1
0
I encounter this problem, too. And I follow TorelTwiddler's instruction -> he's right, there's no webapp2. You have to add ${GOOGLE_APP_ENGINE}/lib/webapp2 to the "External Libraries". This occurs because(I guess) you only change the interpreter of the project, not create a whole new GAE project with PyDev. This action...
3
6
0
I am attempting to try out Google App Engine with python. Being familiar with Eclipse, I decided to use PyDev. After some trouble, I have a hello world program working... almost. It cannot find the webapp2 import, telling me it is unresolved. I have followed all of the instructions I can find, and have the google a...
PyDev project for Google App Engine not finding webapp2
0.119427
0
0
5,907
7,757,059
2011-10-13T16:07:00.000
0
1
0
1
python,sockets,ssh,scp
7,757,147
3
false
0
0
This is not really python specific, but it probably depends on what libraries you can use. What you need is a way to send files through a single connection. (This is probably better suited to superuser or severfault.com though.) Create tarfile locally, upload it and unpack at target? Maybe you could even run 'tar x...
1
1
0
I'm using Python to transfer (via scp) and database a large number of files. One of the servers I transfer files to has odd ssh config rules to stop too many ssh requests from a single location. The upshot of this is that my python script, currently looping through files and copying via os.system, hangs after a few f...
open (and maintain) remote connection with python
0
0
1
696
7,758,160
2011-10-13T17:43:00.000
0
0
0
1
python,windows,apache
7,762,202
2
false
0
0
Common problems with Apache/mod_wsgi installation, if that is what you are trying to install are: Installing a mix of 32 and 64 bit binaries for Apache, Python and mod_wsgi. Not installing Python for all users on the system. Do either of those and Apache will not startup properly. Since you don't say what exactly fai...
1
0
0
I tried millions of times to install python with apache on my windows 7 32 bit. But failed. Can anybody tell me the simplest way to get it work???
Python - apache - windows 7 - wamp
0
0
0
255
7,758,898
2011-10-13T18:43:00.000
6
0
1
0
python,mongodb,indexing,mongoengine
9,082,609
2
true
0
0
You can add an index at any time and ensureIndex will be called behind the scenes so it will be added if it doesn't exist. If you remove an index from the meta - you will have to use pymongo or the shell to remove the index.
1
7
0
Best practice question about setting Mongo indexes. Mongoengine, the Python ORM wrapper, allows you to set indexes in the Document meta class. When is this meta class introspected and the index added? Can I build a collection via a mongoengine Document class and then add an index after the fact? If I remove the inde...
How does MongoEngine handle Indexes (creation, update, removal)?
1.2
1
0
2,747
7,758,913
2011-10-13T18:44:00.000
0
0
1
0
python,graph-algorithm
37,692,584
2
false
0
0
Implementing using adjacency is somewhat easier than using lists, as lists take a longer time and space. igraph has a quick method neighbors which can be used. However, with adjacency matrix alone, we can come up with our own graph coloring version which may not result in using minimum chromatic number. A quick strateg...
1
2
1
How can I implement graph colouring in python using adjacency matrix? Is it possible? I implemented it using list. But it has some problems. I want to implement it using matrix. Can anybody give me the answer or suggestions to this?
Graph colouring in python using adjacency matrix
0
0
0
1,943
7,760,382
2011-10-13T21:01:00.000
2
0
1
0
python,packages,uninstallation
7,760,419
1
false
0
0
If you just want to remove all the packages you've installed (as opposed to all of Python), you'd want to nuke your site-packages directory. To find it, from Python run >>> import some_package (where some_package is a package you've installed; setuptools is one you're likely to have), then run some_package.__file__. Th...
1
3
0
I installed some packages , but I think either some of the packages corrupted or are conflicting with versions Is there a good way to just uninstall every package and python itself?
How do I completely uninstall Python and all its packages?
0.379949
0
0
2,174
7,760,513
2011-10-13T21:14:00.000
2
0
0
0
python,persistence,nltk
7,766,483
1
true
1
0
I believe that the most efficient and quick way to accomplish that is to have a separate server or process which receives text and replies with the results of post_tag() function, or whatever function you want.
1
3
0
I'm using the Natural Language Toolkit for python and in it there is a useful function called pos_tag. You can run nltk.pos_tag() on any a list of words that were tokenized from a sentence and it will return a list of tuples with each word in the sentence and its part of speech (POS). Well thats great, but I need to r...
Keep python module in memory
1.2
0
0
292
7,761,339
2011-10-13T22:50:00.000
0
0
0
0
python,web2py
9,021,132
4
false
1
0
I say. Whatever you can work with from console. Some events may require fixing db from fingertip, you may also want to have some other ongoing actions in db and it might need to be done outside web2py. PosgreSQL is my choice as there are much less irregular behaviours thus its easier to grasp...
1
2
0
which is better for production with web2py? please more insights. I'm very new 2 web2py and i am working on a small pharmacy mgt system. pls which is better for production postgres or mysql? if postgres, step by step installation guide pls so to smoothly work with web2py. thanks
which is better for production with web2py?
0
1
0
1,454
7,761,859
2011-10-14T00:13:00.000
2
0
1
0
python,multithreading,numpy,multiprocessing,blas
7,761,877
2
false
0
0
If you are already using multiprocessing, and all cores are at max load, then there will be very little, if any, benefit to adding threads that will be waiting around for a processor. Depending on your algorithm and what you're doing, it may be more beneficial to use one type over the other, but that's very dependent.
2
5
1
Suppose I have a 16 core machine, and an embarrassingly parallel program. I use lots of numpy dot products and addition of numpy arrays, and if I did not use multiprocessing it would be a no-brainer: Make sure numpy is built against a version of blas that uses multithreading. However, I am using multiprocessing, and...
Is it worth using a multithreaded blas implementation along with multiprocessing in Python?
0.197375
0
0
2,321
7,761,859
2011-10-14T00:13:00.000
6
0
1
0
python,multithreading,numpy,multiprocessing,blas
7,765,829
2
false
0
0
You might need to be a little careful about the assumption that your code is actually used multithreaded BLAS calls. Relatively few numpy operators actually use the underlying BLAS, and relatively few BLAS calls are actually multithreaded. numpy.dot uses either BLAS dot, gemv or gemm, depending on the operation, but of...
2
5
1
Suppose I have a 16 core machine, and an embarrassingly parallel program. I use lots of numpy dot products and addition of numpy arrays, and if I did not use multiprocessing it would be a no-brainer: Make sure numpy is built against a version of blas that uses multithreading. However, I am using multiprocessing, and...
Is it worth using a multithreaded blas implementation along with multiprocessing in Python?
1
0
0
2,321
7,768,237
2011-10-14T13:21:00.000
0
1
0
0
eclipse,unit-testing,python-3.x,aptana,pydev
7,790,327
1
true
0
0
The question has been answered. -> Waiting for fix in next stable release -> Using nightly until fix available (thanks to Fabio for the hint)
1
0
0
It seems that it is not possible any more to use the PyDev test runner for the latest version of Aptana studio (3.0.5) (containing Pydev v 2.2.2) When running the unit tests, the following exception is through by the pydev-plugin: AttributeError: 'module' object has no attribute 'exc_clear' (Occurs in 'Aptana Studio 3\...
Apatana 3.0.5 (or Eclipse) using Pydev 2.2.2: Unit-tests not working any more for Python 3?
1.2
0
0
402
7,768,881
2011-10-14T14:11:00.000
0
1
0
1
php,python,project-management
7,786,309
2
false
0
0
For my PHP projects, I follow a very Java-esque naming convention (my background): index.php /classes/{organization type: net, org, com}/{organization name}/{component} /includes/ <- general configuration, etc; all non-executable; /lib/ <- third party libraries that are tied to specific releases; not modified, patche...
1
1
0
I still haven't gotten an answer that I'm happy with. Please do submit some answers if you have a nice system for your Python or PHP projects. I'm having a management issue with my PHP and Python projects. They both have two kinds of code files: files that should be run in the console or web browser, and files that sh...
How do I separate my executable files from my library files?
0
0
0
629
7,769,322
2011-10-14T14:43:00.000
1
0
0
0
python,regex,html-parsing,beautifulsoup
7,769,860
1
false
1
0
The problem is not with parsing the file. Using the link you gave in your comment to Marco, doing soup = BeautifulSoup(urllib.urlopen(your_link)) works absolutely fine. It's just when you try and print that parsed data to the console that you get a problem, because it's now been converted to Unicode, and Python will tr...
1
1
0
Beautiful Soup doesn't seem to work properly(for me) in case HTML contains unicodes whose ascii exceeds 128. What suitable decoding-encoding should be used for this ? raw = open('index.html').read() BeautifulSoup.BeautifulSoup(raw) Error ...stacktrace... UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9'...
Trouble with parsing HTML with unicodes through Beautiful Soup
0.197375
0
0
147
7,770,034
2011-10-14T15:37:00.000
-5
0
0
1
python,linux
7,770,065
4
false
0
0
You could just parse /etc/passwd, it's stored there.
1
34
0
There is os.getuid() which "Returns the current process’s user id.". But how do I find out any given user's id?
in Python and linux how to get given user's id
-1
0
0
48,007
7,772,378
2011-10-14T19:05:00.000
4
0
0
1
python,django,celery
13,168,517
2
true
1
0
The challenging part here seems to be identifying which celery tasks are new versus old. I would suggest creating another vhost in rabbitmq and performing the following steps: Update django web servers with new code and reconfigure to point to the new vhost. While tasks are queuing up in the new vhost, wait for celer...
2
9
0
I have a few celery nodes running in production with rabbitmq and I have been handling deploys with service interruption. I have to take down the whole site in order to deploy new code out to celery. I have max tasks per child set to 1, so in theory, if I make changes to an existing task, they should take effect when t...
reliable way to deploy new code into a production celery cluster without pausing service
1.2
0
0
1,747
7,772,378
2011-10-14T19:05:00.000
0
0
0
1
python,django,celery
7,780,065
2
false
1
0
a kind of work around for you can be to set the config variable MAX_TASK_PER_CHILD. This variable specify the number of task that a Pool Worker execute before kill himself. Off course when a new Pool Worker is executed this will load the new code. On my system normally I use to restart celery leaving other task running...
2
9
0
I have a few celery nodes running in production with rabbitmq and I have been handling deploys with service interruption. I have to take down the whole site in order to deploy new code out to celery. I have max tasks per child set to 1, so in theory, if I make changes to an existing task, they should take effect when t...
reliable way to deploy new code into a production celery cluster without pausing service
0
0
0
1,747
7,772,387
2011-10-14T19:06:00.000
1
1
0
0
python,facebook,browser,twill
7,773,528
2
false
0
0
Try to send user agent header w/ mechanize.
1
1
0
I'm trying to run some automated functional tests using python and Twill. The tests verify that my application's OAuth login and connection endpoints work properly. Luckily Twitter doesn't mind that Twill/Mechanize is accessing twitter.com. However, Facebook does not like the fact that I'm using Twill to access facebo...
How to configure the python Twill/Mechanize library to acces Facebook
0.099668
0
1
946
7,772,966
2011-10-14T20:04:00.000
0
0
1
0
python,csv
7,773,034
4
false
0
0
There is a csv module that will help you. And you'll probably want to look into time.sleep(), though there are better ways to deal with that (but given how new to the language you are, time.sleep() is probably a good starting point).
2
1
0
I started learning Python recently (5 hrs ago). Here's my scenario. I get mails every 4 hours from a remote measurement site with measurement values. The files are in *.csv format and the filenames are XX-2011-00001.csv and YY-2011-00001.csv. These are data of two instruments continuously running with different samplin...
Updating CSV files automatically
0
0
0
4,067
7,772,966
2011-10-14T20:04:00.000
1
0
1
0
python,csv
7,773,627
4
false
0
0
As others have said, the csv package contains great objects to handle the file I/O without writing a lot of low-level code. However, I would implement the time requirement using a cron job rather than sleeping your application, if it's available. It'll be more flexible, and it won't be susceptible to to a single unexp...
2
1
0
I started learning Python recently (5 hrs ago). Here's my scenario. I get mails every 4 hours from a remote measurement site with measurement values. The files are in *.csv format and the filenames are XX-2011-00001.csv and YY-2011-00001.csv. These are data of two instruments continuously running with different samplin...
Updating CSV files automatically
0.049958
0
0
4,067
7,773,341
2011-10-14T20:41:00.000
3
0
0
0
python,django,postgresql,model
31,082,203
9
false
1
0
You can use citext postgres type instead and not bother anymore with any sort of iexact. Just make a note in model that underlying field is case insensitive. Much easier solution.
1
63
0
I have basically a username is unique (case insensitive), but the case matters when displaying as provided by the user. I have the following requirements: field is CharField compatible field is unique, but case insensitive field needs to be searchable ignoring case (avoid using iexact, easily forgotten) field is stor...
Case insensitive unique model fields in Django?
0.066568
0
0
26,513
7,773,513
2011-10-14T21:01:00.000
0
0
0
1
python,eclipse,pydev
7,791,891
1
true
0
0
Currently not... please enter a feature request for that (it should be relatively straightforward adding a preference where you can choose an interpreter which would be used to open an interactive console when you open Eclipse).
1
0
0
I find myself opening the interactive shell nearly every time I launch Eclipse. To save my lazy self a few extra clicks every day, I started wonder: is there is a way to get an interactive console to open automatically on start-up of Eclipse/PyDev? Thanks!
Eclipse/PyDev: Open Interactive console when program starts
1.2
0
0
375
7,774,651
2011-10-14T23:36:00.000
5
0
1
0
python,statistics
7,774,767
1
true
0
0
It's a pretty open-ended question, but Numpy and SciPy are the gold standard for numerical computation in Python.
1
2
0
i am writing a program in Python 3, and at this point i am looking for a package that handles statistics. Is there anything available? Thanks in advance.
package for statistics in Python
1.2
0
0
353
7,774,930
2011-10-15T00:36:00.000
2
0
0
0
python,django,web-services,rest
7,774,952
1
true
1
0
Inside your Django app, you can easily use the urllib and json modules in the Python standard library to pull data from URLs, and then parse them as JSON.
1
2
0
I have an existing REST application serving either JSON or XML. I can use the framework (Play) to render templates directly, but I'm not allowed to (arbitrary homework requirement they just invented), and forced to use a second layer to consume, process and render the REST objects. I want to use Django/Python if possib...
Using Django/Python to CONSUME existing web services
1.2
0
0
2,113
7,774,964
2011-10-15T00:42:00.000
8
0
0
0
python,matlab,numpy,octave
7,779,373
5
false
0
0
Python has a builtin function dir() which returns the list of names in the current local scope.
2
22
1
I am new to Numpy and trying to search for a function to list out the variables along with their sizes (both the matrix dimensions as well as memory usage). I am essentially looking for an equivalent of the "whos" command in MATLAB and Octave. Does there exist any such command in NumPy?
Equivalent of "whos" command in NumPy
1
0
0
21,664
7,774,964
2011-10-15T00:42:00.000
0
0
0
0
python,matlab,numpy,octave
60,568,982
5
false
0
0
try using: type(VAR_NAME) this will output the class type for that particular variable, VAR_NAME
2
22
1
I am new to Numpy and trying to search for a function to list out the variables along with their sizes (both the matrix dimensions as well as memory usage). I am essentially looking for an equivalent of the "whos" command in MATLAB and Octave. Does there exist any such command in NumPy?
Equivalent of "whos" command in NumPy
0
0
0
21,664
7,775,254
2011-10-15T01:56:00.000
2
0
1
1
python,linux,python-idle
8,020,235
2
true
0
0
In IDLE's menu, go to Options -> Configure IDLE... -> General. Under "At Startup" select "Open Edit Window" instead of "Open Shell Window", then hit Apply or Ok. IDLE will save this setting and from now on will open just an editor window when you open a file.
2
2
0
Python for Windows has built in support for right clicking a .py file, and selecting, "edit with IDLE", instead of the usual action, which is running the file. How can I accomplish this same setup on Linux? I am running Mint Julia, a Debian-type distribution. Selecting my default program from the shortcut menu will onl...
How do I open a .py file in IDLE for editing without starting a fresh interpreter session?
1.2
0
0
8,877
7,775,254
2011-10-15T01:56:00.000
0
0
1
1
python,linux,python-idle
8,353,380
2
false
0
0
You'll need to change the command to start IDLE itself to include a "-e". Choose "use a custom command" and type idle -e
2
2
0
Python for Windows has built in support for right clicking a .py file, and selecting, "edit with IDLE", instead of the usual action, which is running the file. How can I accomplish this same setup on Linux? I am running Mint Julia, a Debian-type distribution. Selecting my default program from the shortcut menu will onl...
How do I open a .py file in IDLE for editing without starting a fresh interpreter session?
0
0
0
8,877
7,777,484
2011-10-15T11:17:00.000
0
0
1
0
python,ruby,bash,shell
7,779,029
4
false
0
0
For Python just use IDLE, which comes with it. If you position the cursor in a multi-line statement in the terminal window and hit Enter, the whole statement is copied to the input line for editing.
1
2
0
I bet you have came across the same problem like me. I use shell(s) a lot. For python, ruby(irb), mongo... I use some shortcurt like crt+a to go at the begining, crt+e at the end, crt+k to clean to the end. But I miss one thing. When you define a multiline block in a ruby shell or a python shell and you miswrite someth...
How to rerun a series of statements in the same order in a shell?
0
0
0
444
7,781,242
2011-10-15T23:03:00.000
6
0
1
0
python,string,text,alignment,character
7,781,255
2
true
0
0
Simple: "%-140.140s" % some_text
1
0
0
How could I align the text so that it cuts the first 140 characters of a string, and fills the rest with whitespace? e.g. "%140s"%some_text but the space on the other side. Thoughts?
text aligning, python
1.2
0
0
695
7,781,260
2011-10-15T23:06:00.000
33
0
1
0
python,infinite,infinity
7,781,271
11
false
0
0
I don't know exactly what you are doing, but float("inf") gives you a float Infinity, which is greater than any other number.
2
692
0
How can I represent an infinite number in python? No matter which number you enter in the program, no number should be greater than this representation of infinity.
How can I represent an infinite number in Python?
1
0
0
770,266
7,781,260
2011-10-15T23:06:00.000
32
0
1
0
python,infinite,infinity
37,061,405
11
false
0
0
There is an infinity in the NumPy library: from numpy import inf. To get negative infinity one can simply write -inf.
2
692
0
How can I represent an infinite number in python? No matter which number you enter in the program, no number should be greater than this representation of infinity.
How can I represent an infinite number in Python?
1
0
0
770,266
7,781,792
2011-10-16T01:33:00.000
7
0
0
0
python,selenium,selenium-webdriver,automation,automated-tests
7,784,387
14
false
0
0
I have made good experiences using: time.sleep(seconds) webdriver.Firefox.implicitly_wait(seconds) The first one is pretty obvious - just wait a few seconds for some stuff. For all my Selenium Scripts the sleep() with a few seconds (range from 1 to 3) works when I run them on my laptop, but on my Server the time to w...
2
48
0
How do I write the function for Selenium to wait for a table with just a class identifier in Python? I'm having a devil of a time learning to use Selenium's Python webdriver functions.
Selenium waitForElement
1
0
1
100,199
7,781,792
2011-10-16T01:33:00.000
0
0
0
0
python,selenium,selenium-webdriver,automation,automated-tests
42,267,544
14
false
0
0
If I don't know something about selenium command, I use selenium web idea RC with firefox. You can choose and add command in the combobox and when finish your test case after you can export the test code different language. like java, ruby, phyton, C#, etc..
2
48
0
How do I write the function for Selenium to wait for a table with just a class identifier in Python? I'm having a devil of a time learning to use Selenium's Python webdriver functions.
Selenium waitForElement
0
0
1
100,199
7,783,860
2011-10-16T11:03:00.000
0
0
0
0
php,python,memcached
7,785,856
2
true
0
0
Both languages support database connections which live beyond the lifetime of a single request. Don't use memcache for that!
2
0
0
I am using memcached on a web site, and I am currently needing to open connections to a database and socket each time a function is called. In the case of the db connection, I am having to decide at runtime, which database to connect to. Because of the (default) stateless nature of web apps, I am having to tear down (i...
Is it safe to store a connection (effectively a pointer) in memcache?
1.2
1
0
150
7,783,860
2011-10-16T11:03:00.000
0
0
0
0
php,python,memcached
7,785,929
2
false
0
0
I am wondering if it is possible to store (i.e. cache) the socket connection and the database connections in memcache No.
2
0
0
I am using memcached on a web site, and I am currently needing to open connections to a database and socket each time a function is called. In the case of the db connection, I am having to decide at runtime, which database to connect to. Because of the (default) stateless nature of web apps, I am having to tear down (i...
Is it safe to store a connection (effectively a pointer) in memcache?
0
1
0
150
7,784,471
2011-10-16T13:07:00.000
22
0
0
0
python,sqlite,heroku
7,784,785
2
true
1
0
The cedar stack's filesystem is not readonly. However, you still mustn't store any data on it because the filesystem is ephemeral. Any time your application restarts, whatever you had written to your application's filesystem disappears forever. Any time you add a dyno, the two dynos each have their own ephemeral system...
1
12
0
Is there a way to use Sqlite3 with Django on Heroku?
Using Sqlite3 on Heroku Cedar stack
1.2
0
0
3,398
7,784,555
2011-10-16T13:21:00.000
0
0
0
0
python,django,pydev
7,784,801
2
false
1
0
I had the some problem when I upgraded my Ubuntu, it was fixed when i installed the aptana studio package fully.
1
1
0
Today I reinstalled my OS (Ubuntu 11.10) and installed Django and PyDev. I ran one of my programs that import Django framework. It works, but PyDev doesn't detect my project, Django, Simple Django Captcha and most Python libraries. What can I do to fix this problem? Actually, I must say I configured my PYTHONPATH in Py...
PyDev Auto-Complete Doesn't Work
0
0
0
2,773
7,784,969
2011-10-16T14:40:00.000
0
0
0
0
python,wxpython
7,785,429
3
false
0
0
I am not a wx expert. Could you use wx's native event driven mechanisms? The keypress would certainly have an event. Wx has a socket class wxSocketClient() that could translate the low level socket events (data ready, closed, etc) into a wx event.
1
1
0
I want to write an (GUI) application that listens both to keyboard events (client side generated events) and to a network port (server side generated events). I could use some high level advice on how to do this. Some additional info: - I am using the wxPython module for the GUI - I could set the socket in non-blocking...
Listening to network event and keyboard input at the same time in Python
0
0
1
803
7,785,071
2011-10-16T14:57:00.000
2
0
1
0
python,naming-conventions
7,785,105
7
false
0
0
What about L?
3
18
0
Is it better not to name list variables "list"? Since it's conflicted with the python reserved keyword. Then, what's the better naming? "input_list" sounds kinda awkward. I know it can be problem-specific, but, say I have a quick sort function, then quick_sort(unsorted_list) is still kinda lengthy, since list passed t...
Better Python list Naming Other than "list"
0.057081
0
0
9,776
7,785,071
2011-10-16T14:57:00.000
3
0
1
0
python,naming-conventions
7,785,099
7
false
0
0
Just use lst, or seq (for sequence)
3
18
0
Is it better not to name list variables "list"? Since it's conflicted with the python reserved keyword. Then, what's the better naming? "input_list" sounds kinda awkward. I know it can be problem-specific, but, say I have a quick sort function, then quick_sort(unsorted_list) is still kinda lengthy, since list passed t...
Better Python list Naming Other than "list"
0.085505
0
0
9,776
7,785,071
2011-10-16T14:57:00.000
1
0
1
0
python,naming-conventions
7,785,104
7
false
0
0
Why not just use unsorted? I prefer to have names, which communicate ideas, not data types. There are special cases, where the type of a variable is important. But in most cases, it's obvious from the context - like in your case. Quick sort is obviously working on a list.
3
18
0
Is it better not to name list variables "list"? Since it's conflicted with the python reserved keyword. Then, what's the better naming? "input_list" sounds kinda awkward. I know it can be problem-specific, but, say I have a quick sort function, then quick_sort(unsorted_list) is still kinda lengthy, since list passed t...
Better Python list Naming Other than "list"
0.028564
0
0
9,776
7,785,672
2011-10-16T16:30:00.000
6
0
1
0
python,random
7,785,679
5
false
0
0
You can't. Get the list of keys with .keys(), shuffle them, then iterate through the list while indexing the original dict. Or use .items(), and shuffle and iterate that.
1
22
0
How can I iterate through all items of a dictionary in a random order? I mean something random.shuffle, but for a dictionary.
How to iterate through dict in random order in Python?
1
0
0
22,832
7,786,232
2011-10-16T18:07:00.000
1
0
0
0
python,image-processing
7,786,451
1
true
0
0
For the versions of EPD that include pyhdf, you don't need to install HDF 4 separately. However, note that pyhdf is not included in all versions of EPD---in particular, it's not included in the 64-bit Windows EPD or the 64-bit OS X EPD, though it is in the 32-bit versions.
1
1
1
In Enthought Python Distribution, I saw it includes pyhdf and numpy. Since it includes pyhdf, does it also include HDF 4? I am using pylab to code at this moment. Because I want to use a module of the pyhdf package called pyhdf.SD. And it Prerequisites HDF 4 library. So do I still need to install HDF 4 if I want to use...
does Enthought Python distribution includes pyhdf and HDF 4
1.2
0
0
258
7,787,732
2011-10-16T22:18:00.000
1
0
0
0
python,numpy
7,787,997
3
false
0
0
Note that if you're serious about your comment that you require your solution vector to be integer, then you're looking for something called the "integer least squares problem". Which is believed to be NP-hard. There are some heuristic solvers, but it all gets very complicated.
1
1
1
I have some integer matrices of moderate size (a few hundred rows). I need to solve equations of the form Ax = b where b is a standard basis vector and A is one of my matrices. I have been using numpy.linalg.lstsq for this purpose, but the rounding errors end up being too significant. How can I carry out an exact symb...
How do I do matrix computations in python without rounding?
0.066568
0
0
403
7,788,632
2011-10-17T01:35:00.000
1
0
1
1
python,windows,service,process
7,788,671
1
true
0
0
As a general rule, if Windows says that it needs a file, you will be very hard pressed to get it to completely relinquish control. While that process is running, it will have exclusive rights (read, write, and execute) to the file (or files) in question, so I will highly doubt that there will be an effective hack while...
1
0
0
I'm not sure if it is a service or process, but is there a way to disable it or stop it? A file which I'm trying to copy is being run by the system but the system does not require this .sys file. If there is way in python I would be even more ecstatic to read the response.
Way to disable "System" service or process for a short period of time? Python
1.2
0
0
160
7,789,200
2011-10-17T03:52:00.000
1
0
1
0
python,sockets,zeromq
10,416,815
1
false
0
0
REQ-REP sockets have a strict send/receive cycle(or vice versa) Mostly, this happens when you try to send a request before receiving a response or something similar.
1
1
0
I'm using zmq with python with an scheme REQ-REP in order to transfer data. I'm using right now the method send_json to send the data. But for some weird reason, with some examples it works, with other would not. When the error occurs, the following error message and exception is shown: File "socket.pyx", line 723, i...
Weird error sending integer list with send_json using sockets with zmq with python
0.197375
0
1
683
7,789,253
2011-10-17T04:01:00.000
0
0
0
1
python,database,database-design,data-structures
7,789,286
1
false
0
0
I think you should declare a class which has a list of its own type. Basically a simple tree structure. For ls: Just dispay all the child recursively. For any new addition: Add it to the parent directory node's child list as a child.
1
0
0
I am trying to write an application(I am using python) to have a copy of a remote machines directory structure in my local machine (not the actual content of the files in the remote machine). Once I store it in my local machine, I want to be be able to perform the following operations on my local copy of the tree struc...
What data structure/db should I use for storing the file tree structure?
0
0
0
257
7,792,013
2011-10-17T09:48:00.000
2
1
1
0
c#,python,mono
7,792,073
2
false
0
1
Have you considered IronPython? It's trivial to integrate and since it's working directly with .net the integration works very well.
2
1
0
I've decided to try and create a game before I finish studies. Searching around the net, I decided to create the basic game logic in python (for simplicity and quicker development time), and the actual I/O engine in c# (for better performance. specifically, I'm using Mono with the SFML library). After coming to grips ...
Integrating python and c#
0.197375
0
0
814
7,792,013
2011-10-17T09:48:00.000
2
1
1
0
c#,python,mono
7,792,064
2
true
0
1
Sincerely, I would say C# is today gives you a lot of goods from Python. To quote Jon Skeet: Do you know what I really like about dynamic languages such as Python, Ruby, and Groovy? They suck away fluff from your code, leaving just the essence of it—the bits that really do something. Tedious formality gives way ...
2
1
0
I've decided to try and create a game before I finish studies. Searching around the net, I decided to create the basic game logic in python (for simplicity and quicker development time), and the actual I/O engine in c# (for better performance. specifically, I'm using Mono with the SFML library). After coming to grips ...
Integrating python and c#
1.2
0
0
814
7,798,393
2011-10-17T19:15:00.000
0
0
0
0
python,swing,user-interface,comparison,jython
22,448,500
2
false
0
1
I think Python has many toolkit for GUI. Java has Swing. If you want to develop cross-platform friendly GUI,I suggest wxPython.
1
9
0
I wanted to say "best python GUI compared to Swing"... but was sternly told my question was "too subjective". I apologise to the deterministic ghost in the machine. I'm currently using Jython... have been using it for maybe 6 months now following years of Java. I love Jython's ability to call on all the Java classes,...
python GUI compared to Swing?
0
0
0
12,297
7,798,623
2011-10-17T19:35:00.000
-8
0
1
0
ironpython,pycharm,python
8,680,085
3
false
1
0
Please upgrade to PyCharm 2.0. It's likely that the problem with generating skeletons of binary modules is already fixed.
1
44
0
Is there a way to suppress, stop or, otherwise, control the settings for, or display of, background tasks in PyCharm? Selecting the IronPython interpreter causes it to update skeletons (seemingly) every time the interpreter is selected and usually takes 20-30 minutes to complete, rendering the IDE nearly unusable. Most...
How to control the "Updating skeletons" background task in PyCharm for IronPython interpreter?
-1
0
0
23,741
7,798,985
2011-10-17T20:10:00.000
1
0
1
0
python,string
7,799,002
4
false
0
0
Here's a quick example: string='a'+string
2
2
0
is there a quick way to place a string in the front of another string in python? if so how? as an example let's say that string = 'pple'. How would I put the string_2 = 'a' at the start of string?
Put a letter to the front of a string in python
0.049958
0
0
871