Q_Id
int64
2.93k
49.7M
CreationDate
stringlengths
23
23
Users Score
int64
-10
437
Other
int64
0
1
Python Basics and Environment
int64
0
1
System Administration and DevOps
int64
0
1
DISCREPANCY
int64
0
1
Tags
stringlengths
6
90
ERRORS
int64
0
1
A_Id
int64
2.98k
72.5M
API_CHANGE
int64
0
1
AnswerCount
int64
1
42
REVIEW
int64
0
1
is_accepted
bool
2 classes
Web Development
int64
0
1
GUI and Desktop Applications
int64
0
1
Answer
stringlengths
15
5.1k
Available Count
int64
1
17
Q_Score
int64
0
3.67k
Data Science and Machine Learning
int64
0
1
DOCUMENTATION
int64
0
1
Question
stringlengths
25
6.53k
Title
stringlengths
11
148
CONCEPTUAL
int64
0
1
Score
float64
-1
1.2
API_USAGE
int64
1
1
Database and SQL
int64
0
1
Networking and APIs
int64
0
1
ViewCount
int64
15
3.72M
13,593,922
2012-11-27T22:00:00.000
1
0
1
0
1
python,windows,command-prompt
0
13,594,149
0
4
0
false
0
0
Changing your PATH environment variable should do the trick. Some troubleshooting tips: Make sure you didn't just change the local, but rather the system variable to reflect the new location Make sure you restarted your CL window (aka close "cmd" or command prompt and reopen it). This will refresh the system variabl...
1
2
0
0
My command prompt is currently running Python 3.2 by default how do I set it up to run Python 2.7 by default, I have changed the PATH variable to point towards Python 2.7, but that did not work. UPDATE: It still does not work. :( Still running python3 - to be specific it runs python3 when I am trying to install flask ...
Command Prompt: Set up for Python 2.7 by default
0
0.049958
1
0
0
8,222
13,606,584
2012-11-28T13:47:00.000
0
0
0
1
1
python,networking,httplib
1
13,643,155
0
3
0
false
0
0
After alot more research, the glibc problem jedwards suggested, seemed to be the problem. I did not find a solution, but made workaround for my usecase. Considering I only use one URL, I added my own "resolv.file" . A small daemon gets the IP address of the URL when PHY reports cable connected. This IP is saved to "m...
1
1
0
0
I hope this doesn't cross into superuser territory. So I have an embedded linux, where system processes are naturally quite stripped. I'm not quite sure which system process monitors to physical layer and starts a dhcp client when network cable is plugged in, but i made one myself. ¨ The problem is, that if i have a p...
Python not getting IP if cable connected after script has started
0
0
1
0
1
772
13,609,985
2012-11-28T16:38:00.000
0
0
0
0
0
javascript,python,html,django,web-applications
0
13,610,314
0
2
0
false
1
0
As Sanjay says, prefer using memory solutions (online statuses have a quite brief use) like the Django cache (Redis or Memcache). If you want a simple way of updating the online status of an user on an already loaded web page, use any lib like jQuery, AJAX-poll an URL giving the status of an user, and then update the t...
2
1
0
0
I am quite new to web development and am working on this social networking site. Now I want to add functionality to show if a person is online. Now one of the ways I figure out doing this is by keeping online status bit in the database. My question is how to do it dynamically. Say the page is loaded and a user (say c...
Tracking online status?
1
0
1
0
0
302
13,609,985
2012-11-28T16:38:00.000
1
0
0
0
0
javascript,python,html,django,web-applications
0
13,610,508
0
2
0
false
1
0
Create a new model with a last_activity DateTimeField and a OneToOneField to User. Alternatively, if you are subclassing User, using a custom User in django 1.5, or using a user profile, just add the field to that model. Write a custom middleware that automatically updates the last_activity field for each user on every...
2
1
0
0
I am quite new to web development and am working on this social networking site. Now I want to add functionality to show if a person is online. Now one of the ways I figure out doing this is by keeping online status bit in the database. My question is how to do it dynamically. Say the page is loaded and a user (say c...
Tracking online status?
1
0.099668
1
0
0
302
13,611,126
2012-11-28T17:38:00.000
1
0
0
0
0
python,opencv,machine-learning,computer-vision,object-detection
0
13,612,350
0
1
0
true
0
0
This looks like you need to determine what features you would like to train your classifier on first, as using the haar classifier it benefits from those extra features. From there you will need to train the classifier, this requires you to get a lot of images that have cars and those that do not have cars in them and ...
1
1
1
1
I am having a little bit of trouble creating a haar classifier. I need to build up a classifier to detect cars. At the moment I made a program in python that reads in an image, I draw a rectangle around the area the object is in, Once the rectangle is drawn, it outputs the image name, the top left and bottom right coor...
Creating a haar classifier using opencv_traincascade
0
1.2
1
0
0
1,867
13,619,088
2012-11-29T04:55:00.000
2
0
1
1
0
python,virtualenv
0
13,619,252
0
2
1
true
1
0
Tell Eclipse or Idle that the python interpreter is django_venv/bin/python instead of /usr/bin/python
1
3
0
0
When I enter my virtual environment (source django_venv/bin/activate), how do I make that environment transfer to apps run outside the terminal, such as Eclipse or even Idle? Even if I run Idle from the virtualenv terminal window command line (by typing idle), none of my pip installed frameworks are available within I...
Virtualenv and python - how to work outside the terminal?
0
1.2
1
0
0
2,074
13,622,895
2012-11-29T09:45:00.000
1
0
0
1
0
python,google-app-engine,web2py
0
13,892,159
0
1
0
false
1
0
Mutual exclusion is already built into DBMS so we just have to use that. Lets take an example. First, your table in the model should be defined in such a way that your room number should be unique (use UNIQUE constraint). When User1 and User2 both query for a room, they should get a response saying the room is vacant. ...
1
0
0
0
I'm making a room reservation system in Web2Py over Google App Engine. When a user is booking a Room the system must be sure that this room is really available and no one else have reserved it just a moment before. To be sure I make a query to see if the room is available, then I make the reservation. The problem is ...
Transactions in Web2Py over Google App Engine
0
0.197375
1
0
0
192
13,628,190
2012-11-29T14:42:00.000
0
0
0
0
0
java,python,cookies,http-headers,httpwebrequest
0
13,628,291
0
1
0
true
1
0
When you send the login information (and usually in response to many other requests) the server will set some cookies to the client, you must keep track of them and send them back to the server for each subsequent request. A full implementation would also keep track of the time they are supposed to be stored.
1
0
0
0
I have a crawler that automates the login and crawling for a website, but since the login was changed it is not working anymore. I am wondering, can I feed the browser cookie (aka, I manually log-in) to my HTTP request? Is there anything particularly wrong in principle that wouldn't make this work? How do I find the b...
How to use browser cookies programmatically
0
1.2
1
0
1
925
13,654,122
2012-11-30T22:29:00.000
2
0
1
0
0
python
0
62,995,730
0
10
0
false
0
0
you can try the following as well: import os print (os.environ['USERPROFILE']) The advantage of this is that you directly get an output like: C:\\Users\\user_name
3
39
0
0
I know that using getpass.getuser() command, I can get the username, but how can I implement it in the following script automatically? So i want python to find the username and then implement it in the following script itself. Script: os.path.join('..','Documents and Settings','USERNAME','Desktop')) (Python Version 2...
How to make Python get the username in windows and then implement it in a script
0
0.039979
1
0
0
107,727
13,654,122
2012-11-30T22:29:00.000
46
0
1
0
0
python
0
29,154,027
0
10
0
false
0
0
os.getlogin() did not exist for me. I had success with os.getenv('username') however.
3
39
0
0
I know that using getpass.getuser() command, I can get the username, but how can I implement it in the following script automatically? So i want python to find the username and then implement it in the following script itself. Script: os.path.join('..','Documents and Settings','USERNAME','Desktop')) (Python Version 2...
How to make Python get the username in windows and then implement it in a script
0
1
1
0
0
107,727
13,654,122
2012-11-30T22:29:00.000
72
0
1
0
0
python
0
13,654,236
0
10
0
true
0
0
os.getlogin() return the user that is executing the, so it can be: path = os.path.join('..','Documents and Settings',os.getlogin(),'Desktop') or, using getpass.getuser() path = os.path.join('..','Documents and Settings',getpass.getuser(),'Desktop') If I understand what you asked.
3
39
0
0
I know that using getpass.getuser() command, I can get the username, but how can I implement it in the following script automatically? So i want python to find the username and then implement it in the following script itself. Script: os.path.join('..','Documents and Settings','USERNAME','Desktop')) (Python Version 2...
How to make Python get the username in windows and then implement it in a script
0
1.2
1
0
0
107,727
13,655,152
2012-12-01T00:34:00.000
0
0
0
0
0
python,wxpython
0
13,687,868
0
2
0
false
0
1
Probably the only way to do it with the standard wx.Menu is to destroy and recreate the entire menubar. You might be able to Hide it though. Either way, I think it would be easiest to just put together a set of methods that creates each menubar on demand. Then you can destroy one and create the other. You might also ta...
1
1
0
0
I'm writing a document based application in wxPython, by which I mean that the user can have open multiple documents at once in multiple windows or tabs. There are multiple kinds of documents, and the documents can all be in different "states", meaning that there should be different menu options available in the main m...
How do I manage a dynamic, changing main menu in wxPython?
0
0
1
0
0
2,119
13,656,736
2012-12-01T05:34:00.000
1
0
0
0
1
python,architecture,rabbitmq,web-frameworks,gevent
0
13,775,086
0
1
1
false
1
0
My first thought is that you could use a service oriented architecture to separate these tasks. Each of these services could run a Flask app on a separate port (or machine (or pool of machines)) and communicate to each other using simple HTTP. The breakdown might go something like this: GameService: Handles incoming...
1
2
0
0
I'm creating a website that allows players to queue to find similarly skilled players for a multiplayer video game. Simple web backends only modify a database and create a response using a template, but in addition to that, my backend has to: Communicate with players in real-time (via gevent-socketio) while they queue...
When a web backend does more than simply reply to requests, how should my application be structured?
0
0.197375
1
0
0
183
13,662,400
2012-12-01T18:30:00.000
0
0
1
0
0
python,multithreading,asynchronous
0
13,663,583
0
1
0
false
0
0
i didn't really understand what sort of application its going to be, but i tried to anwser your questions create a thread that query's, and then sleeps for a while create a thread for each user, and close it when the user is gone create a thread that download's and stops after all, there ain't going to be 500 threads...
1
0
0
0
I'm developing a Python-application that "talks" to the user, and performs tasks based on what the user says(e.g. User:"Do I have any new facebook-messages?", answer:"Yes, you have 2 new messages. Would you like to see them?"). Functionality like integration with facebook or twitter is provided by plugins. Based on pre...
Multithreading or how to avoid blocking in a Python-application
0
0
1
0
0
190
13,664,861
2012-12-01T23:34:00.000
0
0
1
0
0
python,recursion,artificial-intelligence,greedy
0
13,665,044
0
3
0
false
0
0
You could actually brute force the game, and prove that every time there is a winning strategy, your A.I. picks the correct move. Then, you could prove that for every position, your A.I. picks the move which maximizes the chances of having a winning strategy, assuming the other player is playing randomly. There are not...
2
2
0
0
I made a tic tac toe A.I. Given each board state, my A.I. will return 1 exact place to move. (Even if moves are equally correct, it chooses same one every time, it does not pick a random one) I also made a function that loops though all possible plays made with the A.I. So it's a recursive function that lets the A.I. m...
How can I test if my Tic Tac Toe A.I. is perfect?
0
0
1
0
0
1,040
13,664,861
2012-12-01T23:34:00.000
0
0
1
0
0
python,recursion,artificial-intelligence,greedy
0
18,435,798
0
3
0
false
0
0
One issue with akaRem's answer is that an optimal player shouldn't look like the overall distribution. For example, a player that I just wrote wins about 90% of the time against someone playing randomly and ties 10% of the time. You should only expect akaRem's statistics to match if you have two players against each ot...
2
2
0
0
I made a tic tac toe A.I. Given each board state, my A.I. will return 1 exact place to move. (Even if moves are equally correct, it chooses same one every time, it does not pick a random one) I also made a function that loops though all possible plays made with the A.I. So it's a recursive function that lets the A.I. m...
How can I test if my Tic Tac Toe A.I. is perfect?
0
0
1
0
0
1,040
13,667,690
2012-12-02T08:33:00.000
0
0
1
1
0
python,ide,pymongo
0
32,381,638
0
2
0
false
0
0
If you are in windows platform just install the pymongo.exe file and it will install in python directory. Then you will be able to access it in any IDE such PyCharm by typing: import pymongo
1
0
0
0
I am a python newbie - I want to use the pymongo library to access mongoDb using some convenient IDE, and after looking through the web i decided to use WING. Can some one point how to add the pymongo library to the WING ide (or to any other IDE for that matter)? i want to get the auto-completion for commands. Thanks
Adding PyMongo to Python IDE
0
0
1
0
0
666
13,675,440
2012-12-03T00:05:00.000
4
1
0
0
0
python,nginx,nosql,openbsd
0
13,675,611
0
2
0
false
0
0
My advice - if you don't know how to use these technologies - don't do it. Few servers will cost you less than the time spent mastering technologies you don't know. If you want to try them out - do it. One by one, not everything at once. There is no magic solution on how to use them.
2
1
0
0
I'm familiar with LAMP systems and have been programming mostly in PHP for the past 4 years. I'm learning Python and playing around with Nginx a little bit. We're working on a project website which will handle a lot of http handle requests, stream videos(mostly from a provider like youtube or vimeo). My colleague has e...
How to utilize OpenBSD, Nginx, Python and NoSQL
0
0.379949
1
1
0
1,447
13,675,440
2012-12-03T00:05:00.000
1
1
0
0
0
python,nginx,nosql,openbsd
0
13,676,002
0
2
0
false
0
0
I agree with wdev, the time it takes to learn this is not worth the money you will save. First of all, MySQL databases are not hard to scale. WordPress utilizes MySQL databases, and some of the world's largest websites use MySQL (google for a list). I can also say the same of linux and PHP. If you design your site usi...
2
1
0
0
I'm familiar with LAMP systems and have been programming mostly in PHP for the past 4 years. I'm learning Python and playing around with Nginx a little bit. We're working on a project website which will handle a lot of http handle requests, stream videos(mostly from a provider like youtube or vimeo). My colleague has e...
How to utilize OpenBSD, Nginx, Python and NoSQL
0
0.099668
1
1
0
1,447
13,702,106
2012-12-04T11:42:00.000
1
0
1
0
1
python,qt,windows-8,pyside,stackless
1
16,126,325
0
2
0
false
0
1
I had the same problem with Pyside 1.1.2 and Qt 4.8.4. The solution for me was to set the compatibility mode of the Python executable to Windows 7 via right click on the executable -> Properties -> Compatiblity -> Run this program in compatibility mode for: Windows 7 Hope that helps.
2
2
0
0
I cannot get my code to run on my win8 laptop. I am working with a combination of: Stackless Python 2.7.2 Qt 4.8.4 PySide 1.1.2 Eclipse/Pydev and WingIDE This works well on my Win7 PC, but now i have bought a demo laptop with windows 8. As far as I know all is installed the same way as on my PC. When i run my program...
windows 8 incompatibility?
1
0.099668
1
0
0
2,146
13,702,106
2012-12-04T11:42:00.000
0
0
1
0
1
python,qt,windows-8,pyside,stackless
1
13,881,726
0
2
0
false
0
1
try using Hyper-V however Hyper-V is not installed by default in Windows 8. You need to go "Turn Windows features on or off."
2
2
0
0
I cannot get my code to run on my win8 laptop. I am working with a combination of: Stackless Python 2.7.2 Qt 4.8.4 PySide 1.1.2 Eclipse/Pydev and WingIDE This works well on my Win7 PC, but now i have bought a demo laptop with windows 8. As far as I know all is installed the same way as on my PC. When i run my program...
windows 8 incompatibility?
1
0
1
0
0
2,146
13,711,765
2012-12-04T20:56:00.000
0
0
1
1
0
python
0
13,711,840
0
2
0
false
0
0
Install both pythons, and change the path in Windows, by default both Pythons will be PATH=c:\python\python 2.7 and PATH=c:\python\python 3.2 Or something like that. What and since windows stops as soon as it finds the first python, what you could do is have one called PATH=c:\python27\ and another PATH=c:\python32\ th...
1
1
0
0
I try to save a python script as a shortcut that I want to run. It opens it but then closes right away. I know why it is doing this, it is opening my windows command line in python3.2 the script is in python 2.7 I need both version on my PC, my question is how to I change the cmd default. I have tried to "open with" sh...
changing python windows command line
1
0
1
0
0
538
13,722,760
2012-12-05T11:57:00.000
4
1
1
0
0
python
0
13,722,800
0
2
0
false
0
0
Unit testing is the best way to handle this. If you think the testing is taking too much time, ask yourself how much time you are loosing on defects - identifying, diagnosing and rectifying - after you have released the code. In effect, you are testing in production, and there's plenty of evidence to show that defects ...
1
0
0
0
I've always have trouble with dynamic language like Python. Several troubles: Typo error, I can use pylint to reduce some of these errors. But there's still some errors that pylint can not figure out. Object type error, I often forgot what type of the parameter is, int? str? some object? Also, forgot the type of some ...
How to reduce errors in dynamic language such as python, and improve my code quality?
0
0.379949
1
0
0
166
13,728,325
2012-12-05T16:54:00.000
1
1
0
1
0
python,z3
0
13,730,652
0
2
0
true
0
0
Yes, you can do it by including the build directory in your LD_LIBRARY_PATH and PYTHONPATH environment variables.
1
2
0
0
I'm trying to use Z3 from its python interface, but I would prefer not to do a system-wide install (i.e. sudo make install). I tried doing a local install with a --prefix, but the Makefile is hard-coded to install into the system's python directory. Best case, I would like run z3 directly from the build directly, in t...
Can I use Z3Py withouth doing a system-wide install?
0
1.2
1
0
0
540
13,736,310
2012-12-06T03:07:00.000
1
0
1
1
0
python,loops
0
13,736,441
0
1
0
false
0
0
The simplest solution is to add a variable outside of the loop which stores the last time the data size was checked. Every time through your loop you can compare the current time vs the last time every time through the loop and check if more than X time has elapsed.
1
0
0
0
I'm just starting out with Python. And I need help understanding how to do the main loop of my program. I have a source file with two columns of data, temperature & time. This file gets updated every 60 seconds by a bash script. I successfully wrote these three separate programs; 1. A program that can read the last 144...
Understanding an element of the main loop
0
0.197375
1
0
0
70
13,748,166
2012-12-06T16:33:00.000
7
0
0
0
1
python,django,multithreading,session,race-condition
0
13,924,932
1
3
1
true
1
0
Yes, it is possible for a request to start before another has finished. You can check this by printing something at the start and end of a view and launch a bunch of request at the same time. Indeed the session is loaded before the view and saved after the view. You can reload the session using request.session = engine...
1
8
0
0
Summary: is there a race condition in Django sessions, and how do I prevent it? I have an interesting problem with Django sessions which I think involves a race condition due to simultaneous requests by the same user. It has occured in a script for uploading several files at the same time, being tested on localhost. I ...
Django session race condition?
0
1.2
1
0
0
1,895
13,772,857
2012-12-07T23:52:00.000
0
0
0
0
0
python,mysql,flot
0
13,774,224
0
1
0
false
0
0
Install a httpd server Install php Write a php script to fetch the data from the database and render it as a webpage. This is fairly elaborate request, with relatively little details given. More information will allow us to give better answers.
1
0
1
0
So I am trying to create a realtime plot of data that is being recorded to a SQL server. The format is as follows: Database: testDB Table: sensors First record contains 3 records. The first column is an auto incremented ID starting at 1. The second column is the time in epoch format. The third column is my sensor d...
Plotting data using Flot and MySQL
0
0
1
1
0
428
13,776,973
2012-12-08T11:20:00.000
1
0
1
1
0
python,bash,shell,race-condition
0
13,777,096
0
3
0
false
0
0
The only sure way that no two scripts will act on the same file at the same time is to employ some kind of file locking mechanism. A simple way to do this could be to rename the file before beginning work, by appending some known string to the file name. The work is then done and the file deleted. Each script tests the...
1
1
0
0
I have a directory with thousands of files and each of them has to be processed (by a python script) and subsequently deleted. I would like to write a bash script that reads a file in the folder, processes it, deletes it and moves onto another file - the order is not important. There will be n running instances of thi...
Multiple processes reading&deleting files in the same directory
0
0.066568
1
0
0
1,245
13,780,732
2012-12-08T18:52:00.000
0
0
0
0
0
python,django,background-process,backend
0
13,783,426
0
3
0
false
1
0
Why don't you have a url or python script that triggers whatever sort of calculation you need to have done everytime it's run and then fetch that url or run that script via a cronjob on the server? From what your question was it doesn't seem like you need a whole lot more than that.
1
4
0
0
Newb quesion about Django app design: Im building reporting engine for my web-site. And I have a big (and getting bigger with time) amounts of data, and some algorithm which must be applied to it. Calculations promise to be heavy on resources, and it would be stupid if they are performed by requests of users. So, I thi...
Django - how to set up asynchronous longtime background data processing task?
1
0
1
0
0
2,371
13,783,071
2012-12-08T23:33:00.000
4
0
0
0
0
python,list,numpy,min
0
37,094,880
0
2
0
false
0
0
numpy.argpartition(cluster, 3) would be much more effective.
1
14
1
0
So I have this list called sumErrors that's 16000 rows and 1 column, and this list is already presorted into 5 different clusters. And what I'm doing is slicing the list for each cluster and finding the index of the minimum value in each slice. However, I can only find the first minimum index using argmin(). I don't th...
Finding the indices of the top three values via argmin() or min() in python/numpy without mutation of list?
0
0.379949
1
0
0
11,034
13,784,459
2012-12-09T03:52:00.000
0
1
1
1
0
python,linux,startup,runlevel
0
13,876,262
0
1
0
true
0
0
I may as well answer my own question with my findings. On Debian,Ubuntu,CentOS systems there is a file named /etc/rc.local. If you use pythons' FileIO to edit that file, you can put a command that will be run at the end of all the multi-user boot levels. This facility is still present on systems that use upstart. On BS...
1
0
0
0
I would like to find out how to write Python code which sets up a process to run on startup, in this case level two. I have done some reading, yet it has left me unclear as to which method is most reliable on different systems. I originally thought I would just edit /etc/inittab with pythons fileIO, but then I found ou...
Programmatically setting a process to execute at startup (runlevel 2)?
0
1.2
1
0
0
302
13,798,520
2012-12-10T09:53:00.000
3
0
0
1
0
python,bash,upnp,server-push,samsung-smart-tv
0
13,798,803
0
1
0
true
0
0
You will still need a DLNA server to host your videos on. Via UPnP you only hand the URL to the TV, not the video directly. Once you have it hosted on a DLNA server, you can find out the URL to a video by playing it in Windows Media Player (which has DLNA-support) or by using UPnP Inspector (which I recommend anyways, ...
1
2
0
0
I would like to make a simple script to push a movie to a Smart TV. I have already install miniupnp or ushare, but I don't want to go in a folder by the TV Smart Apps, i want to push the movie to the TV, to win time and in future why not make the same directly from a NAS. Can anyone have an idea how to do this ? This a...
uPnP pushing video to Smart TV/Samsung TV on OSX/Mac
0
1.2
1
0
0
3,338
13,803,315
2012-12-10T14:51:00.000
0
1
0
0
0
python,eclipse
0
13,866,443
0
1
0
false
0
0
You can use NetBeans 6.5 IDE its provide python support.
1
0
0
0
I have installed PyCuda without any difficulty but am having trouble linking it to my eclipse environment. Does anyone know how I can link pycuda and eclipse IDE? Thanks in Adanced
PyCuda and Eclipse
0
0
1
0
0
284
13,823,554
2012-12-11T15:52:00.000
0
0
0
0
0
python,elasticsearch
0
14,884,970
0
2
0
false
0
0
It sounds like you have an issue unrelated to the client. If you can pare down what's being sent to ES and represent it in a simple curl command it will make what's actually running slowly more apparent. I suspect we just need to tweak your query to make sure it's optimal for your context.
2
4
0
0
I'm writing some scripts for our sales people to query an index with elastic search through python. (Eventually the script will update lead info in our Salesforce DB.) I have been using the urllib2 module, with simplejson, to pull results. The problem is that this seems to be a not-so-good approach, evidenced by script...
Elastic search client for Python: advice?
0
0
1
0
1
748
13,823,554
2012-12-11T15:52:00.000
2
0
0
0
0
python,elasticsearch
0
14,870,170
0
2
0
true
0
0
We use pyes. And its pretty neat. You can there go with the thrift protocol which is faster then the rest service.
2
4
0
0
I'm writing some scripts for our sales people to query an index with elastic search through python. (Eventually the script will update lead info in our Salesforce DB.) I have been using the urllib2 module, with simplejson, to pull results. The problem is that this seems to be a not-so-good approach, evidenced by script...
Elastic search client for Python: advice?
0
1.2
1
0
1
748
13,830,334
2012-12-11T23:36:00.000
1
0
1
0
0
python,variables
0
13,830,530
0
3
0
false
0
0
You need to store it on disk. Unless you want to be really fancy, you can just use something like CSV, JSON, or YAML to make structured data easier. Also check out the python pickle module.
1
6
0
0
I'm writing a small program that helps you keep track of what page you're on in your books. I'm not a fan of bookmarks, so I thought "What if I could create a program that would take user input, and then display the number or string of text that they wrote, which in this case would be the page number they're on, and al...
Change variable permanently
0
0.066568
1
0
0
5,917
13,832,095
2012-12-12T02:59:00.000
1
0
1
0
0
python
0
13,832,200
0
3
0
false
0
0
While the approach of @Makato is certainly right, for your 'diff' like application you want to capture the inode 'stat()' information of the files in your directory and pickle that python object from day-to-day looking for updates; this is one way to do it - overkill maybe - but more suitable than save/parse-load from ...
1
2
0
0
Is it possible for the user to input a specific directory on their computer, and for Python to write the all of the file/folder names to a text document? And if so, how? The reason I ask is because, if you haven't seen my previous posts, I'm learning Python, and I want to write a little program that tracks how many fil...
PYTHON - Search a directory
1
0.066568
1
0
0
7,504
13,846,155
2012-12-12T18:22:00.000
1
1
1
1
0
python,egg,python-internals
0
13,846,221
0
1
0
true
0
0
No, that is not a bug. Eggs, when being created, have their bytecode compiled in a build/bdist.<platform>/egg/ path, and you see that reflected in the co_filename variable. The bdist stands for binary distribution.
1
0
0
0
When tracing(using sys.settrace) python .egg execution by Python 2.7 interpreter frame.f_code.co_filename instead of <path-to-egg>/<path-inside-egg> eqauls to something like build/bdist.linux-x86_64/egg/<path-inside-egg> Is it a bug? And how to reveal real path to egg? In Python 2.6 and Python 3 everything works as ...
Strange co_filename for file from .egg during tracing in Python 2.7
0
1.2
1
0
0
84
13,858,776
2012-12-13T11:22:00.000
1
0
1
0
0
python,debugging,pdb
0
13,961,662
0
4
0
false
0
0
Using pdb, any function call can be stepped into. For any other statement, pdb can print the values of the relevant names in the line. What additional functionality are you looking for that isn't covered? If you're trying to 'step into' things like a list comprehension, that won't work from a pure Python perspective b...
1
7
0
0
I want to build a visual debugger, which helps programming students to see how expression evaluation takes place (how subexpressions get evaluated and "replaced" by their values, something like expression evaluation visualizer in Excel). Looks like you can't step through this process with Python's pdb, as its finest st...
How to step through Python expression evaluation process?
1
0.049958
1
0
0
1,143
13,859,124
2012-12-13T11:44:00.000
0
0
0
0
0
python,html,parsing
0
18,350,504
0
3
0
true
1
0
No, to this moment there is no such HTML parser and every parser has it's own limitations.
1
1
0
0
I want to parse html code in python and tried beautiful soup and pyquery already. The problem is that those parsers modify original code e.g insert some tag or etc. Is there any parser out there that do not change the code? I tried HTMLParser but no success! :( It doesn't modify the code and just tells me where tags a...
python html parser which doesn't modify actual markup?
0
1.2
1
0
1
273
13,884,439
2012-12-14T18:37:00.000
2
0
1
0
0
python,audio
1
13,884,538
0
2
0
false
0
0
The answer is highly platform dependent and more details are required. Different Operating Systems have different ways of handling Interprocess Communication, or IPC. If you're using a UNIXlike environment, there are a rich set of IPC primitives to work with. Pipes, SYS V Message Queues, shared memory, sockets, etc. In...
1
1
0
0
Suppose I have two functions drawn from two different APIs, function A and B. By default, function A outputs audio data to a wav file. By default, function B takes audio input from a wav file and process it. Is it possible to stream the data from function A to B? If so, how do I do this? I work on lubuntu if that is r...
Redirecting audio output from one function to another function in python
1
0.197375
1
0
0
1,006
13,889,066
2012-12-15T03:39:00.000
3
0
1
0
0
python
0
13,889,088
0
5
0
false
0
0
You can do timings within Python, but if you want to know the overall CPU consumption of your program, that is kind of silly to do. The best thing to do is to just use the GNU time program. It even comes standard in most operating systems.
1
7
0
0
Pretty simple, I'd like to run an external command/program from within a Python script, once it is finished I would also want to know how much CPU time it consumed. Hard mode: running multiple commands in parallel won't cause inaccuracies in the CPU consumed result.
Run an external command and get the amount of CPU it consumed
0
0.119427
1
0
0
2,139
13,892,113
2012-12-15T12:20:00.000
6
0
0
0
0
python,rss
0
13,892,148
0
1
0
false
0
0
Each RSS have some format. See what Content-Type the server returns for the given URL. However, this may not be specific and a server may not necessarily return the correct header. Try to parse the content of the URL as RSS and see if it is successful - this is likely the only definitive proof that a given URL is a RS...
1
0
0
0
am trying to find a way to detect if a given URL has an RSS feed or not. Any suggestions?
given a URL in python, how can i check if URL has RSS feed?
1
1
1
0
1
812
13,899,823
2012-12-16T08:46:00.000
2
0
0
0
0
python,pip,web2py
0
14,100,013
0
2
0
true
1
0
I think I can give my answer to my own question: we don't need to install web2py, just download it and python it.
1
5
0
0
I tried to install Web2py with pip. The installation is completed successfully. But after that I don't know how to start the server. I know there are three apps which are 'w2p_clone', 'w2p_apps' and 'w2p_run'. I don't know how to use these three apps. And also I did not set up my virtual env for Web2py, however even I ...
pip install web2py
0
1.2
1
0
0
2,902
13,906,679
2012-12-16T23:50:00.000
0
1
1
0
0
c++,python,memory,ram
0
13,928,292
0
4
0
false
0
0
Your problem description is kind of vague and can be read in several different ways. One way in which I read this is that you have some kind of ASCII representation of a data structure on disk. You read this representation into memory, and then grep through it one or more times looking for things that match a given reg...
3
2
0
0
Is it possible to store python (or C++) data in RAM for latter use and how can this be achieved? Background: I have written a program that finds which lines in the input table match the given regular expression. I can find all the lines in roughly one second or less. However the problem is that i process the input tabl...
Storing large python object in RAM for later use
1
0
1
0
0
2,201
13,906,679
2012-12-16T23:50:00.000
2
1
1
0
0
c++,python,memory,ram
0
13,924,546
0
4
0
false
0
0
We regularly load and store much larger chunks of memory than 2 Gb in no time (seconds). We can get 350 Mb/s from our 3 year old SAN. The bottlenecks /overheads seem to involve mainly python object management. I find that using marshal is much faster than cPickle. Allied with the use of data structures which involve mi...
3
2
0
0
Is it possible to store python (or C++) data in RAM for latter use and how can this be achieved? Background: I have written a program that finds which lines in the input table match the given regular expression. I can find all the lines in roughly one second or less. However the problem is that i process the input tabl...
Storing large python object in RAM for later use
1
0.099668
1
0
0
2,201
13,906,679
2012-12-16T23:50:00.000
2
1
1
0
0
c++,python,memory,ram
0
13,906,794
0
4
0
false
0
0
You could try pickling your object and saving it to a file, so that each time the program runs it just has to deserialise the object instead of recalculating it. Hopefully the server's disk cache will keep the file hot if necessary.
3
2
0
0
Is it possible to store python (or C++) data in RAM for latter use and how can this be achieved? Background: I have written a program that finds which lines in the input table match the given regular expression. I can find all the lines in roughly one second or less. However the problem is that i process the input tabl...
Storing large python object in RAM for later use
1
0.099668
1
0
0
2,201
13,910,576
2012-12-17T08:23:00.000
0
0
1
0
0
python,sqlalchemy
0
13,910,851
0
3
0
false
0
0
This is a classic case of buffering. Try a reasonably large chunk and reduce it if there's too much disk I/O (or you don't like it causing long pauses, etc) or increase it if your profile shows too much CPU time in I/O calls. To implement, use an array, each "write" you append an item to the array. Have a separate "flu...
1
0
0
0
I developed an application which parses a lot of data, but if I commit the data after parsing all the data, it will consume too much memory. However, I cannot commit it each time, because it costs too much hard disk I/O. Therefore, my question is how can I know how many uncommitted items are in the session?
Find out how many uncommitted items are in the session
0
0
1
0
0
1,666
13,920,682
2012-12-17T19:19:00.000
1
0
1
0
0
python,.net,powerbuilder
0
13,943,263
0
1
0
true
0
1
A PowerBuilder application can load a DataWindow from a PBL (doesn't have to be in the library path), modify it, and save it back to the PBL. I've written a couple of tools that do that. PowerBuilder will allow you to modify the DataWindow according to its object model using the modify method. I don't know why anyone w...
1
1
0
0
I want to get the content of DataWindow from PBL (PowerBuilder Library) file and edit it in place. The idea is to read the pbl file, and access individual DataWindows to modify source code. Somehow, I have managed to do the first part with PblReader .NET library using IronPython. It allows me to read PBL files, and acc...
idea/solution how to edit PBL (PowerBuilder Library) files?
0
1.2
1
0
0
3,599
13,936,563
2012-12-18T15:47:00.000
5
0
0
0
0
python,netcdf
0
16,386,862
0
5
0
false
0
0
If you want to only use the netCDF-4 API to copy any netCDF-4 file, even those with variables that use arbitrary user-defined types, that's a difficult problem. The netCDF4 module at netcdf4-python.googlecode.com currently lacks support for compound types that have variable-length members or variable-length types of a...
1
5
0
0
I would like to make a copy of netcdf file using Python. There are very nice examples of how to read or write netcdf-file, but perhaps there is also a good way how to make the input and then output of the variables to another file. A good-simple method would be nice, in order to get the dimensions and dimension variab...
copy netcdf file using python
1
0.197375
1
0
0
3,485
13,938,903
2012-12-18T18:07:00.000
2
1
0
0
0
c#,python,asp.net,web-services,perl
0
13,939,065
0
3
0
false
0
0
a) WebSockets in conjuction with ajax to update only parts of the site would work, disadvantage: the clients infrastructure (proxies) must support those (which is currently not the case 99% of time). b) With existing infrastructure the approach is Long Polling. You make an XmlHttpRequest using javascript. In case no da...
1
2
0
0
I wonder how to update fast numbers on a website. I have a machine that generates a lot of output, and I need to show it on line. However my problem is the update frequency is high, and therefore I am not sure how to handle it. It would be nice to show the last N numbers, say ten. The numbers are updated at 30Hz. That ...
Rapid number updates on a website
0
0.132549
1
0
1
114
13,940,449
2012-12-18T19:52:00.000
2
1
0
0
1
python,html,tidesdk
0
13,948,150
0
1
0
false
1
0
The current version has very old webkit so because of that the HTML5 support is lacking. Audio and video tags are currently not supported in windows because underlying webkit implementation (wincairo) does not support it. Wa are working on the first part to use the latest webkit. once completed we are also planning to ...
1
0
0
0
Iam trying to stream audio in my TideSDK application, but it seems to be quite difficult. The HTML5 audio does not work for me, neither does video tags. The player simply keeps loading. I've tested and confirmed that my code worked in many other browsers. My next attemp was VLC via Python bindings. But without any conf...
Streaming audio in Python with TideSDK
1
0.379949
1
0
0
401
13,965,403
2012-12-20T04:37:00.000
0
0
0
0
0
python,parsing,selenium,lxml,xpath
0
40,276,743
0
2
0
false
1
0
I prefer to use lxml. Because the efficiency of lxml is more higher than selenium for large elements extraction. You can use selenium to get source of webpages and parse the source with lxml's xpath instead of the native find_elements_with_xpath in selenium.
1
1
0
1
So I have been trying to figure our how to use BeautifulSoup and did a quick search and found lxml can parse the xpath of an html page. I would LOVE if I could do that but the tutorial isnt that intuitive. I know how to use Firebug to grab the xpath and was curious if anyone has use lxml and can explain how I can use i...
Can I parse xpath using python, selenium and lxml?
0
0
1
0
1
1,853
13,999,970
2012-12-22T04:07:00.000
0
0
0
0
0
python,qt,user-interface,qt4,pyqt
0
14,000,161
0
2
0
true
1
1
You need to connect your view to the dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ) signal of the model: This signal is emitted whenever the data in an existing item changes. If the items are of the same parent, the affected ones are those between topLeft and bottomRight inclusive. If t...
1
3
0
0
By default, the built-in views in PyQt can auto-refresh itself when its model has been updated. I wrote my own chart view, but I don't know how to do it, I have to manually update it for many times. Which signal should I use?
PyQt - Automatically refresh a custom view when the model is updated?
0
1.2
1
0
0
5,032
14,000,083
2012-12-22T04:34:00.000
1
0
1
0
0
list,python-2.7,indexing
0
14,000,721
0
2
0
false
0
0
Lets use a 'list' with following values: '1', '2', '3','4', '5', '6' Steps to get the negative index of any value: Step1. Get the 'normal_index' of the value. For example the normal index of value '4' is 3. Step2. Get the 'count' of the 'list'. In our example the 'list_count' is 5. Step3. Get Negative index of the requ...
1
2
0
0
I have a string of variable length and I know the index position is 25. As it's variable in his length (>= 25), I need a way to locate the negative index of that same position for easier data manipulation. Do you have any idea how this can be done?
How do you find the negative index of a position if you know the index?
1
0.099668
1
0
0
67
14,003,386
2012-12-22T13:51:00.000
1
0
0
0
0
python,windows
1
14,003,444
0
1
0
false
1
0
Use sys.getfilesystemencoding(). That should allow you to convert all paths that look ok. However, there can always be illegally-encoded files or folders, you have to think how to deal with those in the framework of your application. Some apps may ignore such files, others keep name as a binary blob.
1
0
0
0
I'm writing a small application which saves file paths to a database (using django). I assumed file paths are utf-8 encoded, but I ran into the following file name: C:\FXG™.nfo which is apparently not encoded in utf-8. When I do filepath.decode('utf-8') I get the following error: UnicodeDecodeError: 'utf8' codec can't...
File path encoding in Windows
0
0.197375
1
0
0
1,880
14,004,835
2012-12-22T17:13:00.000
1
0
0
1
1
python,ncurses,curses
0
72,080,593
0
3
0
false
0
1
While I didn't use curses in python, I am currently working with it in C99, compiled using clang on Mac OS Catalina. It seems that nodelay()` does not work unless you slow down the program step at least to 1/10 of a second, eg. usleep(100000). I suppose that buffering/buffer reading is not fast enough, and getch() or w...
2
7
0
0
I've written a curses program in python. It runs fine. However, when I use nodelay(), the program exits straight away after starting in the terminal, with nothing shown at all (just a new prompt). EDIT This code will reproduce the bug: sc = curses.initscr() sc.nodelay(1) # But removing this line allows the program t...
nodelay() causes python curses program to exit
0
0.066568
1
0
0
5,827
14,004,835
2012-12-22T17:13:00.000
0
0
0
1
1
python,ncurses,curses
0
14,006,585
0
3
0
false
0
1
I see no difference when running your small test program with or without the sc.nodelay() line. Neither case prints anything on the screen...
2
7
0
0
I've written a curses program in python. It runs fine. However, when I use nodelay(), the program exits straight away after starting in the terminal, with nothing shown at all (just a new prompt). EDIT This code will reproduce the bug: sc = curses.initscr() sc.nodelay(1) # But removing this line allows the program t...
nodelay() causes python curses program to exit
0
0
1
0
0
5,827
14,008,232
2012-12-23T02:46:00.000
1
0
0
0
0
python,mysql,django,security,encryption
0
14,008,320
0
2
0
false
1
0
Your question embodies a contradiction in terms. Either you don't want reversibility or you do. You will have to choose. The usual technique is to hash the passwords and to provide a way for the user to reset his own password on sufficient alternative proof of identity. You should never display a password to anybody, f...
2
2
0
0
So, a friend and I are currently writing a panel (in python/django) for managing gameservers. Each client also gets a MySQL server with their game server. What we are stuck on at the moment is how clients will find out their MySQL password and how it will be 'stored'. The passwords would be generated randomly and prese...
Storing MySQL Passwords
0
0.099668
1
1
0
408
14,008,232
2012-12-23T02:46:00.000
4
0
0
0
0
python,mysql,django,security,encryption
0
14,008,264
0
2
0
true
1
0
Though this is not the answer you were looking for, you only have three possibilities store the passwords plaintext (ugh!) store with a reversible encryption, e.g. RSA (http://stackoverflow.com/questions/4484246/encrypt-and-decrypt-text-with-rsa-in-php) do not store it; clients can only reset password, not view it Th...
2
2
0
0
So, a friend and I are currently writing a panel (in python/django) for managing gameservers. Each client also gets a MySQL server with their game server. What we are stuck on at the moment is how clients will find out their MySQL password and how it will be 'stored'. The passwords would be generated randomly and prese...
Storing MySQL Passwords
0
1.2
1
1
0
408
14,013,214
2012-12-23T17:49:00.000
0
0
0
0
0
python,django,linux,deployment
0
14,013,487
0
1
0
false
1
0
If the names on the development and production server are the same, then record the rename commands in a shell-script. You can run that on both the development and the production server...
1
0
0
0
I have a development & production server and some large video files. The large files need to be renamed. I don't know how to automatically change the file names in the production environment when I change their name in the development environment. I think using git is very inefficient for large files. On the developmen...
synchronizing file names across servers
0
0
1
0
0
67
14,028,164
2012-12-25T06:09:00.000
3
0
1
0
0
python,list,shallow-copy,deep-copy
0
14,028,181
0
2
0
false
0
0
The new list is a copy of references. g[0] and a[0] both reference the same object. Thus this is a shallow copy. You can see the copy module's deepcopy method for recursively copying containers, but this isn't a common operation in my experience. Stylistically, I prefer the more explicit g = list(a) to create a copy of...
1
1
0
0
How is Deep copy being done in python for lists? I am a little confused for copying of lists. Is it using shallow copy or deep copy? Also, what is the syntax for sublists? is it g=a[:]?
python lists copying is it deep copy or Shallow copy and how is it done?
0
0.291313
1
0
0
1,094
14,029,177
2012-12-25T08:57:00.000
0
0
1
0
0
python,list
0
14,030,552
0
4
0
false
0
0
In C language terms, a Python list is like a PyObject *mylist[100], except it's dynamically allocated. It's a contiguous chunk of memory storing references to Python objects.
3
0
0
0
How does the language know how much space to reserve for each element? Or does it reserve the maximum space possible required for a datatype? (Talk about large floating point numbers). In that case isn't it a bit inefficient?
How dynamic arrays store different datatypes?
1
0
1
0
0
91
14,029,177
2012-12-25T08:57:00.000
1
0
1
0
0
python,list
0
14,029,213
0
4
0
false
0
0
Arrays in Python are done via the array module. They do not store different datatypes, they store arrays of specific numerical values. I think you mean the list type. It doesn't contain values, it just contains references to objects, which can be any type of object at all. None of these reserves any space for any eleme...
3
0
0
0
How does the language know how much space to reserve for each element? Or does it reserve the maximum space possible required for a datatype? (Talk about large floating point numbers). In that case isn't it a bit inefficient?
How dynamic arrays store different datatypes?
1
0.049958
1
0
0
91
14,029,177
2012-12-25T08:57:00.000
1
0
1
0
0
python,list
0
14,029,199
0
4
0
false
0
0
Python reserves only enough space in a list for a reference to the various objects; it is up to the objects' allocators to reserve enough space for them when they are instantiated.
3
0
0
0
How does the language know how much space to reserve for each element? Or does it reserve the maximum space possible required for a datatype? (Talk about large floating point numbers). In that case isn't it a bit inefficient?
How dynamic arrays store different datatypes?
1
0.049958
1
0
0
91
14,032,521
2012-12-25T17:04:00.000
5
0
1
0
0
python,list,sorting,alphabetical
0
26,274,529
0
6
0
false
0
0
ListName.sort() will sort it alphabetically. You can add reverse=False/True in the brackets to reverse the order of items: ListName.sort(reverse=False)
1
207
0
0
I am a bit confused regarding data structure in python; (),[], and {}. I am trying to sort a simple list, probably since I cannot identify the type of data I am failing to sort it. My list is simple: ['Stem', 'constitute', 'Sedge', 'Eflux', 'Whim', 'Intrigue'] My question is what type of data this is, and how to sort ...
Python data structure sort list alphabetically
0
0.16514
1
0
0
435,587
14,034,401
2012-12-25T22:21:00.000
4
0
0
0
0
python,qt,cookies,qwebkit
0
14,039,648
0
1
0
true
0
1
You can get/set the cookie jar through QWebView.page().networkAccessManager().cookieJar()/setCookieJar(). The Browser demo included with Qt (in C++) shows how to read and write cookies to disk.
1
3
0
0
I need to store cookies persistently in an application that uses QWebKit. I understand that I have to create a subclass of QNetworkCookieJar and attach it to a QNetworkAccessManager. But how do I attach this QNetworkAccessManager to my QWebView or get the QNetworkAccessManager used by it? I use Python 3 and PyQt if tha...
Permanent cookies with QWebKit -- where to get the QNetworkAccessManager?
0
1.2
1
0
0
1,268
14,036,549
2012-12-26T06:00:00.000
0
1
0
1
0
python,uwsgi,pythonpath
0
14,039,533
0
1
0
false
0
0
you can specify multiple --pythonpath options, but PYTHONPATH should be honoured (just be sure it is correctly set by your init script, you can try setting it from the command line and running uwsgi in the same shell session)
1
1
0
0
Its weird because, when I run a normal python script on the server, it runs but when I run it via uWSGI, it cant import certain modules. there is a bash script that starts uwsgi, and passes a path via --pythonpath option. Is this an additional path or all the paths have to be given here ? If yes, how do I separate mult...
Does uwsgi server read the paths in the environment variable PYTHONPATH?
0
0
1
0
0
1,207
14,043,045
2012-12-26T16:05:00.000
1
0
0
1
0
python,google-app-engine,google-cloud-datastore
0
14,043,190
0
2
0
false
0
0
Every blob you upload, creates a new version of that blob (with that filename) in the blobstore. Ofcourse you can delete the old version(s) of the blob, if you uploaded a new version. But to make sure you have the latest version of a blob (of a filename) you have to store the filename in the datastore and make a refere...
1
0
0
0
I know that I can grab a blob by BlobKey, but how do I get the blobkey associated with a given filename? In short, I want to implement "get file by filename" I can't seem to find any built-in functionality for this.
Downloading a Blob by Filename in Google App Engine (Python)
0
0.099668
1
0
0
259
14,049,028
2012-12-27T03:31:00.000
3
0
1
0
0
python,self
0
14,049,063
0
2
0
false
0
0
It's not really allright. self makes your variable available to global object-scope. That way you need to make sure that names of your variables are unique throughout complete object, rather than in localized scopes, amongst other side-effects that might or might not be unwanted. In your particular case it might be not...
2
3
0
0
I have a habit to declare new variables with self. in front to make it available to all methods. This is because sometimes I thought I don't need the variable in other methods. But halfway through I realized that I need it to be accessible in other methods. Then I have to add self. in front of all that variable. So my ...
Is declaring [almost] everything with self. alright (Python)?
1
0.291313
1
0
0
184
14,049,028
2012-12-27T03:31:00.000
14
0
1
0
0
python,self
0
14,049,045
0
2
0
true
0
0
Set a property on self only when the value is part of the overall object state. If it's only part of the method state, then it should be method-local, and should not be a property of self.
2
3
0
0
I have a habit to declare new variables with self. in front to make it available to all methods. This is because sometimes I thought I don't need the variable in other methods. But halfway through I realized that I need it to be accessible in other methods. Then I have to add self. in front of all that variable. So my ...
Is declaring [almost] everything with self. alright (Python)?
1
1.2
1
0
0
184
14,051,324
2012-12-27T07:57:00.000
0
0
0
1
0
python,pypy
1
69,422,294
0
2
0
false
0
0
For anyone coming here in the future, Oct 3 2021 pypy3 does accept the -O flag and turn off assertion statements
2
5
0
0
$ ./pypy -O Python 2.7.2 (a3e1b12d1d01, Dec 04 2012, 13:33:26) [PyPy 1.9.1-dev0 with GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. And now for something completely different: `` amd64 and ppc are only available in enterprise version'' >>>> assert 1==2 Traceback (most recent...
how to disable pypy assert statement?
0
0
1
0
0
342
14,051,324
2012-12-27T07:57:00.000
5
0
0
1
0
python,pypy
1
14,051,708
0
2
0
true
0
0
PyPy does silently ignore -O. The reasoning behind it is that we believe -O that changes semantics is seriously broken, but well, I guess it's illegal. Feel free to post a bug (that's also where such reports belong, on bugs.pypy.org)
2
5
0
0
$ ./pypy -O Python 2.7.2 (a3e1b12d1d01, Dec 04 2012, 13:33:26) [PyPy 1.9.1-dev0 with GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. And now for something completely different: `` amd64 and ppc are only available in enterprise version'' >>>> assert 1==2 Traceback (most recent...
how to disable pypy assert statement?
0
1.2
1
0
0
342
14,051,766
2012-12-27T08:42:00.000
1
0
0
1
0
python,linux,command-line
0
14,052,830
0
2
1
false
0
0
You can check the state of the printer using the lpstat command (man lpstat). To wait for a process to finish, get the PID of the process and pass it wait command as argument
1
4
0
0
I have a bunch of files that I need to print via PDF printer and after it is printed I need to perform additional tasks, but only when it is finally completed. So to do this from my python script i call command "lpr path/to/file.doc -P PDF" But this command immediately returns 0 and I have no way to track when printin...
How to check if pdf printing is finished on linux command line
0
0.099668
1
0
0
2,252
14,074,805
2012-12-28T19:40:00.000
1
0
1
0
0
python,configobj
0
14,075,363
0
6
0
false
0
0
Configobj is for reading and writing ini-style config files. You are apparently trying to use it to write bash scripts. That's not something that is likely to work. Just write the bash-script like you want it to be, perhaps using a template or something instead. To make ConfigParses not write the spaces around the = pr...
1
2
0
0
Simple question. It is possible to make configobj to not put a space before and after the '=' in a configuration entry ? I'm using configobj to read and write a file that is later processed by a bash script, so putting an antry like: VARIABLE = "value" breaks the bash script, it needs to always be: VARIABLE="value" Or...
Make python configobj to not put a space before and after the '='
1
0.033321
1
0
0
1,931
14,079,587
2012-12-29T07:13:00.000
7
0
1
0
0
python,integer
0
14,079,631
0
4
0
false
0
0
There's no need. The interpreter handles allocation behind the scenes, effectively promoting from one type to another as needed without you doing anything explicit.
1
3
0
0
I want to differentiate between 32-bit and 64-bit integers in Python. In C it's very easy as we can declare variables using int_64 and int_32. But in Python how do we differentiate between 32-bit integers and 64-bit integers?
How to determine whether the number is 32-bit or 64-bit integer in Python?
0
1
1
0
0
5,901
14,101,063
2012-12-31T11:36:00.000
3
0
0
0
0
c#,python,ui-automation,pywinauto
0
14,104,632
0
2
0
false
0
1
The short answer is that there's no good way to automate sub-controls of a DataGridView using PyWinAuto. If you want to read data out of a DataGridView (e.g. read the text contents of a cell, or determine whether a checkbox is checked), you are completely out of luck. If you want to control a DataGridView, there are t...
1
0
0
0
I was working with GUI automation for visual studio C# desktop application. There I have DataGridView and inside the grid I have combo box and check boxes. I tried to automate these using pywinauto, I can get only grid layout control only and internal things I cant able to get the controls (I tried with print _control_...
C# GUI automation using PyWinAuto
0
0.291313
1
0
0
1,878
14,113,906
2013-01-01T20:23:00.000
0
0
0
1
0
python,macos,command-line
0
14,113,933
0
3
0
false
0
0
Add the directory it is stored in to your PATH variable? From your prompt, I'm guessing you're using an sh-like shell and from your tags, I'm further assuming OS X. Go into your .bashrc and make the necessary changes.
2
0
0
0
I have just written a python script to do some batch file operations. I was wondering how i could keep it in some common path like rest of the command line utilities like cd, ls, grep etc. What i expect is something like this to be done from any directory - $ script.py arg1 arg2
How to execute a python command line utility from the terminal in any directory
0
0
1
0
0
170
14,113,906
2013-01-01T20:23:00.000
1
0
0
1
0
python,macos,command-line
0
14,113,928
0
3
0
true
0
0
Just put the script directory into the PATH environment variable, or alternatively put the script in a location that is already in the PATH. On Unix systems, you usually use /home/<nick>/bin for your own scripts and add that to the PATH.
2
0
0
0
I have just written a python script to do some batch file operations. I was wondering how i could keep it in some common path like rest of the command line utilities like cd, ls, grep etc. What i expect is something like this to be done from any directory - $ script.py arg1 arg2
How to execute a python command line utility from the terminal in any directory
0
1.2
1
0
0
170
14,120,045
2013-01-02T10:02:00.000
3
0
0
1
1
python,linux,audio
0
14,120,125
0
2
0
true
0
0
mpd should be perfect for you. It is a daemon and can be controlled by various clients, ranging from GUI-less command-line clients like mpc to GUI command-line clients like ncmpc and ncmpcpp up to several full-featured desktop clients. mpd + mpc should do the job for you as mpc can be easily controlled via the command ...
1
3
0
0
I want to build use my Raspberry Pi as a media station. It should be able to play songs via commands over the network. These commands should be handled by a server written in Python. Therefor, I need a way to control audio playback via Python. I decided to use a command line music player for linux since those should of...
Python-controllable command line audio player for Linux
1
1.2
1
0
0
2,048
14,130,010
2013-01-02T22:09:00.000
0
0
1
0
0
java,python,image,image-recognition
0
14,130,289
0
3
0
false
0
0
If I were going to do this, I would use normalized floats. The letter A would be: [(0.0,0.0),(0.5,1.0),(1.0,0.0),(0.1,0.5)(0.9,0.5)] Update (further explanation) So my thought is that you should be able to uniquely identify a letter with an array of normalized points. Points would be at important features of the let...
3
2
0
0
I am developing Image recognition software that will detect letters. I was wondering how I could create a model of a letter ("J" for example) so that when I take a picture with the letter "J" on it, the software will compare the image to the model and detect the letter "J". How would I create the model?
Creating an Image model
0
0
1
0
0
203
14,130,010
2013-01-02T22:09:00.000
0
0
1
0
0
java,python,image,image-recognition
0
14,130,097
0
3
0
false
0
0
You can use OpenCv library for java , this library contain Template Matching Model already implemented but the better thing for image recognition is using learning machine or neural network
3
2
0
0
I am developing Image recognition software that will detect letters. I was wondering how I could create a model of a letter ("J" for example) so that when I take a picture with the letter "J" on it, the software will compare the image to the model and detect the letter "J". How would I create the model?
Creating an Image model
0
0
1
0
0
203
14,130,010
2013-01-02T22:09:00.000
2
0
1
0
0
java,python,image,image-recognition
0
14,130,216
0
3
0
false
0
0
It seems you want to do OCR (Optical Character Recognition). If this is only part of a larger project, try OpenCV. Even if you are making a commercial product, it has a permissive BSD license. If you have set out to make a library of your own, read some of the papers available through any good search engine. There are ...
3
2
0
0
I am developing Image recognition software that will detect letters. I was wondering how I could create a model of a letter ("J" for example) so that when I take a picture with the letter "J" on it, the software will compare the image to the model and detect the letter "J". How would I create the model?
Creating an Image model
0
0.132549
1
0
0
203
14,139,377
2013-01-03T12:54:00.000
0
0
0
1
0
python,batch-file,cross-platform,py2exe,scientific-computing
0
14,139,446
0
3
0
false
0
0
I would recommend using py2exe for the windows side, and then BuildApplet for the mac side. This will allow you to make a simple app you double click for your less savvy users.
2
5
0
0
EDIT One option I contemplated but don't know enough about is to e.g. for windows write a batch script to: Search for a Python installation, download one and install if not present Then install the bundled package using distutils to also handle dependencies. It seems like this could be a relatively elegant and simpl...
Cross-platform deployment and easy installation
0
0
1
0
0
1,886
14,139,377
2013-01-03T12:54:00.000
2
0
0
1
0
python,batch-file,cross-platform,py2exe,scientific-computing
0
14,139,409
0
3
0
false
0
0
py2exe works pretty well, I guess you just have to setup a Windows box (or VM) to be able to build packages with it.
2
5
0
0
EDIT One option I contemplated but don't know enough about is to e.g. for windows write a batch script to: Search for a Python installation, download one and install if not present Then install the bundled package using distutils to also handle dependencies. It seems like this could be a relatively elegant and simpl...
Cross-platform deployment and easy installation
0
0.132549
1
0
0
1,886
14,152,548
2013-01-04T06:55:00.000
0
1
0
1
0
python,python-3.x
0
64,151,445
0
3
0
false
0
0
In the general case, no; many Python 2 scripts will not run on Python 3, and vice versa. They are two different languages. Having said that, if you are careful, you can write a script which will run correctly under both. Some authors take extra care to make sure their scripts will be compatible across both versions, co...
2
7
0
0
i have thousands of servers(linux), some only has python 2.x and some only has python 3.x, i want to write one script check.py can run on all servers just as $./check.py without use $python check.py or $python3 check.py, is there any way to do this? my question is how the script check.py find the Interpreter no matter ...
can one python script run both with python 2.x and python 3.x
1
0
1
0
0
5,143
14,152,548
2013-01-04T06:55:00.000
0
1
0
1
0
python,python-3.x
0
14,152,613
0
3
0
false
0
0
Considering that Python 3.x is not entirely backwards compatible with Python 2.x, you would have to ensure that the script was compatible with both versions. This can be done with some help from the 2to3 tool, but may ultimately mean running two distinct Python scripts.
2
7
0
0
i have thousands of servers(linux), some only has python 2.x and some only has python 3.x, i want to write one script check.py can run on all servers just as $./check.py without use $python check.py or $python3 check.py, is there any way to do this? my question is how the script check.py find the Interpreter no matter ...
can one python script run both with python 2.x and python 3.x
1
0
1
0
0
5,143
14,153,954
2013-01-04T08:57:00.000
2
1
0
0
0
python,outlook,smtplib
0
14,154,176
0
1
0
false
0
0
You can send a copy of that email to yourself, with some header that tag the email was sent by yourself, then get another script (using IMAP library maybe) to move the email to the Outlook Sent folder
1
4
0
0
I am using hosted exchange Microsoft Office 365 email and I have a Python script that sends email with smtplib. It is working very well. But there is one issue, how can I get the emails to show up in my Outlook Sent Items?
How can I see emails sent with Python's smtplib in my Outlook Sent Items folder?
0
0.379949
1
0
1
1,550
14,162,140
2013-01-04T17:45:00.000
0
0
1
0
1
python
0
14,162,418
0
1
0
false
0
0
If what you want is a C API version of exec, maybe try PyRun_File and its ilk? Not sure exactly what you're trying to accomplish though.
1
1
0
0
I am trying to set local/globals variables in PyRun_InteractiveLoop call. Cant figure out how to do it, since, unlike exec counterparts, loop doesn't accept global/local args. What am I missing?
PyRun_InteractiveLoop globals/locals
0
0
1
0
0
199
14,177,436
2013-01-05T23:11:00.000
0
0
0
0
1
python-3.x,amazon-web-services,amazon-s3
0
70,791,596
0
2
0
false
1
0
Using AWS CLI, aws s3 ls s3://*bucketname* --region *bucket-region* --no-sign-request
2
3
0
0
Given a bucket with publicly accessible contents, how can I get a listing of all those publicly accessible contents? I know boto can do this, but boto requires AWS credentials. Also, boto doesn't work in Python3, which is what I'm working with.
Get publicly accessible contents of S3 bucket without AWS credentials
0
0
1
0
1
1,214
14,177,436
2013-01-05T23:11:00.000
4
0
0
0
1
python-3.x,amazon-web-services,amazon-s3
0
14,199,730
0
2
0
false
1
0
If the bucket's permissions allow Everyone to list it, you can just do a simple HTTP GET request to http://s3.amazonaws.com/bucketname with no credentials. The response will be XML with everything in it, whether those objects are accessible by Everyone or not. I don't know if boto has an option to make this request wit...
2
3
0
0
Given a bucket with publicly accessible contents, how can I get a listing of all those publicly accessible contents? I know boto can do this, but boto requires AWS credentials. Also, boto doesn't work in Python3, which is what I'm working with.
Get publicly accessible contents of S3 bucket without AWS credentials
0
0.379949
1
0
1
1,214
14,191,034
2013-01-07T06:34:00.000
1
0
0
0
0
python,django
0
14,191,085
0
1
0
true
1
0
What we usually do in our Django projects is create versions of all configuration files for each platform (dev, prod, etc...) and use symlinks to select the correct one. Now that Windows supports links properly, this solution fits everybody. If you insist on another configuration file, try making it a Python file that ...
1
0
0
0
I'm building project with Django, I can make two setting files for Django: production_setting.py and development_setting.py, however, I need some configure file for my project and I'm using ConfigParser to parse that files. e.g. [Section] name = "development" version = "1.0" how to split this configure file to produc...
python project setting for production and developement
0
1.2
1
0
0
150
14,191,462
2013-01-07T07:12:00.000
0
0
0
0
0
python,python-2.7
0
14,193,534
0
1
0
false
0
1
The question is vague, but I guess you should use c_char_p instead of POINTER(c_char).
1
0
0
0
I call foreign c library in my program using ctypes, I don't know how to assign a POINTER(c_char) variant to a string.
How can I assign a variant of POINTER(c_char) type to a string?
0
0
1
0
0
149
14,201,551
2013-01-07T18:08:00.000
3
0
0
1
0
python,linux,alsa,udev,soundcard
0
14,203,491
1
2
0
false
0
0
The sound card limit is defined as the symbol SNDRV_CARDS in include/sound/core.h. When I increased this seven years ago, I did not go beyond 32 because the card index is used as a bit index for the variable snd_cards_lock in sound/core/init.c, and I did not want to change more than necessary. If you make snd_cards_loc...
1
6
0
0
I'm working on an educative multiseat project where we need to connect 36 keyboards and 36 USB sound cards to a single computer. We're running Ubuntu Linux 12.04 with the 3.6.3-030603-generic kernel. So far we've managed to get the input from the 36 keyboards, and recognized the 36 sound cards without getting a kernel ...
Need more than 32 USB sound cards on my system
0
0.291313
1
0
0
1,112
14,242,764
2013-01-09T17:18:00.000
0
0
1
0
1
python,numpy,scipy,python-module
0
14,242,912
0
1
0
false
0
0
Use the --user option to easy_install or setup.py to indicate where the installation is to take place. It should point to a directory where you have write access. Once the module has been built and installed, you then need to set the environmental variable PYTHONPATH to point to that location. When you next run the pyt...
1
1
1
0
I am totally new to Python, and I have to use some modules in my code, like numpy and scipy, but I have no permission on my hosting to install new modules using easy-install or pip ( and of course I don't know how to install new modules in a directory where I have permission [ I have SSH access ] ). I have downloaded n...
use / load new python module without installation
0
0
1
0
0
1,476
14,244,195
2013-01-09T18:41:00.000
1
0
0
0
0
python,slider,wxpython,color-mapping
0
14,260,324
0
1
0
true
0
1
I think you're looking for one of the following widgets: ColourDialog, ColourSelect, PyColourChooser or CubeColourDialog They all let you choose colors in different ways and they have a slider to help adjust the colours too. You can see each of them in action in the wxPython demo (downloadable from the wxPython web pag...
1
0
0
0
I haven't seen an example of this but I wanted to know if any knows how to implement a colorbar with an adjustable slider using wxpython. Basically the slider should change the levels of the colorbar and as such adjust the colormap. If anyone has an idea of how to do and possible some example code it would be much app...
colorbar with a slider using wxpython
0
1.2
1
0
0
386
14,254,203
2013-01-10T09:08:00.000
15
0
0
0
0
python,machine-learning,data-mining,classification,scikit-learn
0
34,036,255
0
6
0
false
0
0
The simple answer: multiply result!! it's the same. Naive Bayes based on applying Bayes’ theorem with the “naive” assumption of independence between every pair of features - meaning you calculate the Bayes probability dependent on a specific feature without holding the others - which means that the algorithm multiply e...
3
76
1
0
I'm using scikit-learn in Python to develop a classification algorithm to predict the gender of certain customers. Amongst others, I want to use the Naive Bayes classifier but my problem is that I have a mix of categorical data (ex: "Registered online", "Accepts email notifications" etc) and continuous data (ex: "Age",...
Mixing categorial and continuous data in Naive Bayes classifier using scikit-learn
0
1
1
0
0
29,596
14,254,203
2013-01-10T09:08:00.000
0
0
0
0
0
python,machine-learning,data-mining,classification,scikit-learn
0
69,929,209
0
6
0
false
0
0
You will need the following steps: Calculate the probability from the categorical variables (using predict_proba method from BernoulliNB) Calculate the probability from the continuous variables (using predict_proba method from GaussianNB) Multiply 1. and 2. AND Divide by the prior (either from BernoulliNB or from Gaus...
3
76
1
0
I'm using scikit-learn in Python to develop a classification algorithm to predict the gender of certain customers. Amongst others, I want to use the Naive Bayes classifier but my problem is that I have a mix of categorical data (ex: "Registered online", "Accepts email notifications" etc) and continuous data (ex: "Age",...
Mixing categorial and continuous data in Naive Bayes classifier using scikit-learn
0
0
1
0
0
29,596
14,254,203
2013-01-10T09:08:00.000
74
0
0
0
0
python,machine-learning,data-mining,classification,scikit-learn
0
14,255,284
0
6
0
true
0
0
You have at least two options: Transform all your data into a categorical representation by computing percentiles for each continuous variables and then binning the continuous variables using the percentiles as bin boundaries. For instance for the height of a person create the following bins: "very small", "small", "r...
3
76
1
0
I'm using scikit-learn in Python to develop a classification algorithm to predict the gender of certain customers. Amongst others, I want to use the Naive Bayes classifier but my problem is that I have a mix of categorical data (ex: "Registered online", "Accepts email notifications" etc) and continuous data (ex: "Age",...
Mixing categorial and continuous data in Naive Bayes classifier using scikit-learn
0
1.2
1
0
0
29,596
14,255,289
2013-01-10T10:08:00.000
2
0
0
1
0
python,python-2.7,twisted,failover
0
14,266,178
0
2
0
false
0
0
ReconnectingClientFactory doesn't have this capability. You can build your own factory which implements this kind of reconnection logic, mostly by hooking into the clientConnectionFailed factory method. When this is called and the reason seems to you like that justifies switching servers (eg, twisted.internet.error.C...
1
4
0
0
I have a twisted ReconnectingClientFactory and i can successfully connect to given ip and port couple with this factory. And it works well. reactor.connectTCP(ip, port, myHandsomeReconnectingClientFactory) In this situation, when the server is gone, myHandsomeReconnectingClientFactory tries to connect same ip and por...
Twisted: ReconnectingClientFactory connection to different servers
0
0.197375
1
0
0
1,504