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,479,320
2011-12-12T18:51:00.000
2
0
0
1
python,django,celery,django-celery
8,479,823
1
false
1
0
it's actually easy: you start one celery-instance per ec2-instance. set concurrency to the number of cores per ec2-instance. now the tasks don't interfere and distribute nicely among you instances. (the above assumes that your tasks are cpu bound)
1
0
0
I am using Celery with Django to manage a task que and using one (or more) small(single core) EC2 instances to process the task. I have some considerations. My task eats 100% CPU on a single core. - uses whatever CPU available but only in one core If 2 tasks are in progress on the same core, each task will be slowed d...
How to evenly distribute tasks among nodes with Celery?
0.379949
0
0
1,269
8,479,596
2011-12-12T19:19:00.000
1
0
1
0
python,multithreading
8,480,614
2
false
0
0
I voted for unubtu's answer. But in case this scenario is not possible for you: You do not have to care about the variable xx. Just assign a new object to it. Re-assigning a variable does not impact the current (still running) thread. Anyway, if I'm not wrong, you did not intend to use that variable any more to get in ...
2
0
0
I have a python thread, assigned to a variable name xx, which, when it completes its' run function triggers a callback. The callback eventually tries to create a new instance of that thread with variable name xx, effectively restarting the thread. Of course, checking xx.isAlive() returns True (since it initiated the ca...
replacing a thread instance while still isAlive
0.099668
0
0
217
8,479,596
2011-12-12T19:19:00.000
4
0
1
0
python,multithreading
8,479,713
2
true
0
0
Without understanding the details of your situation, my knee-jerk reaction is to say, Don't recreate the thread -- reuse the established one. It takes less time to reuse the established thread than it would to shut it down and start a new one.
2
0
0
I have a python thread, assigned to a variable name xx, which, when it completes its' run function triggers a callback. The callback eventually tries to create a new instance of that thread with variable name xx, effectively restarting the thread. Of course, checking xx.isAlive() returns True (since it initiated the ca...
replacing a thread instance while still isAlive
1.2
0
0
217
8,480,316
2011-12-12T20:23:00.000
1
0
1
0
python,multithreading,boost-python
20,388,492
2
true
0
0
The answer is no, the GIL will never truly multi-thread unless the DLL manually releases the lock. Python allows exactly one thread to run at a time unless the extension manually says, "I'm blocked, carry on without me." This is commonly done with the Py_BEGIN_ALLOW_THREADS macro (and undone with Py_END_ALLOW_THREADS...
1
8
0
I'm trying to test a multi-threaded C++ DLL. This DLL is supposed to be thread-safe. I have it wrapped with boost.python, and I'd like to create multiple python threads to exercise the DLL through the boost.python wrapper. I'm actually trying to cause threading problems. What I can't seem to find good documentatio...
True multithreading with boost.python
1.2
0
0
4,361
8,483,263
2011-12-13T01:24:00.000
-1
0
0
0
python,amazon-web-services
8,494,166
1
false
1
0
Have you looked at using web page scraping to fetch/get the customer reviews / ratings? If you know the customer id you should be able to extract all the information you need directly from the Amazon web pages.
1
1
0
Using ecs.py, I used to be able to get the reviews of a customer with a query like ecs.CustomerContentLookup(customerId, ResponseGroup='CustomerReviews'). This is now deprecated. Is there an alternative? Thanks.
Is there a way to lookup all reviews of a customer in Amazon's new Product Advertising API?
-0.197375
0
1
179
8,483,522
2011-12-13T02:11:00.000
0
1
1
0
python,performance,algorithm,math,numerical-methods
26,903,947
7
false
0
0
I just finish a project where comparing bisection, Newton, and secant root finding methods. Since this is a practical case, I don't think you need to use Big-O notation. Big-O notation is more suitable for asymptotic view. What you can do is compare them in term of: Speed - for example here newton is the fastest if goo...
4
5
0
I would like to compare different methods of finding roots of functions in python (like Newton's methods or other simple calc based methods). I don't think I will have too much trouble writing the algorithms What would be a good way to make the actual comparison? I read up a little bit about Big-O. Would this be the wa...
Comparing Root-finding (of a function) algorithms in Python
0
0
0
2,621
8,483,522
2011-12-13T02:11:00.000
1
1
1
0
python,performance,algorithm,math,numerical-methods
8,484,871
7
false
0
0
Big-O notation is designed to describe how an alogorithm behaves in the limit, as n goes to infinity. This is a much easier thing to work with in a theoretical study than in a practical experiment. I would pick things to study that you can easily measure that and that people care about, such as accuracy and computer re...
4
5
0
I would like to compare different methods of finding roots of functions in python (like Newton's methods or other simple calc based methods). I don't think I will have too much trouble writing the algorithms What would be a good way to make the actual comparison? I read up a little bit about Big-O. Would this be the wa...
Comparing Root-finding (of a function) algorithms in Python
0.028564
0
0
2,621
8,483,522
2011-12-13T02:11:00.000
1
1
1
0
python,performance,algorithm,math,numerical-methods
8,487,731
7
false
0
0
You can get wildly different answers for the same problem just by changing starting points. Pick an initial guess that's close to the root and Newton's method will give you a result that converges quadratically. Choose another in a different part of the problem space and the root finder will diverge wildly. What does...
4
5
0
I would like to compare different methods of finding roots of functions in python (like Newton's methods or other simple calc based methods). I don't think I will have too much trouble writing the algorithms What would be a good way to make the actual comparison? I read up a little bit about Big-O. Would this be the wa...
Comparing Root-finding (of a function) algorithms in Python
0.028564
0
0
2,621
8,483,522
2011-12-13T02:11:00.000
5
1
1
0
python,performance,algorithm,math,numerical-methods
8,483,756
7
false
0
0
The answer from @sarnold is right -- it doesn't make sense to do a Big-Oh analysis. The principal differences between root finding algorithms are: rate of convergence (number of iterations) computational effort per iteration what is required as input (i.e. do you need to know the first derivative, do you need to set l...
4
5
0
I would like to compare different methods of finding roots of functions in python (like Newton's methods or other simple calc based methods). I don't think I will have too much trouble writing the algorithms What would be a good way to make the actual comparison? I read up a little bit about Big-O. Would this be the wa...
Comparing Root-finding (of a function) algorithms in Python
0.141893
0
0
2,621
8,483,654
2011-12-13T02:33:00.000
0
0
0
1
python,subprocess
8,483,908
2
false
0
0
If you specify stdout=PIPE, then your subprocess will write to the pipe and hang when the pipe buffer is full. The python program shoudn't hang - Popen is asynchronous which is why Popen.wait() can be called later to wait for the subprocess to exit. Read from Popen.stdout in order to keep the subprocess happy, and pr...
1
0
0
I know this has been asked a lot of times but I've yet to find a proper way of doing this. If I want to run a local command the docs say I have to use subprocess as it's replacing all other methods such as os.system/peopen etc. If I call subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) in my program and th...
python subprocess non-blocking and returning output
0
0
0
2,406
8,483,683
2011-12-13T02:37:00.000
0
1
0
0
python,win32com
71,846,830
1
false
0
0
You can use the combrowser.py to find the running application on your PC. Go to the win32com library folder and you can find the python script. You can get the list of all the running application. Sometimes it would be tricky if you get the token or moniker of the application instead of the name. But you can use those ...
1
2
0
How do you get the name of a win32com.client.gencache.EnsureDispath name? For example, I have an application named "xxxxx", and the Python object browser detects it when I use makepy.py. How do I get name like "Excel.Application"?
How to Get gencache.EnsureDispatch Name
0
0
0
333
8,484,253
2011-12-13T04:16:00.000
1
1
0
0
python,apache-flex,html
8,484,821
1
false
1
0
Pyjamas: Python->Javascript, set of widgets for use in a browser or a desktop Skulpt: Python written in Javascript Emscripten: C/C++ -> LLVM -> Javascript Empythoned: Based on emscripten and cpython, working on a stdlib? There are bugs to file
1
2
0
This is part of some preliminary research and I am having a difficult time figuring out what options might be available or if this is even a situation where a solution even exists. Essentially we have an existing python based simulation that we would like to make available to people via the web. It can be pretty proce...
Python in a webapp (client side)
0.197375
0
0
451
8,486,691
2011-12-13T09:12:00.000
1
0
1
0
python,browser
8,487,273
1
true
1
0
Poll the server to get the latest generated files (or the complete list of generated files) every n seconds, and stop the polling once the list is complete, or once the first ajax query (the one which starts the generation process) has completed. The thread which generates the file should make the list of generated fil...
1
0
0
I am using a Python WebServer (CherryPy), but I guess the question is more open and is fairly general. At the moment, I have some Ajax call trough JQuery load on a button click, that triggers some computation, ending in files generation. At the moment, as soon as the processing starts in a background thread, my load re...
Notify browser/page after long task has ended
1.2
0
0
65
8,486,942
2011-12-13T09:34:00.000
3
1
0
1
python
8,487,730
2
true
0
0
You can take advantage of Python paths (the paths searched when looking for module to import). Thus you can create different directory for utils and include it within different repository than the project that use these utils. Then include path to this repository in PYTHONPATH. This way if you write import mymodule, it...
1
4
0
We have a growing library of apps depending on a set of common util modules. We'd like to: share the same utils codebase between all projects allow utils to be extended (and fixed!) by developers working on any project have this be reasonably simple to use for devs (i.e. not a big disruption to workflow) cross-platfo...
Sharing util modules between actively developed apps
1.2
0
0
250
8,487,673
2011-12-13T10:33:00.000
-1
0
1
0
python,multithreading
20,567,283
5
false
0
0
You don´t need to lock dictionary to this operation, because this operation is atomic, and GIL take care this for you. Unless you have operations like read-change-write, don't worry.
1
9
0
I have a Web Server running in Python. The server is private, so i only expect around 20 users to connect to it. The server is multi-threaded (8 cores at the moment, so 8 threads I guessed). When requests come in, I am able to identify the users. On some queries, I need to update a simple dictionary of the form userna...
How would you make this Python Dictionary thread-safe?
-0.039979
0
0
19,945
8,490,117
2011-12-13T13:34:00.000
1
0
0
0
python,django,parsing,url,args
8,491,990
1
true
1
0
Option two is inherently slower as your view would need to do this parsing each time, whereas Django's standard URL parser works off of compiled regular expressions. (The urlpatterns in urls.py is compiled once on first run.) However, the speed difference in either approach is pretty negligible. This will never be the ...
1
0
0
I have an Django application where the URL's to be handled shall have a specific pattern like /servername/alpha/beta/2/delta/10/pie/1 Now i will be be needing these parameters contained in the URL and will persist them to the database when a URL beginning from /servername/ is being called.So i have 2 ways of doing it ...
Which gives better performance-passing parsed URL as args alongwith request or parsing URL in view-Django
1.2
0
0
155
8,491,323
2011-12-13T15:01:00.000
1
0
1
1
python,shell,command-line,python-3.x,ipython
8,609,983
6
false
0
0
I think you mean something like python C:\Python27\Scripts\ipython-script.py
1
26
0
I would like to add some commandline options to a python launch code in order to actually invoke an ipython shell. How do I do that?
How can I launch ipython from shell, by running 'python ...'?
0.033321
0
0
25,038
8,492,272
2011-12-13T16:06:00.000
1
0
0
0
python,windows,permissions
8,492,329
1
false
0
0
A possible reason is that the file is locked. In this case you have no permission to write to the file until it is released. Are you sure you don't lock the file somehow yourself?!
1
0
0
I have a wxPython app that writes user data to the Users folder at close. In most cases it works fine. However, I get some error reports from users that the app cannot write to the Users/username folder. IOError: [Errno 13] Permission denied: u\'C:\\Users\\usersname\\AppData\\Roaming\\app\\data.dat\' What situation ca...
Python Can't Access Windows 7 User Folder
0.197375
0
0
400
8,492,624
2011-12-13T16:31:00.000
41
0
1
0
python,performance,class
8,493,947
4
false
0
0
To answer the question: yes, it is likely to be a little slower, all else being equal. Some things that used to be variables (including functions) are now going to be object attributes, and self.foo is always going to be slightly slower than foo regardless of whether foo was a global or local originally. (Local variabl...
3
24
0
When I started learning Python, I created a few applications just using functions and procedural code. However, now I know classes and realized that the code can be much readable (and subjectively easier to understand) if I rewrite it with classes. How much slower the equivalent classes may get compared to the function...
How much slower python classes are compared to their equivalent functions?
1
0
0
22,661
8,492,624
2011-12-13T16:31:00.000
10
0
1
0
python,performance,class
8,500,710
4
false
0
0
Donald Knuth, one of the grand old minds of computing, is credited with the observation that "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil." Deciding to use procedural techniques rather than object-oriented ones on the basis of speed gains that may...
3
24
0
When I started learning Python, I created a few applications just using functions and procedural code. However, now I know classes and realized that the code can be much readable (and subjectively easier to understand) if I rewrite it with classes. How much slower the equivalent classes may get compared to the function...
How much slower python classes are compared to their equivalent functions?
1
0
0
22,661
8,492,624
2011-12-13T16:31:00.000
7
0
1
0
python,performance,class
8,492,762
4
false
0
0
You probably don't care as much as you think you do. Really. Sure, code with classes might be a little slower through indirection. Maybe. That is what JIT compilation is for, right? I can never remember which versions of python do this and which don't, because: Performance doesn't matter. At least constant performance ...
3
24
0
When I started learning Python, I created a few applications just using functions and procedural code. However, now I know classes and realized that the code can be much readable (and subjectively easier to understand) if I rewrite it with classes. How much slower the equivalent classes may get compared to the function...
How much slower python classes are compared to their equivalent functions?
1
0
0
22,661
8,495,145
2011-12-13T19:41:00.000
0
0
1
0
python,icalendar
8,495,811
2
false
0
0
You could tell iCal to open the ics file.
1
1
0
I've written an ICS file using the iCalendar module and python. My trouble is, how can I tell iCalendar to read the ICS file? I thought I could put it in ~/Library/iCalendar/<--->/Events but it seems that just stores the ICS files once they've been imported. Does anyone know a way I could do this? Thanks,
Programatically import ICS files to iCalendar
0
0
0
928
8,498,332
2011-12-14T00:55:00.000
0
0
0
0
python,facebook,access-token
8,498,829
1
true
1
0
The flow is to get the access token, you need that code....But sorry I don't know how to implement this using Python 2.7...
1
0
0
In spite of setting Auth Token Parameter of my application to URI Fragment (#access_token=...), I keep being redirected to the address with code in the text. I'm using Python 2.7 and cookielib for login. Is there anything else I need to do to get access_token instead of code?
Getting "code" instead of "access_token" in desktop application
1.2
0
0
92
8,498,475
2011-12-14T01:17:00.000
0
0
0
0
python,pyqt,pyqt4,qfiledialog
8,498,496
2
false
0
1
I would suggest you to let the user use drag & drop to add files directly from their favorite file browser. As I did this in wxpython without any trouble and user-feedbacks are pretty good :)
1
1
0
The FileDialog in pyqt is an excellent way to get one path for a file from the user, but is there a good way to get a large number of file selections from the user?
PyQt: How can I get a large list of filenames from the user?
0
0
0
5,368
8,499,462
2011-12-14T04:22:00.000
0
0
0
1
python,firewall,iptables
8,500,799
1
false
0
0
Short answer: no. Iptables is command line tool for controling netfilter, a linux kernel module for filtering network packet. This is only for Linux. Windows have his own kernel approach, and same for BSD* system. You might found some tools done in Python for controling one of them, but not all :) Feel free to start a ...
1
0
0
Like the question stated... How to use python to block/drop packets from blacklisted host (MAC address) ... or more specific, ARP packets I know that *inux has utilities like "iptables" that can perform this ... is there any modules or solution in python that can apply on windows or both *inux and windows? thanks ...
using python: how create firewall to block/drop network packets
0
0
0
1,331
8,500,225
2011-12-14T06:17:00.000
2
1
1
0
python
8,500,285
3
true
0
0
You could serialize the object with the pickle module (or maybe json?) If you really want to stick with os.system, then you could have MyBot.py write the pickled object to a file, which GP.py could read once MyBot.py returns. If you use the subprocess module instead, then you could have MyBot.py write the pickled objec...
1
1
0
I have a genetic expression tree program to control a bot. I have a GP.py and a MyBot.py. I need to be able to have the MyBot.py access an object created in GP.py The GP.py is starting the MyBot.py via the os.system() command I have hundreds of tree objects in the GP.py file and the MyBot.py needs to evaluate them. I c...
How to pass object between python instances
1.2
0
0
771
8,500,455
2011-12-14T06:44:00.000
2
0
0
0
python,django,xmpp,connection-pooling
8,504,436
1
true
1
0
As xmpppy has its own main loop I suggest to use it in a separate thread or even start separately. Actually you do have two separate applications: website and xmpp-client and it is normal to run them separately. In this case you may use different ways to communicate between your applications: pipes between threads and/...
1
0
0
How can i pool a connection to XMPP server in django so that it is available across multiple requests. I don't want to connect and authenticate on every request which makes it a bit slow. Is this possible? EDIT: I am using xmpppy python xmpp library
Django XMPP Connection pooling
1.2
0
1
415
8,501,756
2011-12-14T08:59:00.000
0
0
1
0
python,filesystems
8,501,985
4
false
0
0
You should first ask the question: What operations should my "file system" support? Based on the answer you select the data representation. For example, if you choose to support only create and delete and the order of the files in the dictionary is not important, then select a python dictionary. A dictionary will map ...
2
1
0
I’m working on simple class something like “in memory linux-like filesystem” for educational purposes. Files will be as StringIO objects. I can’t make decision how to implement files-folders hierarchy type in Python. I’m thinking about using list of objects with fields: type, name, parent what else? Maybe I should loo...
Representing filesystem table
0
0
0
846
8,501,756
2011-12-14T08:59:00.000
0
0
1
0
python,filesystems
8,502,479
4
false
0
0
What's the API of the filestore? Do you want to keep creation, modification and access times? Presumably the primary lookup will be by file name. Are any other retrieval operations anticipated? If only lookup by name is required then one possible representation is to map the filestore root directory on to a Python dict...
2
1
0
I’m working on simple class something like “in memory linux-like filesystem” for educational purposes. Files will be as StringIO objects. I can’t make decision how to implement files-folders hierarchy type in Python. I’m thinking about using list of objects with fields: type, name, parent what else? Maybe I should loo...
Representing filesystem table
0
0
0
846
8,506,002
2011-12-14T14:22:00.000
0
0
0
1
python,daemon,tornado,upstart
8,516,641
2
false
1
0
There are two often used solutions The first one is to let your application honestly report its pid. If you could force your application to write the actual pid into the pidfile then you could get its pid from there. The second one is a little more complicated. You may add specific environment variable for the script i...
2
1
0
Few days ago I found out that my webapp wrote ontop of the tornadoweb framework doesn't stop or restart via upstart. Upstart just hangs and doesn't do anything. I investigated the issue and found that upstart recieves wrong PID, so it can only run once my webapp daemon and can't do anything else. Strace shows that my d...
Tornadoweb webapp cannot be managed via upstart
0
0
0
417
8,506,002
2011-12-14T14:22:00.000
1
0
0
1
python,daemon,tornado,upstart
10,837,488
2
true
1
0
Sorry my silence, please. Investigation of the issue ended with the knowledge about uuid python library which adds 2 forks to my daemon. I get rid of this lib and tornado daemon works now properly. Alternative answer was supervisord which can run any console tools as a daemon which can't daemonize by itself.
2
1
0
Few days ago I found out that my webapp wrote ontop of the tornadoweb framework doesn't stop or restart via upstart. Upstart just hangs and doesn't do anything. I investigated the issue and found that upstart recieves wrong PID, so it can only run once my webapp daemon and can't do anything else. Strace shows that my d...
Tornadoweb webapp cannot be managed via upstart
1.2
0
0
417
8,507,081
2011-12-14T15:27:00.000
3
0
1
0
python,regex
8,507,249
3
false
0
0
Python regular expressions are anchored at the beginning of strings (like in many other languages): hence the ^ sign at the beginning doesn’t make any difference. However, the $ sign does very much make one: if you don’t include it, you’re only going to match the beginning of your string, and the end could contain any...
3
0
0
'[A-Za-z0-9-_]*' '^[A-Za-z0-9-_]*$' I want to check if a string only contains the sign in the above expression, just want to make sure no more weird sign like #%&/() are in the strings. I am wondering if there's any difference between these two regular expression? Did the beginning and ending sign matter? Will it affe...
beginning and ending sign in regular expression in python
0.197375
0
0
84
8,507,081
2011-12-14T15:27:00.000
1
0
1
0
python,regex
8,507,260
3
true
0
0
The beginning and end sign match the beginning and end of a String. The first will match any String that contains zero or more ocurrences of the class [A-Za-z0-9-_] (basically any string whatsoever...). The second will match an empty String, but not one that contains characters not defined in [A-Za-z0-9-_]
3
0
0
'[A-Za-z0-9-_]*' '^[A-Za-z0-9-_]*$' I want to check if a string only contains the sign in the above expression, just want to make sure no more weird sign like #%&/() are in the strings. I am wondering if there's any difference between these two regular expression? Did the beginning and ending sign matter? Will it affe...
beginning and ending sign in regular expression in python
1.2
0
0
84
8,507,081
2011-12-14T15:27:00.000
0
0
1
0
python,regex
8,507,252
3
false
0
0
Yes it will. A regex can match anywhere in its input. # will match in your first regex.
3
0
0
'[A-Za-z0-9-_]*' '^[A-Za-z0-9-_]*$' I want to check if a string only contains the sign in the above expression, just want to make sure no more weird sign like #%&/() are in the strings. I am wondering if there's any difference between these two regular expression? Did the beginning and ending sign matter? Will it affe...
beginning and ending sign in regular expression in python
0
0
0
84
8,508,167
2011-12-14T16:40:00.000
0
0
1
0
python,string,text-files
8,508,385
3
false
0
0
I had the same problem when I first was learning Python, coming from Perl. Perl will "do what you mean" (or at least what it thinks you mean), and automatically convert something that looks like a number into a number when you try to use it like a number. (I'm generalizing, but you get the idea). The Python philosophy ...
1
0
0
I'm learning python and now I'm having some problems with reading and analyzing txt files. I want to open in python a .txt file that contains many lines and in each line I have one fruit and it's price. I would like to know how to make python recognize their prices as a number (since it recognizes as a string when I us...
using data from a txt file in python
0
0
0
4,297
8,508,346
2011-12-14T16:51:00.000
2
0
0
1
python,google-app-engine
8,513,090
1
true
1
0
I assume it's so slow because you're doing a query for each user you're looking up. You can avoid the need to do this with good use of key names. For each user in your database, insert entities with their key name set to the unique identifier for the social network. These can be the same entities you're already using, ...
1
2
0
I'm currently implementing a web service providing the social features of a game. One of this game feature is the ability to manage a friends list. The friends the user can add depends on the contacts he's having on an external social network of his choice (currently Facebook or Twitter). The current behavior of the sy...
Best approach to filter a large dataset depending on the datastore
1.2
0
0
183
8,508,457
2011-12-14T16:57:00.000
2
1
0
0
php,python,process
8,508,562
2
true
0
0
When I face this kind of problem, I usually do a Python daemon that does the whole job, and have the PHP just sending messages to this Python daemon. These messages can be something very simple, like a bunch of files in a directory that is constantly checked, or registers in database. How good this implmeentation is wo...
1
1
0
I'm making a scan server for my company, which will be used to launch scans from tools such as nessus, nmap, nikto etc. I've written the pages in php, so once the scan is launched it backgrounds the process and returns the PID. Part of the design spec is that once a scan has finished, the results are then emailed to th...
How to perform an action when a process has finished, whilst there are multiple processes are running
1.2
0
0
95
8,513,821
2011-12-15T00:56:00.000
0
0
1
0
python,graphics
8,513,902
1
false
0
1
Since you're going to be bouncing off these boundaries, use a range of values to indicate the angle of the surface rather than just 0 or 1. Keep the array the same way you're storing the image pixels.
1
0
0
What is the fastest or most efficient way of maintaining some sort of array for pixels on a screen in Python ? I don't want to use game libraries, just a simple array as I already have parts of it done without any libraries. I'm developing a program which moving random stuff around the screen and i need to know whether...
Speedy lookups from some kind of table (for graphics collisions)
0
0
0
57
8,513,998
2011-12-15T01:24:00.000
0
1
0
0
c++,python,ruby,robotics,panda3d
48,337,393
2
false
1
0
I would suggest you to go for ROS(gazebo) and write your nodes in C++ or python. You can follow Lentin Joseph's book on Learning Robotics Using Python. It helps you in building autonomous bots with ROS and OpenCV.
2
2
0
The title makes it obvious, is this a good idea? I've been looking for a robotics simulator in languages i know (i know ruby best, then c++, then python -- want to strengthen here--, forget about javascript, but i know it). i found something called pyro, but it probably doesn't fit my needs (listed below). In my la...
Panda3d Robotics
0
0
0
867
8,513,998
2011-12-15T01:24:00.000
0
1
0
0
c++,python,ruby,robotics,panda3d
10,025,027
2
false
1
0
Panda 3D is a good language to write your own robot system in. It's written by CMU people, so it's very clean and makes a lot of sense. It allows you to import very complex models from Maya or Blender. It supports 3D environments. Although it has its own scripting language for running actions (animations) imported ...
2
2
0
The title makes it obvious, is this a good idea? I've been looking for a robotics simulator in languages i know (i know ruby best, then c++, then python -- want to strengthen here--, forget about javascript, but i know it). i found something called pyro, but it probably doesn't fit my needs (listed below). In my la...
Panda3d Robotics
0
0
0
867
8,522,800
2011-12-15T15:51:00.000
0
0
1
0
python,list,sorting
8,523,192
4
false
0
0
If you go further down the page Mr. White linked to, you'll see how you can specify an arbitrary function to compute your sort key (using the handy cmp_to_key function provided).
1
3
1
Say I have a list in the form [[x,y,z], [x,y,z] etc...] etc where each grouping represents a random point. I want to order my points by the z coordinate, then within each grouping of z's, sort them by x coordinate. Is this possible?
Sorting a Python list by third element, then by first element, etc?
0
0
0
3,538
8,525,386
2011-12-15T19:16:00.000
1
0
1
0
python,comments
8,525,414
2
false
0
0
It's a matter of preference. I would say it's more common to see double quotes with triple-quoted strings, especially when they're used as docstrings, but there's no functional difference between the two.
1
3
0
It seems like you can use both '''comments...''' and """comments...""" for multi-line comments. Is there any substantive difference between the two, or is it just a matter of preference?
Comment conventions in python
0.099668
0
0
732
8,528,001
2011-12-15T23:22:00.000
2
0
1
0
python
8,528,030
4
false
0
0
You can look at the shelve module. It uses pickle under the hood, and allows you to create a key-value look up that persists between launches. Additionally, the json module with dump and load methods would probably work pretty well as well.
1
2
0
I'm looking for a flat-file, portable key-value store in Python. I'll be using strings for keys and either strings or lists for values. I looked at ZODB but I'd like something which is more widely used and is more actively developed. Do any of the dmb modules in Python require system libraries or a database server (lik...
Flat file key-value store in python
0.099668
1
0
4,198
8,530,498
2011-12-16T06:16:00.000
2
0
1
0
c#,java,.net,ironpython
8,530,523
5
false
1
0
CLR does support J#. In an utopian world CLR should have supported C# and Java, but Java is a competitor to Microsoft's C# and hence it won't support Java.
2
11
0
Today the Common Language Run Time Supports Many Languages including Iron Python and Iron Ruby. We can similarly can use J Ruby and J Python in Java Run Time environments . If so why the .net frame work common language run time cannot support for Java? Um just curious to know though u may see this as a dumb question .
Why the Common Language Runtime Cannot Support Java
0.07983
0
0
5,362
8,530,498
2011-12-16T06:16:00.000
1
0
1
0
c#,java,.net,ironpython
8,530,557
5
false
1
0
The respective Virtual Machines act on Intermediate Code in a different language (CIL for .net), and IL for .net and JVM are incompatible with each other. The IL and Runtime features sometimes disallow a few things, for example Generics in C# are closely tied to how Generics in the .net Runtime work, while Java has a c...
2
11
0
Today the Common Language Run Time Supports Many Languages including Iron Python and Iron Ruby. We can similarly can use J Ruby and J Python in Java Run Time environments . If so why the .net frame work common language run time cannot support for Java? Um just curious to know though u may see this as a dumb question .
Why the Common Language Runtime Cannot Support Java
0.039979
0
0
5,362
8,532,369
2011-12-16T09:48:00.000
2
0
1
1
python,stdout,pip,distutils
8,533,282
1
false
0
0
Don't do that. If it is absolutely necessary to have information from the user during the install, ask for an environment variable to be set, and fail if it is not set. Better yet, require a plain text configure file to run your module - and set it with default values during the install Don't try to make an interactive...
1
1
0
I've created a tar.gz of a package that includes a setup.py file. setup.py uses the setup() function provided in distutils.core. I want to prompt the user when they run "pip install .tar.gz". Unfortunately, it looks like pip redirects all stdout and stderr of the "python setup.py install" command through a special log ...
Prompting user on package install "pip install "
0.379949
0
0
1,415
8,539,024
2011-12-16T19:14:00.000
0
0
1
1
python,exec,execute
8,540,114
2
false
0
0
Since you're downloading another Python script, you could try using exec to run it. In 2.x there is a helper function execfile for this sort of thing (which wraps the use of the exec keyword; in 3.x you must read the file and pass the resulting string to exec (which is now a function, if I'm reading correctly). You mus...
1
1
0
Is it possible to have one script call another and then exit (don't know if I'm putting this right), leaving the other script running? Specifically I want an update script to download installer.py and then run it. Since installer.py overwrites the update script I can't just do a subprocess.call() since it will fail at ...
How to switch execution to a new script in Python?
0
0
0
118
8,539,146
2011-12-16T19:24:00.000
1
0
0
1
python,macos,psycopg2
8,541,671
2
true
0
0
The best way to solve this is to use virtualenv. When you create a virtual environment, you have the option (-p) of specifying which Python executable you want. Once you're in the virtualenv, you don't have to worry about it at all, and all your regular commands (including pip) will refer to the proper Python executa...
1
2
0
I had a lot of problems getting geoDjango installed on mac os x snow leopard. After the dust settled, I realized that the system install of python (2.6) was on the recieivng end of psycopg2 Python 2.7 is on the system path. And when I invoke python in the terminal, python 2.7 is the one the is fired up. But if I do an ...
Problems juggling system python and python 27 on Mac Snow Leopard
1.2
0
0
335
8,541,956
2011-12-17T01:34:00.000
0
0
0
0
python,django,django-admin,django-views,django-1.2
8,549,564
9
false
1
0
if you create a custom view overiding the admin view you should be able to take the queryset along with the current page information and slice the data to create a total appropriate to the current page. if you want a true total than I still see a custom overridden admin view as the option you are looking for.
1
38
0
I'm using the standard django admin module to display a list of rows. One of the columns is a numerical field. I'd like to display an extra 'totals' row that has most of the columns as blank, except for the numerical column, which should be the total for all of the objects. Is there a simple way to do this within the a...
django-admin: Add extra row with totals
0
0
0
21,372
8,545,492
2011-12-17T14:48:00.000
0
0
1
0
python
8,545,533
7
false
0
0
Easiest way is to split data into two char arrays and then loop through comparing the letters and return the index when the two chars do not equal each other. This method will work fine as long as both strings are equal in length.
1
22
0
I have two strings of equal length, how can I find all the locations where the strings are different? For example, "HELPMEPLZ" and "HELPNEPLX" are different at positions 4 and 8.
Find the position of difference between two strings
0
0
0
49,782
8,547,226
2011-12-17T19:07:00.000
32
0
0
0
java,python,django,model-view-controller,spring-mvc
8,547,784
2
true
1
0
From the perspective of developing Web applications, there's only the big difference in the approach towards the architecture of your applications. Django tends to impose a lot of constraints and depends heavily on a fixed set of solutions that are provided internally. What you get from that are conventions and a strea...
2
25
0
I would like to ask the masters out there as what are the main differences between java spring mvc and django? and also..which one is preferred most?
just curious to know the difference between spring mvc vs django
1.2
0
0
27,043
8,547,226
2011-12-17T19:07:00.000
11
0
0
0
java,python,django,model-view-controller,spring-mvc
8,547,598
2
false
1
0
Spring has its own web MVC framework, but it's much more: A dependency injection/inversion of control factory Aspect oriented programming. Modules for persistence, remoting, and other features. Django is a Python web MVC framework for creating browser UI CRUD applications. I would say that Grails, a Ruby on Rails-li...
2
25
0
I would like to ask the masters out there as what are the main differences between java spring mvc and django? and also..which one is preferred most?
just curious to know the difference between spring mvc vs django
1
0
0
27,043
8,548,628
2011-12-17T23:15:00.000
1
0
0
0
python,latitude-longitude,pyephem
8,548,978
1
true
0
0
They're in geocentric coordinates.
1
3
0
The documentation says that if pyEpehm is given a TLE and a time it will return the following. However, I'm having no luck converting the returned 'sublat' and 'sublon' to ECEF XYZ and back to LLA coordinates to verify. When I convert back the longitude is preserved but the latitude is off by about ~20 degrees for diff...
Is pyEphem 'sublat' and 'sublong' given in Geocentric or Geodetic?
1.2
0
0
800
8,549,259
2011-12-18T01:41:00.000
0
1
0
0
java,python,mobile,gsm,modem
8,605,549
2
false
1
0
Almost all modems and (phones which support tethering to your PC) can do this. All modems are equally good at it.There are no starter's modems. Just go through the AT commands specific to your applications and thats it.
1
2
0
I want to use a program written in a high level language like Java or Python to talk to a GSM Modem. I want to be able to tell the modem what number to call and when to call it. I also want to be able to read and send text messages. I do NOT need to handle voice transmission in either direction of the call. I'd apprec...
Programming a GSM phone/modem to make phone calls
0
0
0
4,955
8,549,326
2011-12-18T01:59:00.000
0
0
0
0
python,sqlite,sqlalchemy
8,549,565
2
false
0
0
Whenever you set a variable in Python you are instantiating an object. This means you are allocating memory for it. When you query sqlite you are simply reading information off the disk into memory. sqlalchemy is simply an abstraction. You read the data from disk into memory in the same way, by querying the database...
2
2
0
I'm user of a Python application that has poorly indexed tables and was wondering if it's possible to improve performance by converting the SQLite database into an in-memory database upon application startup. My thinking is that it would minimize the issue of full table scans, especially since SQLite might be creating ...
Is it possible to read a SQLite database into memory with SQLAlchemy?
0
1
0
1,450
8,549,326
2011-12-18T01:59:00.000
1
0
0
0
python,sqlite,sqlalchemy
10,002,601
2
false
0
0
At the start of the program, move the database file to a ramdisk, point SQLAlchemy to it and do your processing, and then move the SQLite file back to non-volatile storage. It's not a great solution, but it'll help you determine whether caching your database in memory is worthwhile.
2
2
0
I'm user of a Python application that has poorly indexed tables and was wondering if it's possible to improve performance by converting the SQLite database into an in-memory database upon application startup. My thinking is that it would minimize the issue of full table scans, especially since SQLite might be creating ...
Is it possible to read a SQLite database into memory with SQLAlchemy?
0.099668
1
0
1,450
8,550,193
2011-12-18T06:21:00.000
1
1
0
0
python,security
8,550,234
4
false
0
0
Any chance you could not store the information on disk at all? I think that's always the most secure approach, if you can manage it. Can you check the credentials and then discard that information? You can always encrypt the information if that doesn't work, but the decryption mechanism and key would probably have to...
2
4
0
I am writing a desktop application in Python. This application requires the user to input their GMail email and password (however an account must be created specifically for this app, so it's not their personal (read: important) GMail account). I was wondering what would be the best way to store those login credentials...
Where to store user credentials in a Python desktop application?
0.049958
0
0
1,583
8,550,193
2011-12-18T06:21:00.000
0
1
0
0
python,security
8,550,200
4
false
0
0
Use the platform's native configuration storage mechanism (registry, GConf, plist).
2
4
0
I am writing a desktop application in Python. This application requires the user to input their GMail email and password (however an account must be created specifically for this app, so it's not their personal (read: important) GMail account). I was wondering what would be the best way to store those login credentials...
Where to store user credentials in a Python desktop application?
0
0
0
1,583
8,551,735
2011-12-18T12:36:00.000
1
1
1
0
python,ide,sublimetext2,sublimetext
62,906,919
16
false
0
0
seems the Ctrl+Break doesn't work on me, neither the Preference - User... use keys, Alt → t → c
4
315
0
I want to set up a complete Python IDE in Sublime Text 2. I want to know how to run the Python code from within the editor. Is it done using build system? How do I do it ?
How do I run Python code from Sublime Text 2?
0.012499
0
0
582,824
8,551,735
2011-12-18T12:36:00.000
5
1
1
0
python,ide,sublimetext2,sublimetext
40,689,778
16
false
0
0
[ This applies to ST3 (Win), not sure about ST2 ] To have the output visible in Sublime as another file (+ one for errors), do this: Create a new build system: Tools > Build Systems > New Build System... Use the following configuration: { "cmd": ["python.exe", "$file", "1>", "$file_name.__STDOUT__.txt",...
4
315
0
I want to set up a complete Python IDE in Sublime Text 2. I want to know how to run the Python code from within the editor. Is it done using build system? How do I do it ?
How do I run Python code from Sublime Text 2?
0.062419
0
0
582,824
8,551,735
2011-12-18T12:36:00.000
0
1
1
0
python,ide,sublimetext2,sublimetext
10,363,165
16
false
0
0
I had the same problem. You probably haven't saved the file yet. Make sure to save your code with .py extension and it should work.
4
315
0
I want to set up a complete Python IDE in Sublime Text 2. I want to know how to run the Python code from within the editor. Is it done using build system? How do I do it ?
How do I run Python code from Sublime Text 2?
0
0
0
582,824
8,551,735
2011-12-18T12:36:00.000
0
1
1
0
python,ide,sublimetext2,sublimetext
8,552,005
16
false
0
0
You can access the Python console via “View/Show console” or Ctrl+`.
4
315
0
I want to set up a complete Python IDE in Sublime Text 2. I want to know how to run the Python code from within the editor. Is it done using build system? How do I do it ?
How do I run Python code from Sublime Text 2?
0
0
0
582,824
8,554,168
2011-12-18T19:22:00.000
1
0
0
0
python,audio,real-time,microcontroller,processing
8,595,071
2
false
1
0
The above answer is a good one, PD is very flexible, but if you want something more code oriented and better suited to mixing with MCUs, processing might be better. Another good way to do it would be to use Csound with the Csound Python API. Csound has a steep learning curve, but tons tons of audio analysis functionali...
1
0
0
I am not quite sure if I should ask this question here. I want to make an art project. I want to use voice as an input, and an image as output. The image changes accordingly to the sound. How can I realise this? Because I need realtime or a delay under 50 ms. At first I thougt it would be better to use a micro control...
Realtime art project --- input: sound --- output: image (better title?)
0.099668
0
0
334
8,554,562
2011-12-18T20:27:00.000
9
0
0
0
python,ruby-on-rails,ruby,r,r-exams
8,554,862
4
false
1
0
The way you have worded your question it's not really clear why you have to mark the students' work online. Especially since you say that you generate assignments using sweave. If you use R to generate the (randomised) questions, then you really have to use R to mark them (or output the data set). For my courses, I use...
2
13
0
I teach undergraduate statistics, and am interested in administering personalized online assignments. I have already solved one portion of the puzzle, the generation of multiple version of a question using latex/markdown + knitr/sweave, using seeds. I am now interested in developing a web-based system, that would use ...
Personalizing Online Assignments for a Statistics Class
1
0
0
656
8,554,562
2011-12-18T20:27:00.000
2
0
0
0
python,ruby-on-rails,ruby,r,r-exams
8,564,007
4
false
1
0
I found one possible solution that might work using the RGoogleDocs package. I am posting this as an answer only because it is long. I am still interested in better approaches, and hence will keep the question open. Here is the gist of the idea, which is still untested. Create multiple versions of each assignment usin...
2
13
0
I teach undergraduate statistics, and am interested in administering personalized online assignments. I have already solved one portion of the puzzle, the generation of multiple version of a question using latex/markdown + knitr/sweave, using seeds. I am now interested in developing a web-based system, that would use ...
Personalizing Online Assignments for a Statistics Class
0.099668
0
0
656
8,556,589
2011-12-19T02:39:00.000
2
0
0
0
python,opengl,scale,resolution,pyglet
8,559,413
2
false
0
1
Clarification: I am thinking along the lines of the resolution settings in most games. The window stays in full screen at the same size, but the scale changes. No, the window does change the size, because the screen resolution is changed, and the window follows. However what you intend to do it perfectly possible: Fir...
1
2
0
I am using the pyglet (OpenGL) library and I want to be able to change the virtual resolution without changing the size of the window. For example a 2x2 box would be drawn as 4x4 pixels on the screen. I know I can find everything that is being draw and scale it individually, but this would probably be costly. I could n...
Scale Resolution in Pyglet
0.197375
0
0
2,504
8,556,752
2011-12-19T03:13:00.000
1
0
1
0
wxpython,wxwidgets
8,556,812
2
true
0
1
.GetItems() This function can get all elements in your Listbox as a list.
1
2
0
I am using wxpython and I would like to get all the elements in the listbox and returned in a list. (Almost like the Oposite of the "Set" function) Example: Listbox has Dog Cat Fun The function should return ["Dog","Cat","Fun"] Thanks
How to get listbox elements in a list? wxpython
1.2
0
0
603
8,559,398
2011-12-19T09:37:00.000
2
0
1
0
python,regex
8,559,424
3
false
0
0
Use (?<=#)(\w+)(?=#) and capture the first group. You can even cycle through a string which contains several embedded strings and it will work. This uses both a positive lookbehind and positive lookahead.
1
1
0
Given a string #abcde#jfdkjfd, how can I get the string between two # ? And I also want that if no # pair(means no # or only one #), the function will return None.
python string parsing using regular expression
0.132549
0
0
4,295
8,560,684
2011-12-19T11:32:00.000
2
1
0
0
python,api,email,statistics
8,560,732
2
true
0
0
Your best bet is to use a programming language that has a simple IMAP library which you can use to connect to your account. Then you will have to write a script that can do your statistics. Since you asked for an API I assume that you know how to use a scripting language like PHP, Python or Ruby which all have an IMAP...
1
0
0
I need a tool to access my email inbox via some convenient interface. For example, I need to get the timestamps of letters from some address. I need that data to build some mailing statistics. What can I use to do that? Maybe there is an API in Thunderbird or something like that. I work under Windows. Thank you in adva...
Mail inbox analyzer
1.2
0
0
411
8,561,277
2011-12-19T12:20:00.000
1
0
1
0
python
8,561,336
3
false
0
0
Many times I saw use of Ellipsis instead of None to mean "the default value" or so.. Anyways, I'm not sure I fully understood your question: Which kind of objects are you comparing? dicts? Can you post some code? I don't see the point of "setting default values to make sure they are defined and can be compared". Why d...
1
2
0
Part of my code relies on a comparison between two items, and it may end up comparing against a variable that doesn't exist. As such I will go through and put in filler variable values for the sets to make sure they both are defined and can be compared. However, if I add a filler value I don't want it to be possible to...
How can you define a variable that will never be matched in Python?
0.066568
0
0
96
8,562,144
2011-12-19T13:36:00.000
2
0
1
0
python
8,562,172
3
false
0
0
.pyc files are compiled python modules created by the python interpreter; they have nothing at all to do with vim. You can avoid them by invoking python with the -B flag or by setting the PYTHONDONTWRITEBYTECODE environment variable.
2
1
0
The original file name is view.py, forms.py but python automatically adds/saves some file named view.pyc, forms.pyc I want to delete those extra view.pyc and forms.pyc files. Why do I get those .pyc files? Or how can I tell python not to create those extra files with .pyc extension?
How can I remove backup files, I don't need backup files
0.132549
0
0
444
8,562,144
2011-12-19T13:36:00.000
1
0
1
0
python
8,562,159
3
false
0
0
it's not vim, python compiles your py into that format to make things go faster.
2
1
0
The original file name is view.py, forms.py but python automatically adds/saves some file named view.pyc, forms.pyc I want to delete those extra view.pyc and forms.pyc files. Why do I get those .pyc files? Or how can I tell python not to create those extra files with .pyc extension?
How can I remove backup files, I don't need backup files
0.066568
0
0
444
8,562,189
2011-12-19T13:41:00.000
2
1
0
0
python,eclipse-cdt
8,587,142
2
false
0
0
You can just open your python file in the C/C++ perspective and get full syntax highlighting and auto completion. If that does not work for you, then perhaps you don't have PyDev installed. Find it and install it using Help > Eclipse Marketplace. If that still does not work for you (if you double-click it the file is ...
1
1
0
I use eclipse (cdt) for c++ projects. It contains some test scripts in python. Is there anyway I could get syntax highlighting and auto completion(if possible) when viewing a python script? Or should I load the complete python perspective?
How to edit a python file in eclipse when in C++ perspective?
0.197375
0
0
2,419
8,566,399
2011-12-19T19:28:00.000
1
0
0
1
python,django,google-app-engine,web2py
8,566,440
4
false
1
0
Why both Create Django user from Google users. you will be able to adapt your system user with other system next
1
1
0
Which of these would you pick for a B2B app (targeting small/med-small businesses) built on GAE with python: Google Accounts Custom Users with Django Custom Users with Web2Py I'm very tempted to go the Google Accounts route as it's very well integrated into GAE and takes care of everything from user creation to sessi...
B2B App authentication on GAE - Google Accounts or custom user base (Django or Web2Py)?
0.049958
0
0
388
8,566,559
2011-12-19T19:41:00.000
1
0
0
0
python,django,models
8,567,426
3
false
1
0
Do you really need that method that returns all instances of model1 that have that foreign key? You can use the related field manager from model2 to achieve that. Model2.field_in_model1_set.all() ?
1
7
0
For example, I have 2 models: Model1 and Model2. Model1 has field ForeignKey(Model2). Model2 has method, that returns all instances of Model1 which has this instance of Model2 as ForeignKey. But it doesn't work, because Model2 is defined after Model1 and it knows nothing about Model2. How to solve this problem?
Django models definition ordering
0.066568
0
0
2,130
8,567,171
2011-12-19T20:31:00.000
13
0
0
0
python,url,scrapy,web-crawler
8,620,843
6
false
1
0
There is a function url_query_cleaner in w3lib.url module (used by scrapy itself) to clean urls keeping only a list of allowed arguments.
1
16
0
I am using scrapy to crawl a site which seems to be appending random values to the query string at the end of each URL. This is turning the crawl into a sort of an infinite loop. How do i make scrapy to neglect the query string part of the URL's?
How do I remove a query from a url?
1
0
1
13,148
8,568,175
2011-12-19T22:03:00.000
0
0
1
0
python,windows,python-3.x,registry
8,576,487
3
false
0
0
The recommended way to do this is to create a "restore point", which will make a backup to which you can restore the registry. I don't what the API to do this is, but I'm pretty sure it exists. You can also do it manually, of course, but that is a different issue.
1
4
0
I am trying to create a script to make an edit to the window's registry. As a fall back, I want to create a back up of the registry and save it in the working directory (or some other directory, but that is for later). Is there a way to use the power of python to backup the registry first? So far the only way I have f...
Using a python script to backup Windows Registry to file before editing
0
0
0
1,901
8,569,433
2011-12-20T00:34:00.000
2
0
0
1
python,date,time,controls,daemon
8,569,449
3
false
0
0
cron can easily handle that timing (although 2 entries will be required), so unless you have extreme low-latency requirements it's best to have it invoke the script on demand.
1
1
0
I've run into an issue and am looking for guidance from a few veterans. I've written a program in python that I'd like to run only periodically. I'm going to upload it to my sever, and what I'd like for it to do is to run every Monday through Friday, and every 5 minutes between 9:30 and 4. Basically I've written modul...
Python main control
0.132549
0
0
114
8,569,486
2011-12-20T00:43:00.000
0
1
0
1
python,eclipse,pythonpath
8,658,155
1
false
0
0
You need to configure it inside Eclipse. Now, provided have a shell that has the PYTHONPATH properly setup, you should be able to start Eclipse from it and when adding an interpreter (you may want to remove your currently configured interpreter), it should automatically pick all of the PYTHONPATH you had setup from the...
1
0
0
I'm attempting to get Eclipse + PyDev set up so I don't need to alter the PYTHONPATH from within Eclipse, but rather it will inherit the PYTHONPATH from the .profile document from inside my home directory. Is that possible, or do I need to actually add the PYTHONPATH locations using Eclipse's PYTHONPATH editor? I ask b...
How to make Eclipse inherit $PYTHONPATH on Mac OS X
0
0
0
603
8,569,878
2011-12-20T01:47:00.000
4
0
1
0
python,ncurses,curses
8,570,249
1
true
0
0
I'm guessing you are using a thread to update the upper display while window.getstr() runs in the main thread? If so, the problem is that the curses terminal state is a shared resource that can't be updated from two different threads simultaneously. You need to put the terminal into non-blocking mode, use window.getch(...
1
4
0
I am writing a front end for a server application using the curses module. THe main windows returned by curses is divided into 2 sub-windows. The top half of the screen prints output from the server while the bottom line takes input with window.getstr(). Sometimes when I am entering text and the top half is updating ...
curses in python getstr() while refreshing
1.2
0
0
2,138
8,570,066
2011-12-20T02:21:00.000
5
0
0
1
python,sql,google-app-engine
8,570,245
2
true
1
0
Read-only views (the most common type) are basically queries against one or more tables to present the illusion of new tables. If you took a college-level database course, you probably learned about relational databases, and I'm guessing you're looking for something like relational views. The short answer is No. The GA...
1
2
0
I've been learning python by building a webapp on google app engine over the past five or six months. I also just finished taking a databases class this semester where I learned about views, and their benefits. Is there an equivalent with the GAE datastore using python?
Is there an equivalent of a SQL View in Google App Engine Python?
1.2
1
0
106
8,570,930
2011-12-20T04:47:00.000
5
0
0
0
c#,python,csv,db2
8,573,046
3
true
0
0
The PC/IXF format is fairly complex, and is practically unknown to programs outside of DB2. Writing your own PC/IXF parser just to convert an IXF file directly to some other format might take a while. A faster alternative is to issue an IMPORT command on the DB2 server and specify CREATE INTO instead of INSERT INTO , ...
1
4
0
How do I convert an exported IXF file (using db2 export) to a human-readable format, like CSV or XML? I am comfortable with doing it in Python or .NET C#.
Converting IBM DB2 IXF file to CSV or XML
1.2
0
0
7,121
8,571,366
2011-12-20T05:57:00.000
0
0
0
0
python,pyqt
8,571,839
2
false
0
1
the .py file generated from pyuic is not supposed to be edited by the user, best way it is intended to use is to subclass the class in .py file into your own class and do the necessary changes in your class..
1
0
0
I have .ui, .py and .pyc files generated. Now, when I edit the .py file, how will it reflect changes in the .ui file? How do I connect .the ui and .py files together as QT designer allows only .ui files for running purposes?
Running .py files
0
0
0
227
8,572,636
2011-12-20T08:32:00.000
3
0
1
0
python
8,572,806
2
false
0
0
Sleep method in time module is derived from *nix sleep function (in unistd.h). It's not more thread related, it's a general function for stopping the execution of the program (or script)
2
3
0
Why is the sleep method (for sleeping a thread for some time) stored in the time-module and not in the threading-module (like in java). I mean, is it not much more related to thread?
Why is sleep() in the time-module and not in threading-module?
0.291313
0
0
293
8,572,636
2011-12-20T08:32:00.000
0
0
1
0
python
8,579,529
2
false
0
0
time.sleep pauses the execution of the program/script. As a thread can also be regarded as a second program that can interact with the main thread/program, it also affects threads. Regarding the fact that sleep pauses the thread/program/whatever for a certain time, it is surely not wrong to put it into the time module.
2
3
0
Why is the sleep method (for sleeping a thread for some time) stored in the time-module and not in the threading-module (like in java). I mean, is it not much more related to thread?
Why is sleep() in the time-module and not in threading-module?
0
0
0
293
8,572,830
2011-12-20T08:51:00.000
3
0
0
0
python,django,multithreading,signal-handling
34,890,531
4
false
1
0
I use Python 3.5 and Django 1.8.5 with my project, and I met a similar problem recently. I can easily run my xxx.py code with SIGNAL directly, but it can't be executed on Django as a package just because of the error "signal only works in main thread". Firstly, runserver with --noreload --nothreading is usable but it r...
1
9
0
I am building a django application which depends on a python module where a SIGINT signal handler has been implemented. Assuming I cannot change the module I am dependent from, how can I workaround the "signal only works in main thread" error I get integrating it in Django ? Can I run it on the Django main thread? Is t...
Python:Django: Signal handler and main thread
0.148885
0
0
10,539
8,573,807
2011-12-20T10:12:00.000
2
1
0
0
python
8,573,933
1
true
0
0
I think what you want is a Version Control System such as mercurial, git, etc
1
0
0
I need to test application with testers around the world. I've written class for saving important data to the file. What is the easiest way to send this file (or simple coded string) from tester's pc to me (I suppose to some server, or a special mail?) without interrupting the tester in a Python?
Python - online data collection
1.2
0
0
197
8,575,120
2011-12-20T12:01:00.000
2
0
0
0
python,django,python-imaging-library,django-models
8,575,511
4
true
1
0
And don't forget about jpeg-lib! Without it PIL willn't understand with what format it can works.
2
4
0
I'm using Ubuntu, Django 1.3, Python 2.7. When I try to upload certain types of image, I get this message: Upload a valid image. The file you uploaded was either not an image or a corrupted image. It's happening with PNG and JPG (the formats that I need). tiff and gif (that I don't and will never care about) are work...
Django - Upload a valid image
1.2
0
0
2,152
8,575,120
2011-12-20T12:01:00.000
0
0
0
0
python,django,python-imaging-library,django-models
32,456,956
4
false
1
0
I found that this error can be caused by IntegrityError while saving to db
2
4
0
I'm using Ubuntu, Django 1.3, Python 2.7. When I try to upload certain types of image, I get this message: Upload a valid image. The file you uploaded was either not an image or a corrupted image. It's happening with PNG and JPG (the formats that I need). tiff and gif (that I don't and will never care about) are work...
Django - Upload a valid image
0
0
0
2,152
8,578,284
2011-12-20T16:02:00.000
2
0
1
0
python,locking,singleton
8,578,326
2
false
0
0
If you are running on Linux, /dev/shm is a tmpfs partition on most distros. This means that any files stored there only exist in memory and are not written to disk.
2
1
0
I am looking for methods other than file locking to make sure that only one instance of a Python script is being run at the same time. Is there a way to identify a currently running script in memory? Perhaps by setting a flag of some kind that other instances can read so they can exit?
Can a Python script identify itself in memory at runtime?
0.197375
0
0
161
8,578,284
2011-12-20T16:02:00.000
0
0
1
0
python,locking,singleton
8,581,519
2
false
0
0
If you are running on Windows, use a Mutex. You can use ctypes to call the Win32 APIs: CreateMutex, WaitForSingleObject, and ReleaseMutex.
2
1
0
I am looking for methods other than file locking to make sure that only one instance of a Python script is being run at the same time. Is there a way to identify a currently running script in memory? Perhaps by setting a flag of some kind that other instances can read so they can exit?
Can a Python script identify itself in memory at runtime?
0
0
0
161
8,578,664
2011-12-20T16:29:00.000
0
0
0
1
python,linux,web-services,twisted,chroot
8,579,368
1
false
0
0
If your application is raising an unexpected exception at some point - eg, because some dependency fails to import, because it is not installed in the chroot - then this can cause connections to be unexpectedly closed. It's hard to say with any precision, since you haven't mentioned what kind of connections you have o...
1
0
0
I have a Python script that calls a web service using ZSI with Twisted. On Linux, I'm running this script and it works fine. Now, I want this script to run in a chroot jail which is somewhere in my filesystem. I have added the usr, lib and the etc directories in the jail. When I execute the script from the jail, there ...
Web service call in Python (Twisted + ZSI) not working in chroot jail
0
0
0
280
8,580,223
2011-12-20T18:32:00.000
0
0
1
0
python,licensing
9,105,710
4
false
0
0
A python library imported by your program is certainly not statically linked, the compiled form of it (or the source form for that matter) is not included in .py(co) files created by you. So you are at least as safe importing L/GPLed modules as the nvidia device drivers for linux are being dynamically linked against t...
2
23
0
There is written in LGPL license that I can use not modified, linked code in commercial, closed product without changing license of product to LGPL. What about Python module (*.py) on LGPL license in commercial product? Is it treated as linked code?
Using Python module on LGPL license in commercial product
0
0
0
13,662
8,580,223
2011-12-20T18:32:00.000
10
0
1
0
python,licensing
8,580,271
4
false
0
0
Simple test - can the user swap the LGPL part for their own version?
2
23
0
There is written in LGPL license that I can use not modified, linked code in commercial, closed product without changing license of product to LGPL. What about Python module (*.py) on LGPL license in commercial product? Is it treated as linked code?
Using Python module on LGPL license in commercial product
1
0
0
13,662
8,582,498
2011-12-20T21:57:00.000
1
0
0
0
python,neural-network,pybrain
8,590,831
1
false
0
0
It dependes of what is your objective. If you need an updated NN-model you can perform an online training, i.e. performing a single step of back-propagation with the sample acquired at time $t$ starting from the network you had at time $t-1$. Or maybe you can discard the older samples in order to have a fixed amount of...
1
3
1
I have a pybrain NN up and running, and it seems to be working rather well. Ideally, I would like to train the network and obtain a prediction after each data point (the previous weeks figures, in this case) has been added to the dataset. At the moment I'm doing this by rebuilding the network each time, but it takes an...
Retrain a pybrain neural network after adding to the dataset
0.197375
0
0
985
8,583,301
2011-12-20T23:26:00.000
0
0
1
0
python,math,wolframalpha
8,583,378
5
false
0
0
I don't think you need a library for something like that. You have the user input limited to answers your program understands (strings that make sense) and then do the reverse operation to find if their answer is correct by matching the question, or take the easy way out and have radio button multiple choice. So using...
1
3
0
I'm writing a small app in python which lets users answer math questions. The problem I'm having is checking their answers. Say there's a question like: "Factorise x^2 + 3x +2" There are different ways to answer this; for example: (x + 1)(x + 2) (x + 2)(x + 1) (2 + x)(x + 1) etc. Is there a library which will check i...
Check if two math answers are equivalent
0
0
0
1,512
8,583,541
2011-12-21T00:00:00.000
1
1
0
0
python,django,mod-wsgi,wsgi
8,583,560
1
true
0
0
You don't need a DocumentRoot when using a WSGIScriptAlias /. The answer to your actual question: it's probably best, yeah. I usually set the DocumentRoot to a 404 folder (folder with an index.html that shows a 404 page) and the WSGIScriptAlias to the actual script. Whether the 404 folder is actually useful? No idea, I...
1
0
0
Should my wsgi directory be completely outside of www? DocumentRoot /usr/local/www/ WSGIScriptAlias / /usr/local/wsgi/ Something like that, yeah?
mod_wsgi directory outside of DocumentRoot?
1.2
0
0
508
8,588,126
2011-12-21T10:08:00.000
108
0
0
0
python,postgresql,sqlalchemy,psycopg2
8,588,766
2
true
0
0
SQLAlchemy is a ORM, psycopg2 is a database driver. These are completely different things: SQLAlchemy generates SQL statements and psycopg2 sends SQL statements to the database. SQLAlchemy depends on psycopg2 or other database drivers to communicate with the database! As a rather complex software layer SQLAlchemy does...
2
57
0
I am writing a quick and dirty script which requires interaction with a database (PG). The script is a pragmatic, tactical solution to an existing problem. however, I envisage that the script will evolve over time into a more "refined" system. Given the fact that it is currently being put together very quickly (i.e. I ...
SQLAlchemy or psycopg2?
1.2
1
0
40,683
8,588,126
2011-12-21T10:08:00.000
11
0
0
0
python,postgresql,sqlalchemy,psycopg2
8,589,254
2
false
0
0
To talk with database any one need driver for that. If you are using client like SQL Plus for oracle, MysqlCLI for Mysql then it will direct run the query and that client come with DBServer pack. To communicate from outside with any language like java, c, python, C#... We need driver to for that database. psycopg2 is ...
2
57
0
I am writing a quick and dirty script which requires interaction with a database (PG). The script is a pragmatic, tactical solution to an existing problem. however, I envisage that the script will evolve over time into a more "refined" system. Given the fact that it is currently being put together very quickly (i.e. I ...
SQLAlchemy or psycopg2?
1
1
0
40,683
8,588,506
2011-12-21T10:39:00.000
2
1
0
0
python,ssh,paramiko
8,588,973
1
true
0
0
Got it: Transport.set_keepalive. Use in conjunction with the timeout argument to SSHClient.connect to set the socket timeout.
1
2
0
How can I get paramiko to do the equivalent of setting "TCPKeepAlive yes" in ~/.ssh/config?
Can I enable TCPKeepAlive with paramiko?
1.2
0
1
383