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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8,590,468 | 2011-12-21T13:21:00.000 | 4 | 0 | 0 | 0 | python,django,model-view-controller | 8,591,009 | 3 | false | 1 | 0 | It depends of what your application is about, but the beauty of Django is that it does not enforce you to put your logical code in your views or in your models, this is your call.
If you think that some logic is strongly related to your model then you can make a method of it. The rule (for me) is that your model should... | 1 | 19 | 0 | This is a general architecture question. I read in many places that in an MVC framework, (1) models ought to be fat, and controllers ought to be skinny. But I also read that (2) the details depend on the framework you're developing in. So, what if you're developing in django?
My experience with django is that a lot ... | django: Fat models and skinny controllers? | 0.26052 | 0 | 0 | 9,951 |
8,590,714 | 2011-12-21T13:41:00.000 | 1 | 1 | 1 | 0 | python,python-imaging-library | 8,591,901 | 2 | true | 0 | 1 | What would I try:
Remove old PIL and install new it from scratch (maybe it did not override properly).
If you missed something when compiling the libjpeg, like path specifications it will not find some of the libraries, so I recomend trying MacPorts py27-pil port for PIL installation, which will place all dependancies... | 1 | 0 | 0 | I wanted to recompile PIL after having installed libjpeg because it threw the decoder jpeg not available whenever I tried importing JPEG images.
So, I've downloaded libjpeg, compiled it and installed it. Then I removed the ./build folder from PIL's source cache, and recompiled it (using sudo python setup.py install).
... | Can't get PIL to work on Mac OS X | 1.2 | 0 | 0 | 672 |
8,591,602 | 2011-12-21T14:43:00.000 | 0 | 1 | 0 | 0 | python,web | 8,592,171 | 1 | true | 1 | 0 | You can get a virtual server instance on amazon or rackspace or many others for a very small fee per month, $20 - $60. This will give you a clean install of the OS of your choice. No need to invest in hardware. From there you can follow any of the many many tutorials on deploying a django app. | 1 | 0 | 0 | hi every one I was wondering how to go about deploying a small time python database web application. Is buying some cheap hardware and installing a server good on it a good route to go? | deploying a python web application | 1.2 | 0 | 0 | 215 |
8,591,910 | 2011-12-21T15:04:00.000 | 0 | 0 | 0 | 0 | python,django | 8,591,934 | 3 | false | 1 | 0 | Database file (sqlite3) is meant for development purposes. For any application with reasonable traffic you should choose mysql or postgres | 1 | 0 | 0 | I would like to start a project in django.My doubt is that ,since django is using a single database file. Is that feasible?
Actually planned to create a 'wiki' like application that stores articles in a database.
Using a single database file ??? Will it be? | Using a single database file in django is feasible? | 0 | 0 | 0 | 89 |
8,592,048 | 2011-12-21T15:15:00.000 | 8 | 0 | 0 | 0 | python,math,statistics,poisson | 8,592,302 | 2 | true | 0 | 0 | On a strict reading of your question, yes, that is what random.expovariate does.
expovariate gives you random floating point numbers, exponentially distributed. In a Poisson process the size of the interval between consecutive events is exponential.
However, there are two other ways I could imagine modelling poiss... | 1 | 5 | 1 | I read somewhere that the python library function random.expovariate produces intervals equivalent to Poisson Process events.
Is that really the case or should I impose some other function on the results? | Is random.expovariate equivalent to a Poisson Process | 1.2 | 0 | 0 | 12,528 |
8,593,091 | 2011-12-21T16:30:00.000 | 0 | 0 | 0 | 0 | python,image-processing,opencv,computer-vision,skin | 25,213,056 | 6 | false | 0 | 0 | Well my experience with the skin modeling are bad, because:
1) lightning can vary - skin segmentation is not robust
2) it will mark your face also (as other skin-like objects)
I would use machine learning techniques like Haar training, which, in my opinion, if far more better approach than modeling and fixing some cons... | 1 | 22 | 1 | I am currently working on a system for robust hand detection.
The first step is to take a photo of the hand (in HSV color space) with the hand placed in a small rectangle to determine the skin color. I then apply a thresholding filter to set all non-skin pixels to black and all skin pixels white.
So far it works quite... | Robust Hand Detection via Computer Vision | 0 | 0 | 0 | 11,923 |
8,597,543 | 2011-12-21T23:02:00.000 | 2 | 0 | 1 | 0 | python,import,tkinter | 8,598,161 | 1 | true | 0 | 1 | No, there is no way to import only one method of a widget, or only one method of any class. When you import a class you get the whole class.
Why do you think it would be advantageous to import only one method? If you're concerned about memory consumption, don't be. | 1 | 0 | 0 | I am writing a python application using tkinter. One of my classes only uses the delete method on an Entry widget object. I wanted to know if there was a way to only import that method instead of importing the entire package.
I have tried looking around online and have tried different things, but I have not had much lu... | How to import only one Tkinter widget method instead of a whole package? | 1.2 | 0 | 0 | 106 |
8,597,906 | 2011-12-21T23:56:00.000 | 1 | 0 | 0 | 1 | python,shell,operating-system | 8,597,964 | 2 | true | 0 | 0 | Is the script, by any chance, launched by that same tool? If yes, you need to run os.setsid() to stop being dependent on it. | 1 | 0 | 0 | I am running a shell command from within my python script using
os.system("some shell command")
This command essentially terminates a tool.
I need to check that this tool is terminated in my script.
But as soon as the tool is terminated the script is terminated too! | python script exits when a shell command(to terminate a different tool) is run from os.system() | 1.2 | 0 | 0 | 156 |
8,599,317 | 2011-12-22T04:06:00.000 | 1 | 0 | 1 | 0 | python | 8,599,340 | 4 | false | 0 | 0 | since they are just 200M, allocate enough memory, read them, sort the lines in ascending order for each, then iterate through both collections of lines in parallel like in a merge operation and delete those that only occur in one set.
preserve line numbers in the collections and sort them by line number after the above... | 1 | 0 | 0 | I'd like to compare two large text files(200M) to get the same lines of them.
How to do that in Python? | How to find same lines in two large text files? | 0.049958 | 0 | 0 | 1,021 |
8,599,703 | 2011-12-22T05:17:00.000 | 1 | 1 | 1 | 0 | ios,settings,python-idle,auto-lock | 8,608,563 | 1 | false | 0 | 0 | Actually, just found out from apple...there is no public API for this. | 1 | 2 | 0 | I just want to find out what the user has set for the timeout period for autolock, which is in Settings->General->Auto-Lock in iOS. How can I find this?
Thanks, | can we access the autolock setting that the user has set in iOS? | 0.197375 | 0 | 0 | 592 |
8,600,796 | 2011-12-22T07:47:00.000 | 1 | 0 | 1 | 0 | python,p2p | 8,603,939 | 2 | true | 0 | 0 | You could write the library yourself, if you're willing to work with sockets directly. Have each node contain a list of peers that is regularly updated, and set each node to advertise its presence to a central server. You'd need to look into network traversal algorithms, hash tables, etc but it could be done. As Xavier... | 2 | 0 | 0 | I am new to Python programming and have covered sockets a bit. I couldn't find any simple implementation on the web. Its basic functionality should cover:
simple chat
file sharing
peer lookup
How do I start, and what should be the p2p model? I don't want to use any library such as Twisted, as it is complex. | How to build a Python p2p application? | 1.2 | 0 | 1 | 2,394 |
8,600,796 | 2011-12-22T07:47:00.000 | 0 | 0 | 1 | 0 | python,p2p | 8,601,303 | 2 | false | 0 | 0 | for the peer lookup I would begin with a simple central server and for simple chat and file sharing I would use a derivate of HTTP protocol. | 2 | 0 | 0 | I am new to Python programming and have covered sockets a bit. I couldn't find any simple implementation on the web. Its basic functionality should cover:
simple chat
file sharing
peer lookup
How do I start, and what should be the p2p model? I don't want to use any library such as Twisted, as it is complex. | How to build a Python p2p application? | 0 | 0 | 1 | 2,394 |
8,604,672 | 2011-12-22T13:37:00.000 | 1 | 0 | 1 | 0 | java,php,python,html | 8,606,256 | 5 | false | 0 | 0 | Taking account the limitation of google api that is possible. I think the best tool for it is python. | 1 | 0 | 0 | This is a general question, and I don't expect any specific solution here. I'm just very curious about the approach.
Let us say I have txt-file with many keywords. There are so many keywords that I can't make a seperate google-search for each one of them. That would take too long time. My goal is to make a program whi... | Make program running a web site for different inputs | 0.039979 | 0 | 0 | 107 |
8,608,843 | 2011-12-22T19:33:00.000 | 1 | 0 | 0 | 0 | python,facebook,facebook-fql | 8,610,628 | 1 | false | 0 | 0 | Without each of those friends giving you access to view who their friends are, it's impossible. If Facebook allowed this to happen without a friend granting you that access, then I'm going go scream from the hills about a HUGE security hole. | 1 | 0 | 0 | Given an id of any facebook group, using FQL I can fetch all the members of that group, if I am a member of that group. I can also see who of my friends is in the same group as me, that is also not a problem. Now, I need to see of all of the group members, who of them is friends, I mean, if there are 2 group members in... | How to see mutual friendships in a facebook group? | 0.197375 | 0 | 1 | 4,952 |
8,609,737 | 2011-12-22T21:08:00.000 | 0 | 0 | 0 | 0 | python,database,diff,set,compare | 8,609,909 | 3 | false | 0 | 0 | You could load the data into a database, and compare the databases. If you think that is easier.
The key question you might need to think about is: can you sort the data somehow?
Sorted sets are so much easier to handle.
P.S. 75000 lines is not very much. Anything that fits into main memory of a regular computer is not... | 1 | 2 | 0 | I have to compare massive database dumps in xls format to parse for changes day-to-day (gross, right?). I'm currently doing this in the most backwards way possible, and using xlrd to turn the xls into csv files, and then I'm running diffs to compare them.
Since it's a database, and I don't have a means of knowing if th... | Python comparing two massive sets of data in the MOST efficient method possible | 0 | 1 | 0 | 19,719 |
8,611,290 | 2011-12-23T01:09:00.000 | 0 | 0 | 0 | 0 | python,x11,xlib,clutter | 8,623,734 | 2 | false | 0 | 1 | by the way input delivery works on X11, this cannot happen: an X11 window has to have focus in order to receive input events - in other words: events are delivered only to the focused window.
the input method and accessibility support in GTK+, for instance, relies on the toolkit sending and receiving data to and from a... | 1 | 1 | 0 | I am writing an Onscreen Keyboard in python, with clutter. I've gotten the ClutterStage's XWindow object, but I can't find any properties which prevent the window from stealing focus. Basically, it needs to accept mouse events (click, motion, etc), while not stealing keyboard focus from the window it is trying to type ... | What XWindow property can prevent a window from getting focus, while letting it receive mouse events? | 0 | 0 | 0 | 1,660 |
8,611,681 | 2011-12-23T02:30:00.000 | 1 | 0 | 1 | 0 | python | 8,611,692 | 4 | false | 0 | 0 | You probably should learn Python 3, unless you're planning to work on a significant 2.x codebase anytime soon.
2.x and 3.x aren't actually all that different. It's quite possible to use a common subset for most things. EG, I just wrote a 4000 line deduplicating backup system that runs on 2.x and 3.x. | 2 | 1 | 0 | I already bought a good book on Python 2.5. Should I return it and get a book on 3.1 instead? that I know this question has already been asked, but I wanted a more up-to-date answer. | Learn Python 2 or 3? | 0.049958 | 0 | 0 | 1,789 |
8,611,681 | 2011-12-23T02:30:00.000 | 1 | 0 | 1 | 0 | python | 8,611,987 | 4 | false | 0 | 0 | For the time being 2.x and 3.x will live side by side. So you should learn "both". BUT actualy they are so similar, that you will learn the differences as you tag along. Keep your book, you won't learn something wrong, which you would have to relearn later.
Actualy it may be better, NOT to start with 3.x, becuase you m... | 2 | 1 | 0 | I already bought a good book on Python 2.5. Should I return it and get a book on 3.1 instead? that I know this question has already been asked, but I wanted a more up-to-date answer. | Learn Python 2 or 3? | 0.049958 | 0 | 0 | 1,789 |
8,613,246 | 2011-12-23T07:11:00.000 | 2 | 0 | 0 | 0 | android,python,web-services,postgresql,ubuntu-10.04 | 8,613,304 | 1 | false | 0 | 0 | Better way is to Use RestFUL API or WebService as front end for your Android device to connect to your PostgreSQL backend. I am not sure if it is possible to directly connect your android device to postgre SQL. | 1 | 0 | 0 | I am using postgresql in ubuntu, and now i am working on python. I want to connect postgresql with an android application. Is there any way to connect postgresql with an android application?
Any reply would be appreciated. | what is the way to connect postgresql with android in ubuntu | 0.379949 | 1 | 0 | 377 |
8,613,440 | 2011-12-23T07:40:00.000 | 0 | 0 | 0 | 0 | javascript,python,selenium,automated-tests | 8,613,669 | 1 | false | 1 | 0 | You can use the -firefoxProfileTemplate command line option when starting the Selenium server. But it seems rather counterproductive to disable javascript when testing how browsers behave on your site (unless your site doesn't have any scripts of its own) - you should rather use adblock, or disable the IP used by Googl... | 1 | 1 | 0 | I heard one can load a custom Firefox profile when starting webdriver, but I've yet to find a way to do that. The Python binding documentation doesn't state it very clearly.
I need to start up Firefox without JS because the site I'm testing has a lot of ads injected by Google and some are very slow to load, making the ... | How to load Firefox with javascript disable when running Selenium Webdriver (Python) tests? | 0 | 0 | 1 | 1,288 |
8,616,487 | 2011-12-23T13:10:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine,variables,global | 8,617,102 | 4 | false | 1 | 0 | Interesting question. Some bad news first, I don't think there's a better way of storing data; no, you won't be able to stop new instances from spawning and no, you cannot make seperate instances always have the same data.
What you could do is have the instances perioidically sync themselves with a master record in th... | 3 | 2 | 0 | Our situation is as follows:
We are working on a schoolproject where the intention is that multiple teams walk around in a city with smarthphones and play a city game while walking.
As such, we can have 10 active smarthpones walking around in the city, all posting their location, and requesting data from the google app... | How to keep global variables persistent over multiple google appengine instances? | 0 | 0 | 0 | 2,158 |
8,616,487 | 2011-12-23T13:10:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine,variables,global | 8,617,199 | 4 | false | 1 | 0 | Consider jabber protocol for communication between peers. Free limits are on quite high level for it. | 3 | 2 | 0 | Our situation is as follows:
We are working on a schoolproject where the intention is that multiple teams walk around in a city with smarthphones and play a city game while walking.
As such, we can have 10 active smarthpones walking around in the city, all posting their location, and requesting data from the google app... | How to keep global variables persistent over multiple google appengine instances? | 0 | 0 | 0 | 2,158 |
8,616,487 | 2011-12-23T13:10:00.000 | 3 | 0 | 0 | 1 | python,google-app-engine,variables,global | 8,624,587 | 4 | true | 1 | 0 | You should be using memcache. If you use the ndb (new database) library, you can automatically cache the results of queries. Obviously this won't improve your writes much, but it should significantly improve the numbers of reads you can do.
You need to back it with the datastore as data can be ejected from memcache at ... | 3 | 2 | 0 | Our situation is as follows:
We are working on a schoolproject where the intention is that multiple teams walk around in a city with smarthphones and play a city game while walking.
As such, we can have 10 active smarthpones walking around in the city, all posting their location, and requesting data from the google app... | How to keep global variables persistent over multiple google appengine instances? | 1.2 | 0 | 0 | 2,158 |
8,617,053 | 2011-12-23T14:13:00.000 | 1 | 0 | 1 | 0 | python-3.x | 8,617,444 | 1 | false | 0 | 0 | Make a module. Use a versioning control system. That's it really. Otherwise best practices are the same no matter how many files you have. | 1 | 1 | 0 | I am slowly starting a project that will be using multiple source files and I'm wondering what are some good practices whilst doing that. Any tips and/or tricks would be appreciated! | Python 3: Any tips on coding with multiple source files? | 0.197375 | 0 | 0 | 131 |
8,617,208 | 2011-12-23T14:31:00.000 | 2 | 1 | 0 | 1 | android,python,git,repository | 8,617,691 | 1 | false | 0 | 0 | It seems to me that you should add python to your path variable. | 1 | 1 | 0 | It gives me the error on line 23 of the repo file:
exec: python: not found.
the thing is, I have python installed in C:\Python27 (the default)
I'm using the Git Bash when typing in these commands. I've tried to move the python folder into the git directory to run the repo file and it still says the same thing.
I've ... | "Error: Python not found" when trying to access the android repository | 0.379949 | 0 | 0 | 593 |
8,617,837 | 2011-12-23T15:40:00.000 | 1 | 0 | 0 | 0 | python,sql,sqlite | 8,617,856 | 1 | true | 0 | 0 | The DB fetch models return a tuple for each row. Since you've only selected a single field, you can simply access namer[0] to get the actual value. | 1 | 0 | 0 | I'm writing a script where by a user registers his/her username, but a function checks whether this username is already in the db or not. But I'm stuck on how to match my query with the input. Here is the code:
def checker(self, insane):
t = (insane,) ... | Matching user's input with query from sqlite3 db in python | 1.2 | 1 | 0 | 1,309 |
8,621,527 | 2011-12-23T23:25:00.000 | 2 | 0 | 0 | 1 | python,windows,google-app-engine | 13,126,746 | 8 | false | 1 | 0 | I was facing the same issue, browse button was disabled. I ran dev_appserver.py helloworld command at command prompt and then opened localhost:8080 in my browser the hello world program ran successfully. | 6 | 9 | 0 | I have installed Python 2.7.2 (Win7 32-bit) and Google App Engine SDK 1.6.1 for Win7 on a 64-bit system running Win7 Home Premium. Default folder locations for both Python and GAE. When I try to run the helloworld project as described in the Google Python Getting Started doc, the Launcher's "browse" button never beco... | Python 2.7.2 and Google App Engine SDK 1.6.1 on Win 7 Home Premium not working | 0.049958 | 0 | 0 | 2,601 |
8,621,527 | 2011-12-23T23:25:00.000 | 0 | 0 | 0 | 1 | python,windows,google-app-engine | 8,622,105 | 8 | false | 1 | 0 | Do you see anything in the GAE SDK logs?
Which browser are you using? What is your default browser?
The default security settings in IE require you to enable intranet access.
I recently had to rebuild my Win7 dev box. Chrome was my default browser. When I installed GAE SDK v1.6.1 I had a similar problem to what you d... | 6 | 9 | 0 | I have installed Python 2.7.2 (Win7 32-bit) and Google App Engine SDK 1.6.1 for Win7 on a 64-bit system running Win7 Home Premium. Default folder locations for both Python and GAE. When I try to run the helloworld project as described in the Google Python Getting Started doc, the Launcher's "browse" button never beco... | Python 2.7.2 and Google App Engine SDK 1.6.1 on Win 7 Home Premium not working | 0 | 0 | 0 | 2,601 |
8,621,527 | 2011-12-23T23:25:00.000 | 0 | 0 | 0 | 1 | python,windows,google-app-engine | 11,284,009 | 8 | false | 1 | 0 | I am quite sure that is because you had changed the encode from ANSI to another type (such as UTF-8) on app.yaml,
change it back to ANSI, then you can run the project on google app engine launcher.
BTW, the helloworld tutorial on google has no problem. | 6 | 9 | 0 | I have installed Python 2.7.2 (Win7 32-bit) and Google App Engine SDK 1.6.1 for Win7 on a 64-bit system running Win7 Home Premium. Default folder locations for both Python and GAE. When I try to run the helloworld project as described in the Google Python Getting Started doc, the Launcher's "browse" button never beco... | Python 2.7.2 and Google App Engine SDK 1.6.1 on Win 7 Home Premium not working | 0 | 0 | 0 | 2,601 |
8,621,527 | 2011-12-23T23:25:00.000 | 0 | 0 | 0 | 1 | python,windows,google-app-engine | 17,632,351 | 8 | false | 1 | 0 | I had a similar issue; it turned out my problem was not due to environment variables.
Debugging GAE:
First off let me say that if you are having problems with GAE, I would strongly recommend launching using the CLI, google_appengine/dev_appserver.py. There is a large stack trace of the reason GAE is failing (instead o... | 6 | 9 | 0 | I have installed Python 2.7.2 (Win7 32-bit) and Google App Engine SDK 1.6.1 for Win7 on a 64-bit system running Win7 Home Premium. Default folder locations for both Python and GAE. When I try to run the helloworld project as described in the Google Python Getting Started doc, the Launcher's "browse" button never beco... | Python 2.7.2 and Google App Engine SDK 1.6.1 on Win 7 Home Premium not working | 0 | 0 | 0 | 2,601 |
8,621,527 | 2011-12-23T23:25:00.000 | 2 | 0 | 0 | 1 | python,windows,google-app-engine | 31,930,984 | 8 | false | 1 | 0 | I compared the helloworld example to the guestbook demo and found that the application element was key. I added the line at the top of the app.yaml file "application: helloworld" and the helloworld example started working in the Google App Engine (GAE). Note that the 'application' element is supposed to be optional a... | 6 | 9 | 0 | I have installed Python 2.7.2 (Win7 32-bit) and Google App Engine SDK 1.6.1 for Win7 on a 64-bit system running Win7 Home Premium. Default folder locations for both Python and GAE. When I try to run the helloworld project as described in the Google Python Getting Started doc, the Launcher's "browse" button never beco... | Python 2.7.2 and Google App Engine SDK 1.6.1 on Win 7 Home Premium not working | 0.049958 | 0 | 0 | 2,601 |
8,621,527 | 2011-12-23T23:25:00.000 | 0 | 0 | 0 | 1 | python,windows,google-app-engine | 31,988,393 | 8 | false | 1 | 0 | I did two changes together -
1. added the line at the top of app.yaml file "application:helloworld"
2. changed the last line in app.yaml "script: helloworld.app" to "script: helloworld.py"
my GAE started working. However to islolate the issue I 'undid' both changes, it turns out that the the 2nd change - changing hello... | 6 | 9 | 0 | I have installed Python 2.7.2 (Win7 32-bit) and Google App Engine SDK 1.6.1 for Win7 on a 64-bit system running Win7 Home Premium. Default folder locations for both Python and GAE. When I try to run the helloworld project as described in the Google Python Getting Started doc, the Launcher's "browse" button never beco... | Python 2.7.2 and Google App Engine SDK 1.6.1 on Win 7 Home Premium not working | 0 | 0 | 0 | 2,601 |
8,622,667 | 2011-12-24T00:32:00.000 | 1 | 0 | 0 | 0 | python,hardware,graphics | 18,431,135 | 3 | false | 0 | 1 | This is rather an old thread now, but I stumbled upon it while musing the same question.
I used to program in assembly language. In my day, drawing on screen was simply(?) a matter of poking a value into a memory location. The value turned a pixel on or off and defined its colour.
The term 'poke' comes from Basic by t... | 2 | 11 | 0 | I want to learn about graphical libraries by myself and toy with them a bit. I built a small program that defines lines and shapes as lists of pixels, but I cannot find a way to access the screen directly so that I can display the points on the screen without any intermediate.
What I mean is that I do not want to use a... | Is there a way to access hardware directly in Python? | 0.066568 | 0 | 0 | 4,998 |
8,622,667 | 2011-12-24T00:32:00.000 | 7 | 0 | 0 | 0 | python,hardware,graphics | 8,622,706 | 3 | false | 0 | 1 | No, Python isn't the best choice for this type of raw hardware access to the video card. I would recommend writing C in DOS. Well, actually, I don't recommend it. It's a horrible thing to do. But, it's how I learned to do it, and it's probably about as friendly as you are going to get for accessing hardware directl... | 2 | 11 | 0 | I want to learn about graphical libraries by myself and toy with them a bit. I built a small program that defines lines and shapes as lists of pixels, but I cannot find a way to access the screen directly so that I can display the points on the screen without any intermediate.
What I mean is that I do not want to use a... | Is there a way to access hardware directly in Python? | 1 | 0 | 0 | 4,998 |
8,625,351 | 2011-12-24T15:28:00.000 | 1 | 0 | 1 | 0 | python,list | 8,625,383 | 13 | false | 0 | 0 | You're going to need a loop.
Unlike Python strings which support a subsequence test using the in operator, Python lists do not have a builtin subsequence test. | 3 | 7 | 0 | Say I have a list v = [1, 2, 3, 4, 3, 1, 2]. I want to write a function, find_pair which will check if two numbers are in the list and adjacent to each other. So, find_pair(v, 2, 3) should return True, but find_pair(v, 1, 4) should return False.
Is it possible to implement find_pair without a loop? | Check if two items are in a list, in a particular order? | 0.015383 | 0 | 0 | 13,432 |
8,625,351 | 2011-12-24T15:28:00.000 | 2 | 0 | 1 | 0 | python,list | 8,625,377 | 13 | false | 0 | 0 | In general it is impossible without iterating over all the values. After all, a list of a thousand elements may end in [.., 2, 3].
In special cases, there are shortcuts. Are the values always ordered and are you always looking for a specific value? If so, you can e.g. use a binary search to find the value and then comp... | 3 | 7 | 0 | Say I have a list v = [1, 2, 3, 4, 3, 1, 2]. I want to write a function, find_pair which will check if two numbers are in the list and adjacent to each other. So, find_pair(v, 2, 3) should return True, but find_pair(v, 1, 4) should return False.
Is it possible to implement find_pair without a loop? | Check if two items are in a list, in a particular order? | 0.03076 | 0 | 0 | 13,432 |
8,625,351 | 2011-12-24T15:28:00.000 | 0 | 0 | 1 | 0 | python,list | 8,625,388 | 13 | false | 0 | 0 | If writing the list happens far less often than reading from it, perhaps you could build a tree of prefixes upon write. [1] would have a child node [2], [2] would have a [3], and [3] a [4]. With a more complex data set, the tree would be more useful. It would have a depth of 2 in your case and would be indexed on th... | 3 | 7 | 0 | Say I have a list v = [1, 2, 3, 4, 3, 1, 2]. I want to write a function, find_pair which will check if two numbers are in the list and adjacent to each other. So, find_pair(v, 2, 3) should return True, but find_pair(v, 1, 4) should return False.
Is it possible to implement find_pair without a loop? | Check if two items are in a list, in a particular order? | 0 | 0 | 0 | 13,432 |
8,626,157 | 2011-12-24T18:20:00.000 | 1 | 0 | 1 | 0 | python,multiprocessing | 8,718,536 | 2 | false | 0 | 0 | multiprocessing.Manager is essentially a specialised process that will create instances of multiprocessing's synchronisation primitives on demand in its own address space, and let you access them through RPC proxies. The primitives behave the same, and they have the added flexibility of being accessible from remote hos... | 2 | 16 | 0 | What is difference between multiprocessing.Event and multiprocessing.managers.SyncManager.Event. When do I use each? Why two different objects exist?
Same question for other similar objects existing in multiprocessing directly and also in Manager (Lock, etc.) | python: multiprocessing Event | 0.099668 | 0 | 0 | 3,893 |
8,626,157 | 2011-12-24T18:20:00.000 | 13 | 0 | 1 | 0 | python,multiprocessing | 8,687,095 | 2 | true | 0 | 0 | Unfortunately, the only given answer is not very correct and others wasn't given.
I looked it up my own, and found that multiprocessing.Event can be used to synch between processes, it's completely alright.
Event and other objects from multiprocessing.Manager exist to be able to synchronize things between processes tha... | 2 | 16 | 0 | What is difference between multiprocessing.Event and multiprocessing.managers.SyncManager.Event. When do I use each? Why two different objects exist?
Same question for other similar objects existing in multiprocessing directly and also in Manager (Lock, etc.) | python: multiprocessing Event | 1.2 | 0 | 0 | 3,893 |
8,626,180 | 2011-12-24T18:25:00.000 | 1 | 0 | 0 | 1 | python,cocos2d-python | 10,575,373 | 1 | true | 0 | 1 | You could fix it.
The problem comes from the fact that cocos2D is built on top of Pyglet, and the stable release of pyglet does not yet support Mac OS X 64 bits architecture. You have to use the 1.2 release of pyglet or later, which by now is not released yet.
A workaround is to remove any existing Pyglet install:
pip ... | 1 | 0 | 0 | I installed cocos2d today on OS X Lion, but whenever I try to import cocos in the Python interpreter, I get a bunch of import errors.
File "", line 1, in File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/
python2.7/site-packages/cocos2d-0.5.0-py2.7.egg/cocos/init.py",
line 105, in
import_... | Removing cocos2d-python from Mac | 1.2 | 0 | 0 | 559 |
8,627,414 | 2011-12-24T23:22:00.000 | 3 | 1 | 1 | 0 | python,function,module | 8,627,435 | 4 | false | 0 | 0 | You've figured it out - you have to set signal_power's value before using it. As to what you have to set it to - it's not really a Python related question, but 1 is always a safe choice :) While you are at it, don't forget to define noise_power. | 1 | 0 | 0 | I'm stucked on the chapter 3.3 "Math functions" of "Think Python".
It tells me to import math (through the interpreter).
Then print math and that I should get something like this:
<module 'math' from '/usr/lib/python2.5/lib-dynload/math.so'>
Instead I get <module 'math' <built-in>>
Anyway that's not the problem. Though... | Python's math module & "Think Python" | 0.148885 | 0 | 0 | 529 |
8,628,940 | 2011-12-25T09:05:00.000 | 0 | 0 | 0 | 0 | gearman,task-management,python-gearman | 8,943,378 | 2 | false | 0 | 0 | Gearman jobs can run in parallel or series. Instead of using single jobs, you should use concurrent jobs (one for each server). | 1 | 1 | 0 | I'm using gearman for synchronizing data on different servers. We have 1 main server and, for example, 10 local servers. Let me describe one of possible situations. Say, gearman started working, and 5 jobs are done, data on that 5 servers is synced. When doing the next job is started, say, we lost the connection with s... | How to delay/postpone Gearman job? | 0 | 0 | 0 | 903 |
8,630,305 | 2011-12-25T15:49:00.000 | 1 | 0 | 1 | 1 | python,rvm,virtualenv | 8,662,790 | 1 | false | 1 | 0 | One work around is to use "sudo -E". This will preserve the calling user's environment across the sudo. Note that if the adversary controls your environment this is an immediate root exploit (via LD_LIBRARY_PATH and similar). | 1 | 0 | 0 | As anyone who knows what virtualenv does for python there is an analog for ruby. What's interesting about the ruby installation is that there is a "rvmsudo" that projects the current rvm environment on the root/sudo user before executing the requested command.
virtualenv does not offer an obvious implementation of the ... | rvmsudo analog for python/virtualenv | 0.197375 | 0 | 0 | 191 |
8,630,573 | 2011-12-25T17:08:00.000 | 1 | 0 | 0 | 1 | python,terminal,pausing-execution | 8,630,607 | 6 | false | 0 | 0 | As others have commented, unless you are running your script in a virtual machine that can be suspended, you would need to modify your script to track its state. | 4 | 3 | 0 | I have a web crawling python script running in terminal for several hours, which is continuously populating my database. It has several nested for loops. For some reasons I need to restart my computer and continue my script from exactly the place where I left. Is it possible to preserve the pointer state and resume the... | How to pause a python script running in terminal | 0.033321 | 0 | 0 | 9,002 |
8,630,573 | 2011-12-25T17:08:00.000 | 0 | 0 | 0 | 1 | python,terminal,pausing-execution | 8,630,611 | 6 | false | 0 | 0 | If this problem is important enough to warrant this kind of financial investment, you could run the script on a virtual machine. When you need to shut down, suspend the virtual machine, and then shut down the computer. When you want to start again, start the computer, and then wake up your virtual machine. | 4 | 3 | 0 | I have a web crawling python script running in terminal for several hours, which is continuously populating my database. It has several nested for loops. For some reasons I need to restart my computer and continue my script from exactly the place where I left. Is it possible to preserve the pointer state and resume the... | How to pause a python script running in terminal | 0 | 0 | 0 | 9,002 |
8,630,573 | 2011-12-25T17:08:00.000 | 4 | 0 | 0 | 1 | python,terminal,pausing-execution | 8,630,649 | 6 | true | 0 | 0 | You might try suspending your computer or running in a virtual machine which you can subsequently suspend. But as your script is working with network connections chances are your script won't work from the point you left once you bring up the system. Suspending a computer and restoring it or saving a Virtual M/C and re... | 4 | 3 | 0 | I have a web crawling python script running in terminal for several hours, which is continuously populating my database. It has several nested for loops. For some reasons I need to restart my computer and continue my script from exactly the place where I left. Is it possible to preserve the pointer state and resume the... | How to pause a python script running in terminal | 1.2 | 0 | 0 | 9,002 |
8,630,573 | 2011-12-25T17:08:00.000 | 1 | 0 | 0 | 1 | python,terminal,pausing-execution | 8,631,087 | 6 | false | 0 | 0 | Since you're populating a database with your data, I suggest to use it as a way to track the progress of the script (get the latest URL parsed, have a list of pending URLs, etc.).
If the script is terminated abruptly, you don't have to worry about saving its state because the database transactions will come to the resc... | 4 | 3 | 0 | I have a web crawling python script running in terminal for several hours, which is continuously populating my database. It has several nested for loops. For some reasons I need to restart my computer and continue my script from exactly the place where I left. Is it possible to preserve the pointer state and resume the... | How to pause a python script running in terminal | 0.033321 | 0 | 0 | 9,002 |
8,631,091 | 2011-12-25T19:11:00.000 | 0 | 1 | 0 | 0 | python,profiling,stackless,green-threads | 8,660,039 | 1 | true | 0 | 0 | I haven't found an explicit function to hook into when a tasklet blocks/resumes, but since Channel.receive() is typically when the block/resume occurs, I hooked into every occurrence of that happening. | 1 | 1 | 0 | In my server written in Stackless Python, I occasionally am getting large spikes in CPU usage for 5-10 seconds durations. This happens sporadically so I'm having trouble tracking it down.
I've used cProfile to try and determine where these spikes are coming from but cProfile gives an overall picture of where time is... | Stackless Python - profile single tasklet execution time | 1.2 | 0 | 0 | 184 |
8,631,253 | 2011-12-25T19:47:00.000 | 0 | 0 | 1 | 0 | python,windows | 8,631,356 | 4 | false | 0 | 0 | open a command line window, and use "c:\python27\python.exe" yourscript.py (or whatever path your python 2.7 appears to be installed in).
of course, you can put that line into a batch file and execute the batch.
also, you can put a shortcut to c:\python27\python.exe on your desktop and drop your script onto that shortc... | 3 | 3 | 0 | I'm new to python. I've installed both Python 3.2.2 for x64 and Python 2.7 for x86 on my 64-bit windows machine. I've got some python code that are coded for python 2.x versions. But every time I try to run them by double clicking it is interpreted by python 3.x.
How do I force them to use python version 2.7, may be us... | Using older Python 2.x while having both Python 2.x and 3.x installed on Windows | 0 | 0 | 0 | 472 |
8,631,253 | 2011-12-25T19:47:00.000 | 1 | 0 | 1 | 0 | python,windows | 8,631,282 | 4 | false | 0 | 0 | You could, e.g., associate the file extension .py2 with Python 2.7 and rename the main file (assuming you regard Python 3.2 as your default version). | 3 | 3 | 0 | I'm new to python. I've installed both Python 3.2.2 for x64 and Python 2.7 for x86 on my 64-bit windows machine. I've got some python code that are coded for python 2.x versions. But every time I try to run them by double clicking it is interpreted by python 3.x.
How do I force them to use python version 2.7, may be us... | Using older Python 2.x while having both Python 2.x and 3.x installed on Windows | 0.049958 | 0 | 0 | 472 |
8,631,253 | 2011-12-25T19:47:00.000 | -1 | 0 | 1 | 0 | python,windows | 8,631,293 | 4 | false | 0 | 0 | try editing PATH environment variable, use python 2.7 path and delete python 3.2.2 | 3 | 3 | 0 | I'm new to python. I've installed both Python 3.2.2 for x64 and Python 2.7 for x86 on my 64-bit windows machine. I've got some python code that are coded for python 2.x versions. But every time I try to run them by double clicking it is interpreted by python 3.x.
How do I force them to use python version 2.7, may be us... | Using older Python 2.x while having both Python 2.x and 3.x installed on Windows | -0.049958 | 0 | 0 | 472 |
8,631,500 | 2011-12-25T20:50:00.000 | 0 | 0 | 0 | 0 | python,selenium,webdriver,web-scraping,alert | 8,631,520 | 6 | false | 1 | 0 | that depends on the javascript function that handles the form submission
if there's no such function try to submit the form using post | 1 | 20 | 0 | I am scraping a webpage using Selenium webdriver in Python
The webpage I am working on, has a form. I am able to fill the form and then I click on the Submit button.
It generates an popup window( Javascript Alert). I am not sure, how to click the popup through webdriver.
Any idea how to do it ?
Thanks | Click the javascript popup through webdriver | 0 | 0 | 1 | 38,288 |
8,631,743 | 2011-12-25T21:45:00.000 | 1 | 1 | 1 | 0 | python,performance-testing | 8,631,751 | 4 | false | 0 | 0 | Under linux:
time python script.py | 3 | 4 | 0 | What's the easiest way to calculate the execution time of a Python script? | Easiest way to calculate execution time of a python script? | 0.049958 | 0 | 0 | 6,333 |
8,631,743 | 2011-12-25T21:45:00.000 | 5 | 1 | 1 | 0 | python,performance-testing | 8,631,753 | 4 | false | 0 | 0 | Using Linux time command like this : time python file.py
Or you can take the times at start and at end and calculate the difference. | 3 | 4 | 0 | What's the easiest way to calculate the execution time of a Python script? | Easiest way to calculate execution time of a python script? | 0.244919 | 0 | 0 | 6,333 |
8,631,743 | 2011-12-25T21:45:00.000 | 0 | 1 | 1 | 0 | python,performance-testing | 8,631,755 | 4 | false | 0 | 0 | How about using time?
example:
time myPython.py | 3 | 4 | 0 | What's the easiest way to calculate the execution time of a Python script? | Easiest way to calculate execution time of a python script? | 0 | 0 | 0 | 6,333 |
8,633,112 | 2011-12-26T05:17:00.000 | 0 | 0 | 0 | 1 | java,python,hadoop | 8,633,193 | 2 | false | 0 | 0 | I think you can use HIVE. Even I am new to Hadoop but read some where that HIVE is for hadoop analytics. Not sure whether it has GUI or not, but for sure it has SQL capability to query unstructed data. | 2 | 0 | 1 | I am doing research for my new project, Following is the details of my project, research and questions:
Project:
Save the Logs (ex. format is TimeStamp,LOG Entry,Location,Remarks etc ) from different sources. Here Different sources is like, gettting the LOG data from the different systems world wide (Just an Overview)... | Hadoop - Saving Log Data and Developing GUI | 0 | 0 | 0 | 321 |
8,633,112 | 2011-12-26T05:17:00.000 | 1 | 0 | 0 | 1 | java,python,hadoop | 8,633,276 | 2 | false | 0 | 0 | Have you looked at Datameer ? It provides a GUI to import all these types of files, and create reports as well as dashboards. | 2 | 0 | 1 | I am doing research for my new project, Following is the details of my project, research and questions:
Project:
Save the Logs (ex. format is TimeStamp,LOG Entry,Location,Remarks etc ) from different sources. Here Different sources is like, gettting the LOG data from the different systems world wide (Just an Overview)... | Hadoop - Saving Log Data and Developing GUI | 0.099668 | 0 | 0 | 321 |
8,634,943 | 2011-12-26T10:39:00.000 | 1 | 0 | 1 | 1 | python,variables,input,executable | 8,634,993 | 1 | true | 0 | 0 | The easiest way to send variables to a sub-program is using command line arguments or environment variables. If you want bidirectional communication you can use pipes to transmit the info that you are currently sending over the text files (even on Windows). The python subprocess (http://docs.python.org/library/subpro... | 1 | 0 | 0 | I have a python script: main.py, which executes a cx_frozen python script: test.exe I have created. main.py needs to send variables to test.exe. If the frozen script is able to send variables back that would be great too.
I have, up to this point been saving out .txt files from main.py and accepting them from test.exe ... | Python, communicating variables between a script and .exe | 1.2 | 0 | 0 | 292 |
8,635,063 | 2011-12-26T10:54:00.000 | 0 | 0 | 1 | 0 | python,audio,tempo | 37,489,967 | 6 | false | 0 | 0 | Librosa has the librosa.beat.beat_track() method, but you need to supply an estimate of the BMP as the "start_bpm" parameter. Not sure how accurate it is, but perhaps worth a shot. | 2 | 21 | 0 | I am involved in a project which requires me to extract song features like beats per minute (BPM), tempo, etc. However, I have not found a suitable Python library that can accurately detect these features.
Does anyone have any advice?
(In Matlab, I do know of a project called Mirtoolbox, which can give the BPM and tem... | How to get BPM and tempo audio features in Python | 0 | 0 | 0 | 24,766 |
8,635,063 | 2011-12-26T10:54:00.000 | 1 | 0 | 1 | 0 | python,audio,tempo | 52,925,490 | 6 | false | 0 | 0 | librosa is the package you are looking for. It contains extensive range of functions for audio analysis. librosa.beat.beat_track() and librosa.beat.tempo() functions will extract the required features for you.
Spectral features like chroma, MFCC, Zero-crossing rate, and rhythm features such as tempogram can also be obt... | 2 | 21 | 0 | I am involved in a project which requires me to extract song features like beats per minute (BPM), tempo, etc. However, I have not found a suitable Python library that can accurately detect these features.
Does anyone have any advice?
(In Matlab, I do know of a project called Mirtoolbox, which can give the BPM and tem... | How to get BPM and tempo audio features in Python | 0.033321 | 0 | 0 | 24,766 |
8,636,386 | 2011-12-26T13:55:00.000 | 2 | 0 | 1 | 0 | python,windows,windows-7,installation | 8,636,645 | 3 | false | 0 | 0 | Type help('modules') on the Python shell to get a list of all installed modules. If you can find stable 64-bit versions, then by all means select 64-bit builds for installations. | 1 | 3 | 0 | I'm moving from a computer with windows xp to one with windows 7 (64 bit) and I want to install Python on the new machine. I'm currently using python 2.7 and 3.2 and a bunch of packages
1) Should I install the 64 bit versions?
2) How can I tell which packages I currently have, so that I can get those for the new mac... | Python: moving to a new computer | 0.132549 | 0 | 0 | 2,731 |
8,640,781 | 2011-12-27T03:07:00.000 | 0 | 0 | 1 | 0 | python,linux,configure | 8,658,970 | 2 | false | 0 | 0 | Suse has a package manager called Yast. It would do your installation with no fuss. | 1 | 0 | 0 | I downloaded tarball of python 2.7.2 to install on Suse Linux server--it comes with 2.6 and 3.1.
Untarred it (I know--wrong lingo, sorry) to a directory.
When trying to run ./configure, which should create a valid makefile I can't get past the step one: the script reports that it can't find a compiler on the path.
But... | Completely lost: Python configure script runs with errors | 0 | 0 | 0 | 150 |
8,641,200 | 2011-12-26T20:13:00.000 | 3 | 0 | 1 | 0 | python,variables | 8,641,201 | 3 | true | 0 | 0 | self works just like the this from C++ and Java. You get a reference to an object that you can then access with the . operator (-> in C++).
In Python the only way of accessing instance variables is explicitely through self. Instance variables are not placed in the same "normal" scope as local or global variables are. | 1 | 2 | 0 | I've been exposed to C/C++/Java like syntax over the years, and the way that Python variables are defined just sort of confuses me. Can anyone describe what the differences are among the three mentioned in the q? | Python: What is the difference between a global variable, vs. a variable with the prefix "self.", vs. a local variable? | 1.2 | 0 | 0 | 8,761 |
8,645,093 | 2011-12-27T13:18:00.000 | 4 | 0 | 1 | 0 | python,virtualenv,ubuntu-10.04,flask | 9,362,915 | 3 | false | 1 | 0 | type 'python' in shell and then type 'import flask', if there is no error, you can use it. | 1 | 3 | 0 | I am trying to set up Flask on Ubuntu 10.04 LTS.
I have install virtualenv 1.7
I am using python 2.6
I set my virtualenv and easy_install Flask
But when I check in my python import Flask fails
The Flask.egg is present in my virtualenv site-pakages.
Any suggestions ? | Flask virtualenv | 0.26052 | 0 | 0 | 2,147 |
8,646,468 | 2011-12-27T15:46:00.000 | 1 | 0 | 1 | 0 | python-3.x,bit-shift | 8,646,507 | 5 | false | 0 | 0 | The >> operator is the same operator as it is in C and many other languages.
A bitshift to the right. If your number is like this in binary: 0100 than it will be 0010 after >> 1. With >> 2 it will be 0001.
So basically it's a nice way to divide your number by 2 (while flooring the remainder) ;) | 2 | 0 | 0 | This is the confusing line: x_next = (x_next + (a // x_prev)) >> 1 | Python 3 - What is ">>" | 0.039979 | 0 | 0 | 4,579 |
8,646,468 | 2011-12-27T15:46:00.000 | 1 | 0 | 1 | 0 | python-3.x,bit-shift | 60,008,465 | 5 | false | 0 | 0 | Most newer/younger programmers do not worry about efficiency because the computers are so fast.
But if you are working on a 8-bit or 16-bit processor that may or may not have a hardware multiply and rarely has a hardware divide, then shifting integers takes one machine cycle while a multiply may take 16 or more and a ... | 2 | 0 | 0 | This is the confusing line: x_next = (x_next + (a // x_prev)) >> 1 | Python 3 - What is ">>" | 0.039979 | 0 | 0 | 4,579 |
8,648,537 | 2011-12-27T19:37:00.000 | 2 | 0 | 0 | 0 | python,gtk,pygtk,docstring | 8,648,804 | 3 | true | 0 | 1 | It might be that what you wanted to ask was answered by @DonQuestion already... however if you truly just wanted to ask why help(gtk.Label.get) doesn't return a help... the answer is actually very simple: because the get method in the Label object lacks a docstring in the source code. :)
In fact the call to help doesn'... | 2 | 0 | 0 | in pygtk when I set the label mylabel = gtk.Label("Hello World!") I can get the string of label from it by mylabel.get() method. but in python interpreter I can't get the docstring of this method: help(gtk.Label.get). Anyone know why? | How to get help of PyGTK methods? | 1.2 | 0 | 0 | 149 |
8,648,537 | 2011-12-27T19:37:00.000 | 3 | 0 | 0 | 0 | python,gtk,pygtk,docstring | 8,648,722 | 3 | false | 0 | 1 | Because the method gtk.Label.get is an object itself, and has some attributes. The builtin function help looks the __doc__ attribute and some other dictionaries of the object and the Class of the object up and returns them (formatted). You could do a help(help) for example! ;-) so help(gtk.Label.get) returns the attrib... | 2 | 0 | 0 | in pygtk when I set the label mylabel = gtk.Label("Hello World!") I can get the string of label from it by mylabel.get() method. but in python interpreter I can't get the docstring of this method: help(gtk.Label.get). Anyone know why? | How to get help of PyGTK methods? | 0.197375 | 0 | 0 | 149 |
8,649,405 | 2011-12-27T21:20:00.000 | 0 | 0 | 0 | 0 | python,rpc | 8,649,530 | 3 | false | 0 | 0 | I have been doing something similar on a larger scale (with 15 clients). I use the pexpect module to do essentially ssh commands on the remote machine (computer B). Another module to look into would be the subprocess module. | 1 | 1 | 0 | I have two computers on a network. I'll call the computer I'm working on computer A and the remote computer B. My goal is to send a command to B, gather some information, transfer this information to computer A and use this in some meaningfull way. My current method follows:
Establish a connection to B with paramiko.
... | How do I transfer data between two computers ? | 0 | 0 | 1 | 2,292 |
8,649,965 | 2011-12-27T22:31:00.000 | 1 | 0 | 0 | 0 | python,django | 8,650,131 | 3 | false | 1 | 0 | Just run this command into your command shell: python2.7 /path/to/manage.py runserver
Then Django will run under python 2.7 | 1 | 4 | 0 | I am using CentOS. The default python installed is 2.4 and I also installed 2.7 in order to use Django.
How can I configure Django to use /usr/local/bin/python2.7 instead of just the default python command?
I have to leave the default Python as 2.4 because other services such as yum don't run with 2.7.
Or is there ot... | How do I set Django to use Python 2.7 instead of the default Python 2.4? | 0.066568 | 0 | 0 | 7,887 |
8,650,079 | 2011-12-27T22:48:00.000 | 0 | 0 | 0 | 1 | python,build,suse | 8,662,523 | 1 | true | 0 | 1 | I found many distribution points for sets of rpm packages. This enabled me to install individual packages such as the headers for tcl. But, this was a bad approach because the full dependency hierarchy to build Python support for tkinter is something on the order of 60 packages.
I found that the OpenSuSE repository f... | 1 | 0 | 0 | I've spent hours on this. Seems like our job on Linux is to debug scripts that don't work across the fragmented distros rather than getting work done.
Setup.py tries to find what it needs and build the c modules used to wrap certain dependencies if it can find what it needs. This makes the script super fragile relati... | Python 2.7.2 install on Suse Linux Server 11.3 can't find tkinter dependencies | 1.2 | 0 | 0 | 1,235 |
8,650,148 | 2011-12-27T23:00:00.000 | 0 | 1 | 0 | 0 | python,ssh,paramiko | 8,650,409 | 1 | false | 0 | 0 | You have to create new thread/process, for example using Python threading module. Paramiko has to write to socket after finishing Django request. | 1 | 2 | 0 | If I use command ssh -f server 'cp /file1 /file2 & >/dev/null 2>/dev/null ; disown;' it detaches well and command is runned in the background. But is there any variant of -f key for paramiko? | python-paramiko - run command in background | 0 | 0 | 0 | 1,175 |
8,651,061 | 2011-12-28T01:50:00.000 | 6 | 0 | 0 | 0 | python,sqlalchemy,pyramid | 14,859,955 | 2 | false | 0 | 0 | Your options are pyramid_beaker and dogpile.cache
pyramid_beaker was written to offer beaker caching for sessions. it also lets you configure beaker cache regions, which can be used elsewhere.
dogpile.cache is a replacement for beaker. it hasn't been integrated to offer session support or environment.ini based setup... | 1 | 3 | 0 | I've looked in the documentation and haven't seen (from first sight) anything about cache in Pyramid. Maybe I missed something... Or maybe there are some third party packages to help with this.
For example, how to cache db query (SQLAlchemy), how to cache views? Could anyone give some link to examples or documentation?... | How to cache using Pyramid? | 1 | 1 | 0 | 4,486 |
8,651,063 | 2011-12-28T01:51:00.000 | 4 | 1 | 0 | 0 | python,algorithm | 8,651,274 | 1 | true | 0 | 0 | The issue is overshooting the setpoint temperature.
If you simply run the device until the set point temperature is reached, you will overshoot, wasting energy (and possibly doing damage, depending on what the thermostat controls.)
You need to "ease up to" the setpoint so that you arrive at the set point just as the de... | 1 | 0 | 0 | I am wondering exactly how a thermostat program would work and wanted to see if anyone had a better opinion on it. From what I know, there are a few control algorithms that could be used, some being Bang-Bang (On/Off), Proportional Control Algorithms, and PID Control. Looking on Wikipedia, there is a great deal of expl... | Thermostat Control Algorithms | 1.2 | 0 | 0 | 2,614 |
8,651,668 | 2011-12-28T03:54:00.000 | 1 | 0 | 0 | 0 | python,report,openoffice.org,openerp,openoffice-writer | 9,046,631 | 4 | false | 1 | 0 | First you save .odt file then connect with server and select open new report and then send it ti server with proper report name and then keep on editing your report by selecting the option modify existing report. | 1 | 1 | 0 | I am trying to create a new report with report plugin and openoffice but I don't know how to assign it in the OpenERP system.
Is there someone who can give me exact steps for creation of new report and integration with openerp?
Thanks in advance! | OpenERP - Report Creation | 0.049958 | 0 | 0 | 6,171 |
8,652,585 | 2011-12-28T06:20:00.000 | 0 | 0 | 1 | 0 | python,django,concurrency | 9,348,456 | 1 | false | 1 | 0 | If by concurrent environment, you mean separate processes, then it should be perfectly fine. If you are sharing imported modules among threads of same application, it should still be fine, as long as they are python threads and the modules imported are pure-python. For what it's worth, I hope you are not using sub-inte... | 1 | 2 | 0 | I have a question. I'm using importlib in Django to dynamic load a specific module at runtime, and then using the imported module to work around. Using this way can reduce much code in my project. But I'm not sure whether it is suitable for concurrent environment. Can anyone enlighten me? | Can python's importlib work in concurrent environment? | 0 | 0 | 0 | 139 |
8,654,165 | 2011-12-28T09:37:00.000 | 0 | 0 | 0 | 0 | python,html,wxpython | 8,654,270 | 2 | false | 1 | 1 | You can use Javascript to create your own GUI to show. Maybe Google's NaCl is far enough advanced but it won't give you the cross browser compatibility you'll probably like.
If you look at broadway (which is linked in one of the other answers), you'll need to run an X session for each user. | 1 | 1 | 0 | Is it possible to embed a wxPython based GUI in an HTML page?
If not, is there any other option other than Java applets to make GUIs that can be embedded onto an HTML page? | wxPython GUI on a web page? | 0 | 0 | 0 | 669 |
8,654,634 | 2011-12-28T10:25:00.000 | 0 | 0 | 0 | 0 | python,packagemaker,py2app | 8,819,837 | 1 | true | 0 | 0 | Was due to a corrupted plist file. After removing ~/Library/Preferences/com.apple.dock.plist and logging in again it worked | 1 | 0 | 0 | I'm using py2app and package maker to install a python program. The issue I'm having is that if I install as one user selecting 'install for all users' and then switch to a different user the icon for the app is missing- I just get a blank hole, but everything else works fine. I wondered if it was a permissions issue b... | Installed py2app missing icon as a different user | 1.2 | 0 | 0 | 107 |
8,655,938 | 2011-12-28T12:29:00.000 | 0 | 0 | 0 | 0 | python,django,aptana | 64,820,990 | 2 | false | 1 | 0 | use {% load static %} instead of {% load staticfiles %}
in the new version of Django, the syntax of loading static files changed | 1 | 1 | 0 | I didn't worked on the django project for somedays and now I return and I can't work on it. When I debug or run in eclipse aptana I get the "Error: No module named staticfiles" error.
I have even updated aptana to today's updates and no luck.
I have uninstalled the django, delete all files and reinstall.
If I import d... | Error: No module named staticfiles in django 1.3.1 + python 2.6? what's wrong | 0 | 0 | 0 | 1,835 |
8,657,959 | 2011-12-28T15:45:00.000 | 2 | 0 | 1 | 0 | python,django,git,github,setup.py | 8,658,725 | 2 | false | 1 | 0 | An alternative to this would be to provide a requirements.txt file for use with pip. You can specify git and mercurial repos as well as packages from PyPI, so that the user would just have to do pip install -r requirements.txt to get the whole project. | 1 | 7 | 0 | Is it possible to create a setup.py file that:
Pulls in a github repository
places the files from that repository into a specified folder
I'm setting up a django package/app that uses third-party JavaScript frameworks available on github. I'd like to be able to have setup.py pull the latest version from github and t... | setup.py that pulls in non-Python github repos and puts them in the correct directory? | 0.197375 | 0 | 0 | 2,129 |
8,658,934 | 2011-12-28T17:05:00.000 | 2 | 1 | 0 | 1 | python,linux,macos | 9,056,422 | 3 | false | 0 | 0 | eaj is correct that initstate needs more than 8 bytes for state information. The best way to do this for ghmm is with either the --enable-gsl or --with-rng=bsd option for ./configure. --with-rng=bsd makes the type "ghmm_rng_state_t" 8 bytes instead of 1. See rng.h in the ghmm directory. | 1 | 2 | 0 | Not sure what the above error means. I just installed ghmm on my mac and get this error every time I do a import ghmm. I do not get this message on my ghmm install on my linux machine and other than that all functions appear to be fine.
I wondering if anyone has seen this before and if there's anything I can do to ge... | random: not enough state (1 bytes); ignored | 0.132549 | 0 | 0 | 403 |
8,659,226 | 2011-12-28T17:34:00.000 | 1 | 1 | 1 | 1 | python,perl | 8,659,430 | 3 | false | 0 | 0 | It may be simpler to run both scripts from a shell script, and use pipes (assuming that you're in a Unix environment) if you need to pass the results from one program to the other | 1 | 3 | 0 | I have two scripts, a python script and a perl script.
How can I make the perl script run the python script and then runs itself? | Run a python script in perl | 0.066568 | 0 | 0 | 11,721 |
8,659,663 | 2011-12-28T18:19:00.000 | 0 | 0 | 0 | 0 | android,python,image-processing | 8,659,766 | 4 | false | 0 | 1 | What about converting the image into greyscale one, calculate average color of the greyscale image, and filter out images than go over some threshold? | 1 | 2 | 0 | I have an Android application that has user contributed images. There are a lot of users that submit black or really dark images to the backend application, that I want to filter out. Best solution would be to filter the images already at the phone and notify the user to make more light and retake the picture. Another ... | Detecting black images on Android or python | 0 | 0 | 0 | 2,293 |
8,660,015 | 2011-12-28T18:53:00.000 | 1 | 0 | 0 | 0 | python,markov-chains | 8,660,103 | 2 | false | 0 | 0 | If each character only depends on the previous character, you could just compute the probabilities for all 27^2 pairs of characters. | 1 | 4 | 1 | I would like to generate a random text using letter frequencies from a book in a .txt file, so that each new character (string.lowercase + ' ') depends on the previous one.
How do I use Markov chains to do so? Or is it simpler to use 27 arrays with conditional frequencies for each letter? | Markov chain on letter scale and random text | 0.099668 | 0 | 0 | 1,880 |
8,660,622 | 2011-12-28T19:57:00.000 | 2 | 0 | 0 | 0 | python,database,python-stackless | 8,660,848 | 2 | false | 0 | 0 | It's difficult to comment on the entire design/datamodel without greater understanding of the software, but it sounds like your application could benefit from an in-memory database.* Backing up such databases to disk is (relatively speaking) a cheap operation. I've found that it is generally faster to:
A) Create an i... | 2 | 8 | 0 | I'm engaged in developing a turn-based casual MMORPG game server.
The low level engine(NOT written by us) which handle networking,
multi-threading, timer, inter-server communication, main game loop etc, was
written by C++. The high level game logic was written by Python.
My question is about the data model design in ou... | Need suggestion about MMORPG data model design, database access and stackless python | 0.197375 | 1 | 0 | 3,298 |
8,660,622 | 2011-12-28T19:57:00.000 | 6 | 0 | 0 | 0 | python,database,python-stackless | 8,660,935 | 2 | true | 0 | 0 | I've worked with one MMO engine that operated in a somewhat similar fashion. It was written in Java, however, not Python.
With regards to your first set of points:
1) async db access We actually went the other route, and avoided having a “main game logic thread.” All game logic tasks were spawned as new threads. The ov... | 2 | 8 | 0 | I'm engaged in developing a turn-based casual MMORPG game server.
The low level engine(NOT written by us) which handle networking,
multi-threading, timer, inter-server communication, main game loop etc, was
written by C++. The high level game logic was written by Python.
My question is about the data model design in ou... | Need suggestion about MMORPG data model design, database access and stackless python | 1.2 | 1 | 0 | 3,298 |
8,661,415 | 2011-12-28T21:15:00.000 | 0 | 1 | 0 | 0 | python,objective-c,serialization | 8,661,467 | 2 | true | 0 | 1 | Choose what you like most. Both are standards, but JSON is a generic format used for serializing dictionaries and arrays, while InkML focuses on drawing related objects.
JSON support is available in both Python and Objective-C, while InkML has no built-in support in either. | 1 | 1 | 0 | I have an NSMutableArray filled with BeziarPaths. I'd like to serialize it so that its accessible on Python. Someone suggested to me that I can try GZIP + InkML or GZIP +JSON. I was wondering what the best way to do this is. I am also really new to this, so example code would be extremely helpful.
Thanks | Objective C to Python Serialization | 1.2 | 0 | 0 | 318 |
8,662,359 | 2011-12-28T23:15:00.000 | 0 | 0 | 0 | 0 | python,django,django-admin,django-authentication | 50,468,736 | 9 | false | 1 | 0 | use
admin.site.site_url = "your url here"
in url.py of ur main app to modify the "visit site" on django page
and
for "view_on_site" removal
use
view_on_site = False in ur class with display_list for | 1 | 12 | 0 | get_absolute_url() method is cool, but in some cases is not needed. django.contrib.auth.models.User has it set by default, this cause my projects to have a broken link in the admin.
How can I prevent that from happening?
In one of my old projects I set a custom template in which I removed the html of the button, it doe... | Django: Remove "view on site" button in the admin User change form | 0 | 0 | 0 | 7,467 |
8,662,371 | 2011-12-28T23:17:00.000 | 0 | 0 | 0 | 0 | python,date | 8,668,348 | 1 | false | 0 | 0 | It looks to me like you simply want to ignore the year in your comparison function (to find the min/max dates). Since your data set is small, why not just iterate over all weeks and perform comparisons based on month & date only? | 1 | 0 | 0 | I have a list of 104 consecutive weeks. The week numbers come from the National Retail Foundation Calendar. So week 1 will basically be the first week in February.
I'm finding ranges of weeks inside this two year list of dates. I'll assume just two ranges for the point of my question. I want to pick the weeks that ... | How to choose earliest NRF week number, from a set of date ranges in python? | 0 | 0 | 0 | 198 |
8,662,501 | 2011-12-28T23:36:00.000 | 0 | 1 | 1 | 0 | python,graph,fractals,complex-numbers | 8,662,563 | 2 | false | 0 | 0 | Julia set renderings are generally 2D color plots, with [x y] representing a complex starting point and the color usually representing an iteration count. | 2 | 2 | 0 | For a math fair project I want to make a program that will generate a Julia set fractal. To do this i need to plot complex numbers on a graph. Does anyone know how to do this? Remember I am using complex numbers, not regular coordinates. Thank You! | Plotting Complex Numbers in Python? | 0 | 0 | 0 | 1,786 |
8,662,501 | 2011-12-28T23:36:00.000 | 2 | 1 | 1 | 0 | python,graph,fractals,complex-numbers | 8,662,525 | 2 | false | 0 | 0 | You could plot the real portion of the number along the X axis and plot the imaginary portion of the number along the Y axis. Plot the corresponding pixel with whatever color makes sense for the output of the Julia function for that point. | 2 | 2 | 0 | For a math fair project I want to make a program that will generate a Julia set fractal. To do this i need to plot complex numbers on a graph. Does anyone know how to do this? Remember I am using complex numbers, not regular coordinates. Thank You! | Plotting Complex Numbers in Python? | 0.197375 | 0 | 0 | 1,786 |
8,662,519 | 2011-12-28T23:40:00.000 | 1 | 1 | 1 | 0 | python,ios,binary | 8,662,573 | 2 | false | 0 | 0 | Python has a struct standard module that allows easy manipulation of simple binary formats with conversion to python types (struct.unpack) or in the opposite direction (struct.pack). | 2 | 1 | 0 | Is there a shared binary format between iOS and Python? I found binary property lists.
I have a list of UIBeziarPaths in an array that I want to be able to send to Python. I am just looking for something that will very efficiently be able to do that. I looked into the text based formats like JSON except they seem less... | Shared binary format between iOS and Python | 0.099668 | 0 | 0 | 217 |
8,662,519 | 2011-12-28T23:40:00.000 | 1 | 1 | 1 | 0 | python,ios,binary | 8,662,606 | 2 | true | 0 | 0 | There are no formats specifically designed for iOS/Python. There are numerous data interchange formats you could use, including protocol buffers, BSON, ASN.1 (if you're that way inclined) and even a range of binary XML serialisation formats.
OTOH, I would strongly favour JSON (a textual format) unless bandwidth is exce... | 2 | 1 | 0 | Is there a shared binary format between iOS and Python? I found binary property lists.
I have a list of UIBeziarPaths in an array that I want to be able to send to Python. I am just looking for something that will very efficiently be able to do that. I looked into the text based formats like JSON except they seem less... | Shared binary format between iOS and Python | 1.2 | 0 | 0 | 217 |
8,663,391 | 2011-12-29T02:24:00.000 | 0 | 0 | 0 | 0 | python,django,html,ftp | 8,664,646 | 2 | true | 1 | 0 | You'll need to use a persistent connection framework as what you're trying to achieve really isn't what HTTP was meant for (in the sense that HTTP commands are stateless and independent), and thus not what Django is built for. There are a number of options, but since it seems you are in a restricted environment you'll ... | 2 | 0 | 0 | I'm going to use ftplib to open up an FTP connection to an FTP server provided by the user. The client will be sending FTP commands to my django server via Ajax, which will then be forwarded to the FTP server the user provided. However, I'd like to not have to create a new FTP server connection every time the client s... | How to maintain server-initiated FTP connection between client requests in Python/Django? | 1.2 | 0 | 1 | 631 |
8,663,391 | 2011-12-29T02:24:00.000 | 0 | 0 | 0 | 0 | python,django,html,ftp | 8,665,512 | 2 | false | 1 | 0 | Switch hosts. Webfaction allows websockets with dedicated IP at around $20 per month. | 2 | 0 | 0 | I'm going to use ftplib to open up an FTP connection to an FTP server provided by the user. The client will be sending FTP commands to my django server via Ajax, which will then be forwarded to the FTP server the user provided. However, I'd like to not have to create a new FTP server connection every time the client s... | How to maintain server-initiated FTP connection between client requests in Python/Django? | 0 | 0 | 1 | 631 |
8,663,432 | 2011-12-29T02:33:00.000 | 1 | 0 | 0 | 0 | python,mongodb,mapreduce | 8,666,791 | 2 | true | 0 | 0 | Since you have to go over "each record", you'll do one full table scan anyway, then a simple cursor (find()) + maybe only fetching few fields (_id, ip) should do it. python driver will do the batching under the hood, so maybe you can give a hint on what's the optimal batch size (batch_size) if the default is not good e... | 2 | 3 | 0 | Apologies for the longish description.
I want to run a transform on every doc in a large-ish Mongodb collection with 10 million records approx 10G. Specifically I want to apply a geoip transform to the ip field in every doc and either append the result record to that doc or just create a whole other record linked to th... | How do I transform every doc in a large Mongodb collection without map/reduce? | 1.2 | 1 | 0 | 477 |
8,663,432 | 2011-12-29T02:33:00.000 | 0 | 0 | 0 | 0 | python,mongodb,mapreduce | 8,677,503 | 2 | false | 0 | 0 | Actually I am also attempting another approach in parallel (as plan B) which is to use mongoexport. I use it with --csv to dump a large csv file with just the (id, ip) fields. Then the plan is to use a python script to do a geoip lookup and then post back to mongo as a new doc on which map-reduce can now be run for c... | 2 | 3 | 0 | Apologies for the longish description.
I want to run a transform on every doc in a large-ish Mongodb collection with 10 million records approx 10G. Specifically I want to apply a geoip transform to the ip field in every doc and either append the result record to that doc or just create a whole other record linked to th... | How do I transform every doc in a large Mongodb collection without map/reduce? | 0 | 1 | 0 | 477 |
8,663,468 | 2011-12-29T02:43:00.000 | 6 | 0 | 0 | 1 | python,python-3.x,protocol-buffers | 26,048,683 | 6 | false | 0 | 0 | The latest version of Google Protocol Buffers (2.6) added Python 3 support. I suggest using that.
EDIT: Nevermind. They lied in their release notes. | 2 | 26 | 0 | We use Python 3.x in our projects. But the official client of Protocol Buffers only supports python 2.x.
I don't want to downgrade to python 2.x. | Is there any way to access Protocol Buffers with python 3.x? | 1 | 0 | 1 | 14,100 |
8,663,468 | 2011-12-29T02:43:00.000 | 1 | 0 | 0 | 1 | python,python-3.x,protocol-buffers | 50,994,740 | 6 | false | 0 | 0 | Google's official library has supported Python 3 since version 3.0 (Jul 29, 2016). | 2 | 26 | 0 | We use Python 3.x in our projects. But the official client of Protocol Buffers only supports python 2.x.
I don't want to downgrade to python 2.x. | Is there any way to access Protocol Buffers with python 3.x? | 0.033321 | 0 | 1 | 14,100 |
8,665,072 | 2011-12-29T07:27:00.000 | 0 | 0 | 0 | 0 | python,testing,file-upload,selenium,upload | 47,689,624 | 16 | false | 0 | 0 | Using splinter :
browser.attach_file('file_chooser_id',fully_qualified_file_path) | 1 | 75 | 0 | How to upload a picture on a web application with the selenium testing tool? I am using python.
I tried many things, but nothing worked. | How to upload file ( picture ) with selenium, python | 0 | 0 | 1 | 111,886 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.