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
6,602,151
2011-07-06T19:57:00.000
0
0
0
0
python,selenium,webdriver
6,602,262
3
false
0
0
If the click() executes ajax calls I would suggest you to use NicelyResynchronizingAjaxController
3
4
0
First off, sorry for the cryptic question. My team is currently using Selenium 2.0rc3 (with python) for testing our web app with chrome. When we used the 2.02b version of Selenium, our test passed (it was a little slow and we had small hacks that we added to webdriver). After we upgraded, the test became extremely fast...
Selenium 2.0rc3 click function too fast?
0
0
1
2,381
6,602,151
2011-07-06T19:57:00.000
5
0
0
0
python,selenium,webdriver
6,602,293
3
true
0
0
Your problem is not really that it's clicking too fast. Just that it's clicking before that element is present. There are two ways to get round this: Wait until the element is present before clicking Increase the implicit wait time I'm afraid I haven't used the WebDriver Python bindings. However, I can tell you how i...
3
4
0
First off, sorry for the cryptic question. My team is currently using Selenium 2.0rc3 (with python) for testing our web app with chrome. When we used the 2.02b version of Selenium, our test passed (it was a little slow and we had small hacks that we added to webdriver). After we upgraded, the test became extremely fast...
Selenium 2.0rc3 click function too fast?
1.2
0
1
2,381
6,602,341
2011-07-06T20:12:00.000
0
0
1
1
python,batch-file,command-prompt
6,602,895
3
false
0
0
Have you tried changing the extension of the python script to .pyw, or just invoke it with pythonw.exe?
3
2
0
I have a batch file that runs a python script. When the python script is invoked, it starts a second windows console and then disappears when it is completed. This is a problem because I am editing the PYTHONPATH environment variable in the batch file, but because the python script is running in a second window, it can...
Calling python script from batch file opens second console
0
0
0
2,124
6,602,341
2011-07-06T20:12:00.000
0
0
1
1
python,batch-file,command-prompt
6,603,729
3
false
0
0
It could be that the .py filetype is associated to pythonw.exe, therefore causing it to open in a new process. Find any .py file, right click it, select properties, and check to see under "Opens with:" what the default interpreter is.
3
2
0
I have a batch file that runs a python script. When the python script is invoked, it starts a second windows console and then disappears when it is completed. This is a problem because I am editing the PYTHONPATH environment variable in the batch file, but because the python script is running in a second window, it can...
Calling python script from batch file opens second console
0
0
0
2,124
6,602,341
2011-07-06T20:12:00.000
0
0
1
1
python,batch-file,command-prompt
6,612,528
3
false
0
0
Ok, so I decided to reinstall python. If I uninstall and reinstall (I was using the windows installer) in the default location, it seems to have no effect. I cleaned out the registry and reinstalled. Still no different. However, if I install python in a different location (other than the default) it seems to run fine. ...
3
2
0
I have a batch file that runs a python script. When the python script is invoked, it starts a second windows console and then disappears when it is completed. This is a problem because I am editing the PYTHONPATH environment variable in the batch file, but because the python script is running in a second window, it can...
Calling python script from batch file opens second console
0
0
0
2,124
6,602,664
2011-07-06T20:39:00.000
0
0
0
1
python,nlp,machine-learning,nltk,opennlp
6,602,759
2
false
0
0
One possible solution would be to take the Naive Bayes Classifier 'spam filter' idea and see which words different nicks tend to use. Classify messages according to which user uses words 'most like' the ones sent from an unknown user. The downfall of this would be that if they were using new words you hadn't seen befor...
1
3
0
Here is an online programming contest we are planning to have. What could be possible approaches to solving the same? From a random IRC (Internet Relay Chat) log, a small percentage of the user nicknames will be randomly deleted. The participant’s code must be able to fill in the missing user nicks. In other words, th...
How to recognise a particular user in a long multi-user internet chat log?
0
0
0
196
6,603,810
2011-07-06T22:28:00.000
5
1
0
1
python,ffmpeg,video-encoding
6,603,847
1
true
0
0
Considering that pyFFmpeg is just a wrapper over the libraries, I'd say you shouldn't have any negligible performance difference between the 2, since they use the same libraries at the core.
1
0
0
Lets say for batch processing of over 10000 videos, is there any thing to be gained from using FFmpeg rather than the pyFFmpeg?
FFmpeg VS PyFFmpeg performance wise?
1.2
0
0
774
6,606,224
2011-07-07T05:32:00.000
0
0
0
0
python,django,django-admin,django-views
6,606,681
1
true
1
0
You should really restrict access to the admin. You can create a decorator to do add the functionality of @superuser_required to the admin site, or simply just all people that are is_staff as otherwise.
1
1
0
I want only superuser to see all models and edit/add them.But if a normal user like staff status user logs in i want him to show a screen saying "Hello"+username.
How can I show a "Hello"+username Screen to All other users who are not superuser in Django admin?
1.2
0
0
85
6,607,858
2011-07-07T08:34:00.000
3
0
1
0
java,python,jython,pyc
6,609,145
2
false
1
0
The 'compiled' python code '.pyc' files are implementation-specific. Even CPython (the standard Python implementation) is not able to import .pyc files generated by a different version of CPython. And is not supposed to. So, I would be surprised if Jython had an ability to run .pyc files created by any of CPython versi...
1
0
0
I am working on building a web interface for a Python tool. It's being designed using J2EE (Spring). In the process, I need to make calls to Python functions and hence I am using Jython for the same. But for some modules I don't have the Python source files, I only have the .pyc files, and a document listing the method...
use .pyc files via Jython
0.291313
0
0
1,308
6,609,664
2011-07-07T11:10:00.000
3
0
1
0
python,security,code-injection
6,609,765
3
false
0
0
Arbitrary Python code? Opening, reading, writing, creating files on the partition. Including filling up all the disk space. Infinite loops that put load on the CPU. Allocating all the memory. Doing things that are in pure Python modules without importing them by copy/pasting their code into the expression (messing wit...
1
3
0
I'm looking at several cases where it would be far, far, far easier to accept nearly-raw code. So, What's the worst you can do with an expression if you can't lambda, and how? What's the worst you can do with executed code if you can't use import and how? (can't use X == string is scanned for X) Also, B is unecessary...
Given the my code is open source and I'm running on a server, and I accept nearly-raw code, what's the worst that can happen to me?
0.197375
0
0
281
6,610,944
2011-07-07T12:56:00.000
2
0
1
0
python,uninstallation,setuptools,distutils,package-managers
6,611,184
1
true
0
0
Each installation tool may keep a separate index of which packages it knows about/has installed. All Python cares about is that the files are in place. So basically, if you think it may have been installed with a certain tool, you'll have to ask the tool. For apt/dpkg, you can check if the package appears in the dpkg -...
1
3
0
I want to remove a Python package, let's say Satchmo. But I don't remember which tool I used to install it. I can think of the following ways: Downloading source distutils distribute SetupTools Python package managers EasyInstall PyPM pip apt-get Is there a way to determine how it was installed? I think I need t...
Deciding which package manager was used to install a Python package
1.2
0
0
215
6,611,298
2011-07-07T13:24:00.000
0
1
0
0
python,reverse-dns,gethostbyaddr,pywhois
6,644,900
2
false
0
0
Ok, here is my answer. I am going to work on cleaning up for public consumption a Python 3.x version of pywhois that I have on my machine and hopefully in the next week I will submit my code to the subversion repository. From the IP addresses I am using, I have about a 78% success rate for retrieving info first by ap...
1
3
0
I know about gethostbyaddr in Python and that is somewhat useful for me. I would like to get even more info about an ip address like one can find at various websites such as who hosts that ip address, the country of origin, ..., etc. I need to accomplish this programmatically. Are there any built in commands for Pyth...
In Python, Getting More Info About An IP Address
0
0
1
3,195
6,611,563
2011-07-07T13:43:00.000
-1
0
1
0
python,mysql,sqlalchemy
17,374,720
9
false
0
0
As none of these solutions seem all the elegant. A brute force way is to query to see if the row exists. If it does delete the row and then insert otherwise just insert. Obviously some overhead involved but it does not rely on modifying the raw sql and it works on non orm stuff.
1
44
0
Is there an elegant way to do an INSERT ... ON DUPLICATE KEY UPDATE in SQLAlchemy? I mean something with a syntax similar to inserter.insert().execute(list_of_dictionaries) ?
SQLAlchemy ON DUPLICATE KEY UPDATE
-0.022219
1
0
60,718
6,613,039
2011-07-07T15:24:00.000
5
1
1
0
c++,python,visual-c++-2010-express
6,613,094
2
true
0
0
Tell IDE where header is located: Project -> Properties -> C/C++ -> Additional Include Directories
2
0
0
I already did a search, but I just couldn't find what I searched for. I want to create a Python Module using C++ and Visual C++ Express 2010. Now, I need to include Python.h, but when I compile it says it couldn't find Python.h. How do I give my VC the Python header file ?
How do I get Visual Express 2010 to find my python.h header file?
1.2
0
0
4,649
6,613,039
2011-07-07T15:24:00.000
0
1
1
0
c++,python,visual-c++-2010-express
6,613,085
2
false
0
0
You either have to set the path to to the python include files in your IDE. Navigate to Tools | Options | Projects and Solutions | VC++ Directories and add the path under Include Directories.
2
0
0
I already did a search, but I just couldn't find what I searched for. I want to create a Python Module using C++ and Visual C++ Express 2010. Now, I need to include Python.h, but when I compile it says it couldn't find Python.h. How do I give my VC the Python header file ?
How do I get Visual Express 2010 to find my python.h header file?
0
0
0
4,649
6,613,831
2011-07-07T16:22:00.000
0
0
1
0
python,regex
6,614,081
5
false
0
0
If RE1 and RE2 could match the same characters of the string, check them separately (does RE1 match the string, does RE2 match the string).
1
16
0
I have written 2 REs to match several string sequences in a String. for e.g. lets assume the two regular expressions are RE1, RE2. The strings can be in these 4 forms; 1) Match ONLY RE1 'one or more times' 2) Match ONLY RE2 'one or more times' 3) Match RE1 'one or more times' AND match RE2 'one or more times' 4) Match...
Merge several regular expressions into one RE
0
0
0
23,377
6,614,447
2011-07-07T17:12:00.000
5
0
0
0
python
9,271,325
3
false
0
0
I had the same problem just now with some completely unrelated code. I believe my solution was similar to that in eryksun's answer, though I didn't have any trees. What I did have were some sets, and I was doing random.choice(list(set)) to pick values from them. Sometimes my results (the items picked) were diverging ev...
1
7
1
I am trying to get reproducible results with the genetic programming code in chapter 11 of "Programming Collective Intelligence" by Toby Segaran. However, simply setting seed "random.seed(55)" does not appear to work, changing the original code "from random import ...." to "import random" doesn't help, nor does changin...
Python random seed not working with Genetic Programming example code
0.321513
0
0
2,656
6,615,529
2011-07-07T18:44:00.000
3
1
1
0
java,php,python,encryption
6,615,599
1
true
0
0
Basically, just make sure that you're using the same algorithm. If your hashes were different with the same inputs, you were using a different algorithm; there may be some unstated dependencies upon the underlying word size. Make sure you don't use those types of algorithms, or if you do, that they have very clear ex...
1
1
0
I came across a potential issue when migrating from a 32bit system to a 64bit system. the system runs two 'one way' encryption algos on the string. However when I tried the same code on a 64 bit system the hashes were different, now thats fine but does anyone have any method on how to ensure the the hash can still be ...
Password hashing on 32bit system then migrating to 64bit systems
1.2
0
0
309
6,615,665
2011-07-07T18:58:00.000
0
0
0
0
python,machine-learning,data-mining,k-means
19,444,825
7
false
0
0
If the cluster number is unknow, why not use Hierarchical Clustering instead? At the begining, every isolated one is a cluster, then every two cluster will be merged if their distance is lower than a threshold, the algorithm will end when no more merger goes. The Hierarchical clustering algorithm can carry out a suitab...
2
41
1
I am attempting to apply k-means on a set of high-dimensional data points (about 50 dimensions) and was wondering if there are any implementations that find the optimal number of clusters. I remember reading somewhere that the way an algorithm generally does this is such that the inter-cluster distance is maximized an...
Kmeans without knowing the number of clusters?
0
0
0
26,563
6,615,665
2011-07-07T18:58:00.000
0
0
0
0
python,machine-learning,data-mining,k-means
33,374,054
7
false
0
0
One way to do it is to run k-means with large k (much larger than what you think is the correct number), say 1000. then, running mean-shift algorithm on the these 1000 point (mean shift uses the whole data but you will only "move" these 1000 points). mean shift will find the amount of clusters then. Running mean shift ...
2
41
1
I am attempting to apply k-means on a set of high-dimensional data points (about 50 dimensions) and was wondering if there are any implementations that find the optimal number of clusters. I remember reading somewhere that the way an algorithm generally does this is such that the inter-cluster distance is maximized an...
Kmeans without knowing the number of clusters?
0
0
0
26,563
6,616,005
2011-07-07T19:29:00.000
5
1
0
0
python,module,matplotlib,textmate
6,616,093
1
true
0
0
You need to tell TextMate which Python to use. One way to do that is to define the shell variable TM_PYTHON with an absolute path to the Python interpreter you want to use. In the TextMate menu, select Preferences, then the Advanced tab, then the Shell Variables tab, and click + to add the new variable. If you don't...
1
0
0
I am trying to use python in order to simulate social networks, this requires matplotlib.pyplot, networkx and xlrd. Everything works fine from terminal, IDLE or X11 but when I try to use TextMate import matplotlib.pyplot as plt and import xlrd throws up ImportError: No module named... however import networkx works fine...
Just downloaded TextMate, can't import modules
1.2
0
0
1,391
6,617,895
2011-07-07T22:28:00.000
3
1
1
0
python,debian,packages,naming
6,634,222
3
false
0
0
I'd email the new foobuilder package author to discuss the problem. Obviously one of you needs to change package name; due to proprietary nature of your program is may be undesirable to change its name... Asking this question to the new package author may come up with some new solutions. There really is no sane way to...
1
13
0
Background The group I work with has been using and developing a Python package, which for the purposes of this question I'll call foobuilder. We serve updates for Linux systems using private RPM and Deb repositories we provide for our users. Recently, a public package was added to PyPi with the same name. It also got ...
How to deal with a proprietary Python package name conflicting with a public one?
0.197375
0
0
1,217
6,618,132
2011-07-07T22:59:00.000
2
0
0
0
python,matlab,matplotlib
6,631,872
1
false
0
0
Without access to (or experience with matlab) this is going to be a bit tricky. As Amro stated, .fig files store the underlying data, and not just an image, and you're going to have a hard time saving .fig files from python. There are however a couple of things which might work in your favour, these are: numpy/scipy ...
1
4
1
I'm processing some data for a research project, and I'm writing all my scripts in python. I've been using matplotlib to create graphs to present to my supervisor. However, he is a die-hard MATLAB user and he wants me to send him MATLAB .fig files rather than SVG images. I've looked all over but can't find anything to ...
Any way to get a figure from Python's matplotlib into Matlab?
0.379949
0
0
2,637
6,619,099
2011-07-08T01:41:00.000
0
0
1
0
python,compiler-construction,shared-libraries
6,619,121
1
false
0
0
sudo ldconfig -n $HOME/lib ought to fix the problem. otherwise, strace python and pastebin the results.
1
1
0
When I try to run python I get the error: python2.6: error while loading shared libraries: libpython2.6.so.1.0: cannot open shared object file: No such file or directory I had previously compiled python with no issues and ran it fine. I didn't enable --with-threads or --enable-shared. Now that I enabled these two compi...
Compiling python from source error with shared library loading error
0
0
0
988
6,619,307
2011-07-08T02:21:00.000
1
0
1
1
python,virtualenv,macports
6,619,321
5
true
0
0
You need to make sure virtualenv is in your PATH, although it should be if it was installed correctly.
2
6
0
I have python 2.7 installed via mac ports on a mac. I installed virtualenv via macports (py27-virtualenv @1.6.1_0 (active). When issue the command: virtualenv demo_venv --no-site-packages, I get this error: -bash: virtualenv:command not found. It's not picking virtualenv up @ all, so do I need to symlink it to my pytho...
virtualenv command not found after installed with MacPorts
1.2
0
0
10,031
6,619,307
2011-07-08T02:21:00.000
4
0
1
1
python,virtualenv,macports
7,164,666
5
false
0
0
The command is virtualenv-2.7, not just virtualenv. If you look at the package contents, you can see that no executable named virtualenv is installed.
2
6
0
I have python 2.7 installed via mac ports on a mac. I installed virtualenv via macports (py27-virtualenv @1.6.1_0 (active). When issue the command: virtualenv demo_venv --no-site-packages, I get this error: -bash: virtualenv:command not found. It's not picking virtualenv up @ all, so do I need to symlink it to my pytho...
virtualenv command not found after installed with MacPorts
0.158649
0
0
10,031
6,619,923
2011-07-08T04:17:00.000
6
0
0
0
python,pygame
6,619,966
2
true
0
1
I don't think there is, because some window managers don't give you the ability to remove the close button. But you can write an event handler such that the close button does whatever you want, including nothing. Why do you want to prevent the user from closing? If it's just a matter that you would rather provide an in...
2
4
0
In a pygame application window, the minimize, resize and close buttons are present. Is there a way to disable the close(X) button?
how to disable the window close button in pygame?
1.2
0
0
1,851
6,619,923
2011-07-08T04:17:00.000
0
0
0
0
python,pygame
49,826,543
2
false
0
1
Just for the record, another option would be to pass the following argument to the set_mode() method call: pygame.display.set_mode(..., flags = pygame.NOFRAME) This however makes the whole frame go away, including the top strip to move the window around and the other buttons, such as minimize, so it's rather overkill f...
2
4
0
In a pygame application window, the minimize, resize and close buttons are present. Is there a way to disable the close(X) button?
how to disable the window close button in pygame?
0
0
0
1,851
6,620,471
2011-07-08T06:00:00.000
3
0
0
0
python,numpy,statistics,scipy,distribution
6,620,533
13
false
0
0
What about storing your data in a dictionary where keys would be the numbers between 0 and 47 and values the number of occurrences of their related keys in your original list? Thus your likelihood p(x) will be the sum of all the values for keys greater than x divided by 30000.
1
181
1
INTRODUCTION: I have a list of more than 30,000 integer values ranging from 0 to 47, inclusive, e.g.[0,0,0,0,..,1,1,1,1,...,2,2,2,2,...,47,47,47,...] sampled from some continuous distribution. The values in the list are not necessarily in order, but order doesn't matter for this problem. PROBLEM: Based on my distributi...
Fitting empirical distribution to theoretical ones with Scipy (Python)?
0.046121
0
0
181,959
6,621,127
2011-07-08T07:12:00.000
0
0
0
1
python,timeout,memcached
6,674,214
1
false
0
0
After adjusting time out, also adjust number of retries per server before purging it from the pool.
1
1
0
How do I reduce the connection timeout for python-memcache? When a machine in my cluster goes down, the healthy machines hang for too long trying to connect to it. Is settimeout the only way?
Python-memcache connection timeout
0
0
0
1,372
6,621,501
2011-07-08T07:48:00.000
1
1
0
1
python,linux,daemon
6,622,182
1
true
0
0
Use the right tool for the right job. If you want a process that keeps on running for a long time you will want a proof of some of it's correctness (not a complete one, but at least something). This proof is given to you by the compiler or interpreter accepting the language. It depends a lot on the language, what kind ...
1
0
0
I am about to start into a daemon project with a friend, he will do the design and I will do the coding I am confused between Python and C++ I know C++, but I need to learn Python if I will go with it The daemon I am about to write will be more than 1 daemon actually, each one is responsible for a function, such as acc...
Using python to write a daemon instead of C++
1.2
0
0
453
6,621,902
2011-07-08T08:31:00.000
0
1
1
0
python,pydev,aptana,pycassa
26,035,528
2
false
0
0
I had the same problem with Tastypie. I tried to add external library to project using Preferences-PyDev PUTHONPATH, but it didn't work for me... But then I found solution: Window-Preferences-PyDev-Interpreter Python-Libraries-New folder (Button). Choose folder with needed library and Aptana should work fine then.
2
12
0
I'm trying to import pycassa library in a Python project in Aptana 3, but in the line "import pycassa" it show me the next error: "Unresolved import: pycassa". I installed pycassa with easy install and if I run "import pycassa" in a python shell it run with no errors. If I run the Aptana project run with no errors too,...
Aptana 3 Unresolved import - Python
0
0
0
5,859
6,621,902
2011-07-08T08:31:00.000
5
1
1
0
python,pydev,aptana,pycassa
6,888,449
2
false
0
0
The only working solution for me: open menu “Window” → “Preferences” → “Interpreter - Python”, then click button “Apply”, select your interpreter and then “OK”. Pydev will rescan all packages and in some seconds all unresolved imports disappear. Unfortunately I have to do these steps on every restart because Pydev alw...
2
12
0
I'm trying to import pycassa library in a Python project in Aptana 3, but in the line "import pycassa" it show me the next error: "Unresolved import: pycassa". I installed pycassa with easy install and if I run "import pycassa" in a python shell it run with no errors. If I run the Aptana project run with no errors too,...
Aptana 3 Unresolved import - Python
0.462117
0
0
5,859
6,622,630
2011-07-08T09:40:00.000
1
0
0
0
python,django
6,622,725
3
false
1
0
Option 1. Delegate the context processor's work to another function, and call that function.
1
0
0
In my Django project, I have a context processor which returns a FacebookUser object based on the cookies present in the request (using Facebook's Python SDK). This means that when the user is logged in, their corresponding FacebookUser object is always available in my templates. However, what should I do when I want t...
Django: Context processors in views, bad practice?
0.066568
0
0
2,056
6,624,503
2011-07-08T12:35:00.000
3
0
1
1
c#,python,.net,python.net
6,624,517
6
true
0
0
It works, but I don't really like this solution, I'd like to improve it to a better one. No, AFAIK there isn't a better solution, especially if IronPython is a no-no for you. So you could still keep this as a temporary workaround while waiting for the script to be migrated to .NET or until you find that someone alread...
1
18
0
I have some code written in Python which can not be transferred to a .NET language. I need to call one of these functions from my .NET WinForms application. Now, I do it by starting the Python script as a separate process and pass parameters to it as command line arguments. It works, but I don't really like this soluti...
Call Python from .NET
1.2
0
0
29,199
6,626,629
2011-07-08T15:20:00.000
2
0
0
0
python,gzip,tail
6,626,730
1
false
0
0
Not possible - you can not replace parts of a compressed file without decompressing it first. At least not with the common compression algorithms.
1
0
1
I have a gz file that with a huge size, is it possible to replace the tail without touching the rest of the file? I tried gzip.open( filePath, mode = 'r+' ) but the write method was blocked .... saying it is a read-only object ... any idea? what I am doing now is... gzip.open as r and once I get the offset of the star...
replace/modify tail of a gz file with gzip.open
0.379949
0
0
350
6,626,901
2011-07-08T15:42:00.000
0
1
1
0
python,scripting,abstract-syntax-tree,jit,vm-implementation
6,627,457
2
true
0
0
Another possibility: translate the AST directly to Python byte code and execute that. This is like your last idea except using the existing Python VM. It is not a great possibility because it could be a lot of work and Python compile would probably do a better job except in rather peculiar cases, but I'm just throwing ...
1
5
0
I have some code available in some form of AST and I would like to execute it. I can think of several ways to do this, e.g.: Just straight-forwardly interpret it. Translate it into a Python AST (the ast module) and Python-compile that or Python-eval that. Translate it into Python source code (e.g. a pure string) and...
possibilities for fast dynamic code execution in Python
1.2
0
0
314
6,628,225
2011-07-08T17:38:00.000
0
0
0
1
python
14,525,211
4
false
0
0
trying to fix wing myself, but if you want to just execute it via commandline... in terminal: python3.2 ./filename.py enjoy
4
3
0
I installed python 3.2 edition, but when I opened wingIDE, my MAC still only show the old edition phthon 2.6.1. I tried to use "configure python"-enter python3.2 in "python executable", then found nothing changed, python 2.6.1 still appeared in wingIDE. Any suggestion? I just tried to launch WINGIDE again and this tim...
python 3.2 installed, but MAC didn't recognize it
0
0
0
6,871
6,628,225
2011-07-08T17:38:00.000
1
0
0
1
python
6,628,247
4
false
0
0
Is python3.2 in your PATH? Try typing "python3.2" at the command line and see if that works. Where is python3.2 located? It's probably /usr/bin/python3.2 Try using that in WingIDE and see if that works.
4
3
0
I installed python 3.2 edition, but when I opened wingIDE, my MAC still only show the old edition phthon 2.6.1. I tried to use "configure python"-enter python3.2 in "python executable", then found nothing changed, python 2.6.1 still appeared in wingIDE. Any suggestion? I just tried to launch WINGIDE again and this tim...
python 3.2 installed, but MAC didn't recognize it
0.049958
0
0
6,871
6,628,225
2011-07-08T17:38:00.000
0
0
0
1
python
6,631,758
4
false
0
0
This may depend on the version of OSX you are running. I did a custom install of python 2.7 on my machine running 10.6.7 and had to modify ~/.bash_profile with the following line: PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}" You may want to check the directory /Library/Frameworks/Python.fram...
4
3
0
I installed python 3.2 edition, but when I opened wingIDE, my MAC still only show the old edition phthon 2.6.1. I tried to use "configure python"-enter python3.2 in "python executable", then found nothing changed, python 2.6.1 still appeared in wingIDE. Any suggestion? I just tried to launch WINGIDE again and this tim...
python 3.2 installed, but MAC didn't recognize it
0
0
0
6,871
6,628,225
2011-07-08T17:38:00.000
0
0
0
1
python
36,561,053
4
false
0
0
The reason is because the "python" shortcut doesn't exist in "/Library/Frameworks/Python.framework/Versions/3.4/bin", which is the newly created binary location. Create a soft link to "python" as a work around. "ln -s python python3.4". Also, make sure that your .bash_profile has an entry for /Library/Frameworks/Pyth...
4
3
0
I installed python 3.2 edition, but when I opened wingIDE, my MAC still only show the old edition phthon 2.6.1. I tried to use "configure python"-enter python3.2 in "python executable", then found nothing changed, python 2.6.1 still appeared in wingIDE. Any suggestion? I just tried to launch WINGIDE again and this tim...
python 3.2 installed, but MAC didn't recognize it
0
0
0
6,871
6,628,506
2011-07-08T18:05:00.000
0
0
0
1
python,mapreduce,disco
6,628,861
2
true
0
0
Never mind, it appears that what I'm doing isn't really meant to be done. It might be possible, but it would be far better to merely use semantic DDFS tags to refer to blobs of data. The correct use case for Discodex is to store indexes constructed by a Disco map-reduce program that does not need be the input of anothe...
1
1
0
I have a large amount of static data that needs to offer random access. Since, I'm using Disco to digest it, I'm using the very impressive looking Discodex (key, value) store on top of the Disco Distributed File System. However, Disco's documentation is rather sparse, so I can't figure out how to use my Discodex indice...
Running a Disco map-reduce job on data stored in Discodex
1.2
0
0
567
6,628,953
2011-07-08T18:43:00.000
1
0
0
0
python,configuration,redis,connection-pooling
6,703,919
1
false
0
0
So I'm guessing this is about the connection pooling support built into the python library. Am I correct in that guess? Yes. If so the real question is is there a way to increase the pool size Not needed, it will increase connections up to 2**31 per default (andys lib). So your connections are idle anyways. If you w...
1
1
0
I have a python loader using Andy McCurdy's python library that opens multiple Redis DB connections and sets millions of keys looping through files of lines each containing an integer that is the redis-db number for that record. Alltogether, only 20 databases are open at the present time, but eventually there may be as...
configuring connection-pool size with Andy McCurdy's python-for-redis library
0.197375
1
0
1,371
6,629,277
2011-07-08T19:12:00.000
1
0
1
0
python
6,629,504
4
false
0
0
Don't forget the -t option to the python interpreter for tab warnings and if you're currently using 2.x and want to minimize the trauma of switching to 3.x in the future, the -3 option will help.
1
6
0
Perl has the strict and warnings pragmas and a couple of CPAN modules for encouraging good style and reducing errors. Is there a Python counterpart that can help me avoid such problems and bad practices while it encourages me to use a more Pythonic structure? I should make it clear that I do not know what I want to avo...
How to make Python warn about bad practice and likely mistakes?
0.049958
0
0
318
6,629,597
2011-07-08T19:40:00.000
0
1
1
0
python,unit-testing,resources
6,629,638
5
false
0
0
The filepath will be relative to the script that you initially invoked. I would suggest that you pass the relative path in as an argument to MyClass. This way, you can have different paths depending on which script is invoking MyClass.
1
11
0
I have a Python project with the following directory structure: project/ project/src/ project/src/somecode.py project/src/mypackage/mymodule.py project/src/resources/ project/src/resources/datafile1.txt In mymodule.py, I have a class (lets call it "MyClass") which needs to load datafile1.txt. This sort of works when...
Accessing resource files in Python unit tests & main code
0
0
0
11,129
6,630,521
2011-07-08T21:06:00.000
3
0
1
0
python,parameter-passing
6,630,574
4
false
0
0
No. Passing a list to a function does not have any impact in terms of memory. Python does not copy the list.
2
3
0
I am not clear about the concept of passing lists as arguments to functions in python. I've tried researching on this myself , didn't find adequate resources. I want to implement a helper function which returns a number of random items from a given list. (in django queryset) However, the list may contain multiple row...
python passing parameter to a function
0.148885
0
0
1,002
6,630,521
2011-07-08T21:06:00.000
6
0
1
0
python,parameter-passing
6,630,719
4
true
0
0
In Python, there are names and values. An assignment statement makes a name refer to a value. An assignment never makes a copy, and assignment never changes a value. It only changes what value a name refers to. Passing an argument to a function is like an assignment: now the local name of the argument in the funct...
2
3
0
I am not clear about the concept of passing lists as arguments to functions in python. I've tried researching on this myself , didn't find adequate resources. I want to implement a helper function which returns a number of random items from a given list. (in django queryset) However, the list may contain multiple row...
python passing parameter to a function
1.2
0
0
1,002
6,630,873
2011-07-08T21:46:00.000
0
0
0
1
python,linux,command-line,download
6,630,925
3
false
0
0
Well if you are getting into a linux machine you can use the package manager of that linux distro. If you are using Ubuntu just use apt-get search python, check the list and do apt-get install python2.7 (not sure if python2.7 or python-2.7, check the list) You could use yum in fedora and do the same. if you want to ins...
1
30
0
I'm on windows, but I'm using a putty shell to connect to a linux machine, and want to install python 2.7. Can't figure out how to do it. How can I download python from command line?
How to download python from command-line?
0
0
0
127,053
6,631,323
2011-07-08T22:46:00.000
0
0
1
0
python,sockets,encryption,pyaudio
11,875,856
2
false
0
0
My guess is that you're running into problems because you are creating multiple PyAudio objects and opening multiple streams without closing any of them. You should create one PyAudio object, and one stream, and re-use those objects.
1
5
0
Hello I am facing an issue with PyAudio I can not solve. When I use it over the network (after a while) it crashes. The error I get is Exception in thread Thread-1: Traceback (most recent call last): File "C:\Python27\lib\threading.py", line 552, in __bootstrap_inner self.run() File "C:\Python27\lib\threading....
PyAudio Over Network crashes
0
0
0
1,830
6,631,601
2011-07-08T23:28:00.000
0
0
0
0
python,django,http,request
6,632,307
1
false
1
0
It's possible your view function is called once, but you are logging twice. I've had problems before where my logging add_handler call was being run twice, so the log had the same handler twice, so one log.debug() call would result in the same message in the log twice.
1
1
0
I have several logging.debug statements in the home view of a web site, mainly to log the start time and the end time of a bunch of sql queries. However, sometimes, I see those sets of debug statements pop up twice in a row in the debug log. Of course, during that time only one user has made ONE request (as in refresh,...
Django view gets called twice... sometimes
0
0
0
876
6,632,060
2011-07-09T01:10:00.000
0
0
1
0
visual-studio,ironpython,ironruby
6,887,905
2
false
0
0
You can download the VS 2010 Express Editions and then download the IronPython or IronRuby tools as addon.
1
2
0
IronRuby's "Tools" pack looks like a really attractive IDE to me, except for the fact that I need to buy Visual Studio to use it. Is there a way around this?
How can I use the IronLanguages' Tools without buying VS?
0
0
0
85
6,633,523
2011-07-09T07:59:00.000
1
0
1
0
python,type-conversion
51,516,331
9
false
0
0
Just replace, with replace(). f = float("123,456.908".replace(',','')) print(type(f)) type() will show you that it has converted into a float
1
121
0
How can I convert a string like 123,456.908 to float 123456.908 in Python?
How can I convert a string with dot and comma into a float in Python
0.022219
0
0
252,782
6,634,523
2011-07-09T11:46:00.000
2
0
0
0
python,pyqt
6,644,954
1
false
0
1
The documentation says "This signal is emitted by insertRowIntoTable() before a new row is inserted into the currently active database table". So it sounds like the signal is only emitted when insertRowIntoTable() is called, and not for any other type of model edit.
1
0
0
I'm trying to use the beforeInsert() signal emitted by the QSqlRelationalTableModel in PyQt. However, even after I make edits to the model, the slot connected to the signal does't run. When exactly is the beforeInsert() signal emitted? Could someone show a working example of the use of beforeInsert(), or beforeUpdate()...
PyQt beforeInsert() signal
0.379949
0
0
99
6,635,759
2011-07-09T15:42:00.000
0
1
1
0
python,emacs23,ropemacs,pymacs
8,797,023
3
false
0
0
I install pymacs manually the python part,and i use the pymacs package in the elpa's python-mode (it contains pymacs.el),then this two conflict,i remove the pymacs in python-mode,it works well.maybe you are the same error.Or you should check your python version.
1
1
0
I am running Ubuntu Natty and install Emacs and pymacs and ropemacs all from the repos. So when I add to my .emacs file the script to load ropemacs and pymacs I get the following error: File mode specification error: (error "Pymacs Lisp version is 0.23, Python is 0.24-beta2" I've been reading the docs and readmes but I...
Pymacs lisp version rarities
0
0
0
486
6,636,821
2011-07-09T18:58:00.000
0
0
1
0
python,ubuntu,virtualenv,zlib,linux-mint
8,500,113
1
false
0
0
virtualenv doesn't export a PYTHONPATH, instead VIRTUAL_ENV is exported, then the sys.path thing is handled by site module. The zlib is in the standard library, and it's configured to be enabled by default, so I guess you didn't have zlib-dev installed. try: sudo apt-get install zlib1g-dev and recompile yr python2.7.
1
2
0
I'm running Mint 9 and I can't get Virtualenv to run. Every time I run it I get an ImportError for zlib, while the Software Manager claims both zlib1g-dev and zlib1g are installed. One interesting thing is that there's no PYTHONPATH environment variable set. Is this typical and could it be the problem why zlib can't b...
Linux Mint 9 Virtualenv ImportError for zlib and PYTHONPATH is empty?
0
0
0
840
6,637,106
2011-07-09T19:49:00.000
1
0
1
0
python,datetime
6,637,128
2
false
0
0
You should be able to use strptime with a %Z in your format string, but be aware of this note from the Python documentation (http://docs.python.org/library/datetime.html#strftime-strptime-behavior): "%Z -- If tzname() returns None, %Z is replaced by an empty string. Otherwise %Z is replaced by the returned value, which...
1
3
0
I understand how to convert a string to a datetime object, but what about a string that has a different time zone? for example "10/07/2011 04:22 CEST"
How do I convert a string with a different time zone to a datetime object?
0.099668
0
0
1,306
6,637,219
2011-07-09T20:12:00.000
0
0
1
0
python,emacs,ipython
6,646,806
2
true
0
0
I usually C-c until it stops... and it usually works...
1
4
0
Let's say I accidentally evaluate an enormous variable--a list with a ba-jillion elements, or whatever. As they scroll down my screen and my computer crawls to a halt, is there a good way to interrupt this without killing my *Python* buffer? I'm using IPython via python-mode.el and ipython.el in emacs24 on Mac OS X L...
How can I interrupt the IPython interpreter as opened in emacs?
1.2
0
0
914
6,637,783
2011-07-09T22:04:00.000
0
0
0
0
python,django
16,939,968
2
false
1
0
put an import in the init file of your app (not subdirecotry). I have this structure and the following import in init.py file app/views_dir/group_views.py The following line is the only line of code in my init file from views_dir.group_views import test
2
1
0
Django doesn't seem to be able to import modules from a subdirectory. I've got a file structure like this: ->project_folder ---->app_folder ------->subdir when I store a script in app_folder, i can import it, so the command 'from project_folder.app_folder.module import *' works, but I get a module not found error when ...
cannot import modules from subdirectories that are in the django app parent directory
0
0
0
2,142
6,637,783
2011-07-09T22:04:00.000
9
0
0
0
python,django
6,637,800
2
false
1
0
have you got an __init__.py in your subdir? Python needs this file to treat a directory as a package.
2
1
0
Django doesn't seem to be able to import modules from a subdirectory. I've got a file structure like this: ->project_folder ---->app_folder ------->subdir when I store a script in app_folder, i can import it, so the command 'from project_folder.app_folder.module import *' works, but I get a module not found error when ...
cannot import modules from subdirectories that are in the django app parent directory
1
0
0
2,142
6,638,283
2011-07-09T23:56:00.000
1
0
1
0
python,api
6,638,553
1
true
0
0
Generally to install a package you either download it and run python setup.py install or use easy_install/pip. You can use which python to verify you are running the installer with the proper version of Python. There is a good chance you are simply installing it with 2.6, thus it never gets installed for 2.7. If you ar...
1
1
0
I'm trying to set up the Python Google API on my system; I have both Python 2.6 and 2.7 installed; 2.7 is the version I use. Howver, the installer installs itself into my old Python (2.6) and I get library not found errors when I try to use it on 2.7. Has anybody had any success installing the Google API into a specif...
Having difficulty installing Google Python API into newer Python
1.2
0
0
680
6,639,247
2011-07-10T04:52:00.000
2
0
0
0
javascript,python,django,time,countdown
6,639,561
2
false
1
0
I don't think this question has anything to do with SQL, really--except that you might retrieve an expiration time from SQL. What you really care about is just how to display the timeout real-time in the browser, right? Obviously the easiest way is just to send a "seconds remaining" counter to the page, either on the ...
2
0
0
If I make a live countdown clock like ebay, how do I do this with django and sql? I'm assuming running a function in django or in sql over and over every second to check the time would be horribly inefficient. Is this even a plausible strategy? Or is this the way they do it: When a page loads, it takes the end datet...
Live countdown clock with django and sql?
0.197375
1
0
2,127
6,639,247
2011-07-10T04:52:00.000
0
0
0
0
javascript,python,django,time,countdown
6,639,878
2
false
1
0
I have also encountered the same problem a while ago. First of all your problem is not related neither django nor sql. It is a general concept and it is not very easy to implement because of overhead in server. One solution come into my mind is keeping start time of the process in the database. When someone request you...
2
0
0
If I make a live countdown clock like ebay, how do I do this with django and sql? I'm assuming running a function in django or in sql over and over every second to check the time would be horribly inefficient. Is this even a plausible strategy? Or is this the way they do it: When a page loads, it takes the end datet...
Live countdown clock with django and sql?
0
1
0
2,127
6,639,536
2011-07-10T06:06:00.000
3
1
1
0
python
6,639,553
2
true
0
0
Just try return self.__class__()
1
0
0
So I have a Superclass (which for simplicity I'll call), Mammal, from which classes Dog, Monkey, and Bear inherit methods. Some of the inherited methods return an object that needs to be of the same class it is called from. For example, Dog.find(...) should return Dog objects. But because the find() method is inherit...
Returning an object based on __class__.__name__ in Python
1.2
0
0
1,943
6,640,385
2011-07-10T09:50:00.000
0
1
1
0
python,continuous-integration
6,640,410
2
false
0
0
Using Jenkins/Hudson for continuous integration is the standard approach.
1
8
0
I am looking to set up a continuous integration server for a python project. Normally this would build the project however as python is not built as such, what should be done instead? Just unit tests? Or are there additional steps that anyone can recommend?
python continuous integration
0
0
0
2,281
6,642,570
2011-07-10T17:16:00.000
2
0
0
0
python,rss,feedparser
6,685,581
1
false
1
0
I don't understand the question as written. An RSS feed is an XML document. Feedparser retrieves and parses this entire document. It can't query just part of a document. It's up to you to write the code around feedparser to extract what you want (e.g., for each entry, you can look at d.entries[0].date and compare i...
1
3
0
Is there an Option in feedparser to query only the new entries newer then feed.updated? Or can you set a parameter to get only entries from a specific date/today/week etc.? (Safari´s RSS Reader provides this options...)
Feedparser Date parameter/Time-specific query
0.379949
0
1
458
6,643,747
2011-07-10T21:15:00.000
1
0
1
0
python,algorithm
6,644,412
4
false
0
0
Sort the ranges (x, y) by increasing x values. Now, for each range, if it overlaps the previous range, set your current "big range"'s y value to the current range's y value. If it doesn't, start a new "big range": this one won't overlap any of the previous ones. If the current range is completely included in the curren...
1
2
0
In Python, you can get the numbers in a range by calling range(x,y). But given two ranges, say 5-15, and 10-20 how can you get all the numbers 5-20 without duplicates? The ranges may also be disjoint. I could concat all the results and then uniquify the list, but is that the fastest solution?
Given a bunch of ranges of numbers, get all the numbers within those ranges?
0.049958
0
0
292
6,644,074
2011-07-10T22:10:00.000
29
0
1
0
python,python-3.x
6,644,095
5
true
0
0
Use the .find() method of a string, rather than string.find(). (This also works, and is probably preferable, in python 2).
1
25
0
I'm working on the MIT open courseware for python but have having a hard time with the following example: To get started, we are going to use some built-in Python functions. To use these functions, include the statement from string import * at the beginning of your file. This will allow you to use Python string fu...
What is the Python 3 equivalent of find ()?
1.2
0
0
60,208
6,645,680
2011-07-11T04:12:00.000
0
0
0
1
python,networking
6,646,280
5
false
0
0
Stick your server stuff in another thread (investigate the threading module) and use the main thread for interaction with the user via raw_input/input.
1
0
0
quick question that I'm never even sure is possible :3 I have a python script, a network script that connects to a server and remains connected until I either disconnect or it kicks me (which it normally shouldn't), which is constantly receiving data and doing other tasks. I was curious if it's at all possible while th...
Constantly running python script, calling functions via terminal
0
0
0
883
6,645,801
2011-07-11T04:37:00.000
1
1
0
1
php,python
6,645,831
1
true
0
0
When you test the python script on the command line, you're running as root. Chances are you're not running the webserver as root (which is a good thing), and the webserver's user does not have appropriate permissions to create and/or write to that file.
1
1
0
This is my python script which creates a "test.txt" file when executed. when I execute using terminal (Ubuntu 11.04) root@gml-VirtualBox:/var/www/HMS# python test.py. It creates the "test.txt" in the /var/www/HMS directory as I expected. test.py: #!/usr/bin/env python def init(): filename = "test.txt" file =...
Problem in calling Python script from PHP
1.2
0
0
584
6,646,331
2011-07-11T06:00:00.000
5
0
1
1
python,macos,memory-leaks,terminal
6,646,346
2
false
0
0
It's not Python that is leaking memory. Look closer. On my machine, the Python process remains at a quiet, stable 3.5 MB of memory. The memory usage increment you see is most likely due to the Terminal not ever discarding output. You can alter this behavior going to Preferences, Settings, and setting the maximum line n...
2
2
0
I just ran a python program in the Mac OS Terminal, and there is unusual memory leak. The program is simple like this: for i in xrange(1000000000, 2000000000, 10): i2 = i * i print i, i2, str(i2)[::2] if str(i2)[::2] == '1234567890': break When the program is running, it consumes more and more memory till i...
Memory leak when running python in Mac OS Terminal
0.462117
0
0
2,149
6,646,331
2011-07-11T06:00:00.000
14
0
1
1
python,macos,memory-leaks,terminal
6,646,350
2
true
0
0
This isn't a bug; it's actually a feature. Terminal.app, like many other terminal emulators, saves recent output in a buffer so that you can scroll back (with page up or the scroll bar). You can limit how large this is by going to Terminal -> Preferences -> Settings and setting the scrollback limit to something other t...
2
2
0
I just ran a python program in the Mac OS Terminal, and there is unusual memory leak. The program is simple like this: for i in xrange(1000000000, 2000000000, 10): i2 = i * i print i, i2, str(i2)[::2] if str(i2)[::2] == '1234567890': break When the program is running, it consumes more and more memory till i...
Memory leak when running python in Mac OS Terminal
1.2
0
0
2,149
6,648,312
2011-07-11T09:42:00.000
0
0
1
0
javascript,python
6,648,471
3
true
1
0
For one of my projects I simply wrote a small build script which handles both CSS and JS files. For JS it reads the list of JS files from a text file, concatenates all scripts and submits them to google for minification. For CSS I take my central CSS file and recursively replace all @import statements with the referenc...
1
1
0
I'm planning an extensible web app where base objects are extended by JavaScript modules which plug in. Each JavaScript object may just be an independent bit of code, or I might be building a large object to simulate a module namespace. I'll be using a Django back-end and Backbone.js, since you asked. The system should...
What's the best way to assemble Javascript modules server-side in Python?
1.2
0
0
197
6,648,493
2011-07-11T09:59:00.000
50
0
1
0
python,file,file-io
6,648,594
4
false
0
0
r+ is the canonical mode for reading and writing at the same time. This is not different from using the fopen() system call since file() / open() is just a tiny wrapper around this operating system call.
1
314
0
Is there a way to open a file for both reading and writing? As a workaround, I open the file for writing, close it, then open it again for reading. But is there a way to open a file for both reading and writing?
How to open a file for both reading and writing?
1
0
0
373,101
6,649,990
2011-07-11T12:20:00.000
0
0
0
0
python,mysql,django,excel
6,650,011
4
false
1
0
phpMyAdmin has an Export tab, and you can export in CSV. This can be imported into Excel.
1
0
0
I have a Django project which has a mysql database backend. How can I export contents from my db to an Excel (xls, xlsx) format?
MySQLdb to Excel
0
1
0
1,028
6,650,275
2011-07-11T12:46:00.000
0
0
1
0
python,database,google-app-engine,list,volume
6,650,459
3
false
0
0
You can use ORM: Object Relational Mapping: A class gets a table, an objects gets a row. I like the Django ORM. You can use it for non-web apps, too. I never used it on GAE, but I think it is possible.
1
11
0
The Python native capabilities for lists, sets & dictionaries totally rock. Is there a way to continue using the native capability when the data becomes really big? The problem I'm working on involved matching (intersection) of very large lists. I haven't pushed the limits yet -- actually I don't really know what th...
Can a Python list, set or dictionary be implemented invisibly using a database?
0
0
0
367
6,651,098
2011-07-11T13:50:00.000
0
0
0
0
python,swing,wxpython
6,652,801
1
false
0
1
wxPython uses native widgets for the most part. If they don't have a rounded version, then the answer is No. However, wxPython supports custom widgets, so you could create your own text control with whatever features you want.
1
0
0
Is there any way to design a rounded corner TextCtrl widget? Actually I am new to wxPython and I am used to swing. Like in swing, is their any way in wxPython too to customize the border of the widgets?
Rounded corner border in wxPython
0
0
0
764
6,652,365
2011-07-11T15:15:00.000
0
0
0
0
python,listview,wxpython
6,666,289
1
false
0
1
Possibly the best answer would have been to use the UltimateListCtrl from the same library, which shares the same API. However, this too seems to have problems. Still investigating.
1
1
0
In wxPython, there is a ListCtrlAutoWidthMixin which makes sure that the last column in the list uses up all the space available to the list, even when it resizes. However, I have had problems with the native wxListCtrl on Windows that mean I want to use a different list, like the HyperTreeList that is new in 2.8.12. ...
Automatically using maximum column width in wxPython's HyperTreeList
0
0
0
249
6,652,727
2011-07-11T15:40:00.000
2
0
1
0
python,logging
6,652,884
4
false
0
0
No. File and Screen output means you need two handlers.
1
19
0
I am using the logging module in Python to write debug and error messages. I want to write to file all messages of logging.DEBUG or greater. However, I only want to print to the screen messages of logging.WARNING or greater. Is this possible using just one Logger and one FileHandler?
Different logging levels for filehandler and display in Python
0.099668
0
0
9,451
6,655,258
2011-07-11T19:18:00.000
4
0
0
0
python,sockets,sandbox,pypy
6,700,339
1
true
0
0
I've investigated this further, and it appears that this is a fairly fundamental problem. The socket module, implemented at the library level (inside of the lib directories) is essentially an empty shell for the the _socket library, which is an interpreter-level module defined in the pypy/module directory. For those un...
1
6
0
I'm attempting to allow a subprocess sandboxed with Pypy to communicate, using a limited protocol, with the parent process. After reviewing the source code of the pypy/pypy/translator/sandbox/sandlib.py included with Pypy, it appears that there is a VirtualizedSocketProc that allows os.open calls to open sockets. I've ...
Using the socket module in sandboxed Pypy
1.2
0
1
673
6,656,310
2011-07-11T20:44:00.000
1
0
1
0
python
6,658,068
3
true
0
0
Off the top of my head, I would do this: start with two copies of the list A and B. pop the first value off of B subtract B from A: C = A-B search for areas in C that are 0; these indicate repeated strings add repeated strings into a dict which tracks each string and the number of times it has been seen repeat steps ...
1
3
0
I'm trying to write a python script to find patterns in a list. Eg. Given this list [1,2,3,4,5,6,4,5,6,4,5,6,4,5,6] The script would determine that 4,5,6 ocurred 3 times and then print out 3 (4,5,6) I was hoping if anyone had any insights algorithmically (I can only think of n^2 algorithms where I check for patterns of...
Finding patterns in a list
1.2
0
0
14,035
6,656,750
2011-07-11T21:22:00.000
1
0
0
0
python,user-interface,tkinter,pygame
6,657,099
3
false
0
1
Since tkinter is built into Python, it might be better. I prefer wx, but if you just want a few dialogues, tkinter is fine. You could also just try raw_input('type "1" for low res, "2" for high res'). I think it brings up a dialog window in Windows.
1
1
0
So, Iv'e got a pygame application. Right now, it takes a command line argument to specify which display to show the main screen on. However, I'm running it on windows, where it's hard to specify command line input to a graphical application. So, I'd like to have a very very very simple dialog box which pops up, prompts...
Simplest way to get initial text input in pygame
0.066568
0
0
2,527
6,660,879
2011-07-12T07:34:00.000
2
0
1
0
python,colors,range
6,660,897
2
false
0
0
Assuming you have a way to present RGB values represented as 3-tuples (R,G,B) in the range of 0..1, it sounds like you want to go from: (1, 0, 0) to: (0, 1, 0). You can just use: rgbs = [(1-i,i,0) for i in your_floats] Then use any graphics library to visualize these 3-tuples as actual RGB colors.
1
5
0
I have a function that returns float results in the interval [0.0, 1.0]. I would like to visualize the results using color ranging from red for 0.0 to green for 1.0 (maybe through yellow for 0.5). How could I do that? Thanks!
Python: Map float range [0.0, 1.0] to color range [red, green]?
0.197375
0
0
6,126
6,661,592
2011-07-12T08:47:00.000
0
0
0
0
python,django,django-forms
34,145,881
3
false
1
0
If you really want to make as few changes as possible, splitting forms.py into multiple files by function (forms_user.py, forms_product.py) is the easiest. If you have time to refactor or are starting a new project, the best solution is to make a new django app for each component of your project (e.g. users, projects.....
1
2
0
I have a very long forms.py and I'd like to split it to smaller parts with as few as possible changes in the code. Any ideas?
Django: split forms.py in several files
0
0
0
1,774
6,662,536
2011-07-12T10:10:00.000
8
0
1
0
python,pywin32
23,008,561
11
false
0
1
I had the same problem: On 64 bit Windows, 32 bit apps are being registered under: [1] HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python I reckon the installer is expecting to find Python in: [2] HKEY_LOCAL_MACHINE\SOFTWARE\Python With regedit and local admin rights, you can export a .reg file of [1], remove all the "Wow6...
4
7
0
I am trying to install pywin32 for Python 2.6. I have python installed but it's not in the regular c: drive but on the d: drive . The pywin32 installer does not find it and I cannot give the custom path to it. I checked, thepython folder is the path. Is there a workaround this issue ?
Problem installing pywin32
1
0
0
45,238
6,662,536
2011-07-12T10:10:00.000
2
0
1
0
python,pywin32
41,378,346
11
false
0
1
I had the same issue on Windows 10 64 bit with Python 3.6. It is installed for all users (I guess it uses a different registry hive in case it is installed for current user only). The problem was that pywin32-220.win32-py3.6.exe searches in registry for HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Python\PythonCore\3.6 whil...
4
7
0
I am trying to install pywin32 for Python 2.6. I have python installed but it's not in the regular c: drive but on the d: drive . The pywin32 installer does not find it and I cannot give the custom path to it. I checked, thepython folder is the path. Is there a workaround this issue ?
Problem installing pywin32
0.036348
0
0
45,238
6,662,536
2011-07-12T10:10:00.000
15
0
1
0
python,pywin32
6,662,762
11
true
0
1
From the pywin32 README If the installation process informs you that Python is not found in the registry, it almost certainly means you have downloaded the wrong version - either for the wrong version of Python, or the wrong "bittedness". Are you sure you got the right version for your python and your cp...
4
7
0
I am trying to install pywin32 for Python 2.6. I have python installed but it's not in the regular c: drive but on the d: drive . The pywin32 installer does not find it and I cannot give the custom path to it. I checked, thepython folder is the path. Is there a workaround this issue ?
Problem installing pywin32
1.2
0
0
45,238
6,662,536
2011-07-12T10:10:00.000
0
0
1
0
python,pywin32
55,397,320
11
false
0
1
I ran into this exact problem, but it seemed to me that my situation was a bit different and besides, I didn't want to have to use a registry hack. So I started to post a new question. Here's what I was going to write: I have both 64-bit and 32-bit versions of Python 3.7 installed on my Windows 7 machine. The 64-bi...
4
7
0
I am trying to install pywin32 for Python 2.6. I have python installed but it's not in the regular c: drive but on the d: drive . The pywin32 installer does not find it and I cannot give the custom path to it. I checked, thepython folder is the path. Is there a workaround this issue ?
Problem installing pywin32
0
0
0
45,238
6,663,490
2011-07-12T11:28:00.000
0
0
1
0
python,collections,dictionary,boolean
51,141,024
3
false
0
0
Have you thought about using a hybrid list/bitstring? Use your list to store one dimension of your bits. Each list item would hold a bitstring of fixed length. You would use your list to focus your search to the bitstring of interest, then use the bitstring to find/modify your bit of interest. The list should allow the...
1
3
0
What is the best way to store between a million to 450,000 Boolean values in a dictionary like collection indexed by a long number? I need to use the least amount of memory possible. True and Int both take up more than 22 bytes per entry. Is there a lower memory per Boolean possible?
Best way to store boolean values to save memory in python
0
0
0
4,709
6,666,019
2011-07-12T14:41:00.000
2
0
1
0
python,nltk,stemming,porter-stemmer
6,666,064
1
true
0
0
Porter is simple, but if you are stemming huge amounts of data, it's not a bad option.
1
0
0
Which of lancaster or porter is best for Stemming ? Is Porter stemmer too old for stemming?
Lancaster Or Porter
1.2
0
0
742
6,666,162
2011-07-12T14:51:00.000
1
0
1
1
python,ctypes
28,210,864
2
false
0
0
In fact,you can't create an instance of OpcServer Object if you use the moudle ctypes.Because C is not Object-Oriented language.If you use C++ to make a .dll file,you should make a C interface,in program such as extern "C",if you return an object in this .dll file,python' function can't recieve this object.If I'm not m...
1
0
0
I want to use OpcDaNet.dll in python, I use for that ctypes, but to be able to use the functions I'm intersted in, I have to create an instance of OpcServer Object, how can I do that with Ctypes? thanks for your answres
ctypes lib in python
0.099668
0
0
533
6,666,499
2011-07-12T15:11:00.000
1
1
1
0
iphone,python,objective-c,c
6,666,567
5
false
0
1
You should learn both, Objective-C and HTML5. HTML5 isn't very difficult to grasp even if you don't have any experience.
2
8
0
I'm a self-taught programmer who jumped into Python as my first language about 7-8 months ago. I'm fairly solid at making things work, though my foundational knowledge is limited thanks to my questionable choice in college to not study computer science. Beyond Python, I'm not really familiar with C or other lower lev...
Python to Objective C (Expected Learning Curve)
0.039979
0
0
5,620
6,666,499
2011-07-12T15:11:00.000
0
1
1
0
iphone,python,objective-c,c
6,666,588
5
false
0
1
Well when i started progamming for Objective-c i was well known in Java, but nothing close to C/Objective-c. It took me around 1 month to learn the basics (using tutorials etc). There are some really good tutorials on iTunes (search for Objective-c seminar). I also used a couple of pdf's to use them as backup while mak...
2
8
0
I'm a self-taught programmer who jumped into Python as my first language about 7-8 months ago. I'm fairly solid at making things work, though my foundational knowledge is limited thanks to my questionable choice in college to not study computer science. Beyond Python, I'm not really familiar with C or other lower lev...
Python to Objective C (Expected Learning Curve)
0
0
0
5,620
6,668,073
2011-07-12T17:00:00.000
1
0
0
0
python,mysql,mysql-python,resolve
6,668,116
2
false
0
0
This is an option which needs to be set in the MySQL configuration file on the server. It can't be set by client APIs such as MySQLdb. This is because of the potential security implications. That is, I may want to deny access from a particular hostname. With skip-name-resolve enabled, this won't work. (Admittedly, acce...
1
12
0
I try to connect to database in a domain from my virtual machine. It works on XP, but somehow does not work on Win7 and quitting with: "OperationalError: (1042, "Can't get hostname for your address")" Now I tried disable Firewall and stuff, but that doesn't matter anyway. I don't need the DNS resolving, which will onl...
How to use the option skip-name-resolve when using MySQLdb for Python?
0.099668
1
0
60,490
6,668,234
2011-07-12T17:14:00.000
8
0
1
0
python,indexing,zodb,object-oriented-database
6,674,416
2
true
0
0
Yes, repoze.catalog is nice, and well documented. In short : don't make indexing part of your site structure! Look at using a container/item hierarchy to store and traverse content item objects; plan to be able to traverse content by either (a) path (graph edges look like a filesystem) or (b) by identifying singleton ...
2
5
0
I'm using an object database (ZODB) in order to store complex relationships between many objects but am running into performance issues. As a result I started to construct indexes in order to speed up object retrieval and insertion. Here is my story and I hope that you can help. Initially when I would add an object to...
Method for indexing an object database
1.2
1
0
601
6,668,234
2011-07-12T17:14:00.000
0
0
1
0
python,indexing,zodb,object-oriented-database
6,668,904
2
false
0
0
Think about using an attribute hash (something like Java's hashCode()), then use the 32-bit hash value as the key. Python has a hash function, but I am not real familiar with it.
2
5
0
I'm using an object database (ZODB) in order to store complex relationships between many objects but am running into performance issues. As a result I started to construct indexes in order to speed up object retrieval and insertion. Here is my story and I hope that you can help. Initially when I would add an object to...
Method for indexing an object database
0
1
0
601
6,668,568
2011-07-12T17:40:00.000
1
0
1
1
python,shell,gnu-screen
6,668,584
5
false
0
0
No. You won't be able to control screen program with a python program/script running within it.
1
1
0
I'm trying to write a shell script in Python to automate a process, but one of the commands I have to use is Ctrl+A (I'm using screen). Is there a way to code this into the script?
Putting "Ctrl-A" in Python shell script
0.039979
0
0
3,779
6,674,401
2011-07-13T05:19:00.000
1
0
1
1
python
6,674,591
2
false
0
0
On Mac OS X, do not modify anything in /usr (including /usr/bin) other than /usr/local, nor anything in /System/Library. Those directory spaces are managed by Apple as part of OS X. You risk breaking your system if you change or delete the wrong thing there. The best way to manage different versions is to modify you...
1
3
0
On a native Mac OS X install, I see Python binary at /usr/bin at version 2.6 Recently I installed Python 2.7.2 from the official binaries and it installed it at /usr/local/bin What path of the Python interpreter should I give in my #! which will be standardized across all platforms? I am assuming it could be /usr/bin s...
Standardized python binary location?
0.099668
0
0
3,172
6,674,946
2011-07-13T06:34:00.000
7
0
1
0
python,django,pip,buildout,egg
6,675,801
1
true
1
0
Buildout does much more than pip; each part is a separate recipe which can run arbitrary python code to get your tasks accomplished. Coupled with dependencies between the parts and update detection, zc.buildout is more comparable to make than to pip. For example, using the zc.recipe.cmmi recipe, you can download and co...
1
4
0
We're all development team working on a Django site. Recently we've begun using zc.buildout inside a virtualenv. I can see how virtualenv helps you by making a sandboxed environment. After creating a sandbox, one can simply use pip to install the necessary packages/eggs. I've read that pip can load all the eggs from a ...
Does zc.buildout offer a lot more than pip when dealing with packages/eggs
1.2
0
0
354
6,675,922
2011-07-13T08:09:00.000
0
0
1
0
python,perl
6,675,951
3
false
0
0
Create a "constants" class in Perl or Python, keeping your constants in this class. Import the class in your Perl or Python script.
2
0
0
Why does neither Perl nor Python have support for constants? Is it just considered a marginal feature that just no one meant to implement, or is there maybe something more behind it?
Languages without built-in support for constants
0
0
0
141
6,675,922
2011-07-13T08:09:00.000
6
0
1
0
python,perl
6,676,052
3
false
0
0
Python doesn't support constants because the idea is against its philosophy: we're all consenting adults here. That is, Python doesn't forbid changing things through the software; instead, it merely indicates that you shouldn't change things and may stop working if you do. To indicate a constant in a Python script one...
2
0
0
Why does neither Perl nor Python have support for constants? Is it just considered a marginal feature that just no one meant to implement, or is there maybe something more behind it?
Languages without built-in support for constants
1
0
0
141