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
4,783,261
2011-01-24T14:38:00.000
0
0
1
0
python,math,factorization
4,783,367
5
false
0
0
If you mean you want to generate ALL the divisors of 510510: Each prime divisor appears just once in the product. Each prime divisor could be used or not used. So think of it as a binary set from 0 to 127 and look at the bits. Iterate through the numbers and if the bit relating to the prime divisor is set, include that...
2
1
0
Having a number e.g. 510510 The prime divisors are: [2, 3, 5, 7, 11, 13, 17] Using the list of primes, what could an efficient way to calculate the non-prime divisors be?
Calculating non-prime divisors from primes
0
0
0
2,404
4,783,261
2011-01-24T14:38:00.000
0
0
1
0
python,math,factorization
4,783,346
5
false
0
0
If D is the set of prime divisors of N and d = |D| than N = \prod_i=1^d(D[i]^p[i]) for some p[i] (where p[i] is a natural number > 0). From this point of view you can use a bit mask to go through all possible combinations of elements from D and generate partial products, which will divide N. And of course go through al...
2
1
0
Having a number e.g. 510510 The prime divisors are: [2, 3, 5, 7, 11, 13, 17] Using the list of primes, what could an efficient way to calculate the non-prime divisors be?
Calculating non-prime divisors from primes
0
0
0
2,404
4,783,308
2011-01-24T14:44:00.000
4
0
0
1
python,console-application,curses,urwid
5,085,080
2
false
0
0
urwid is a very complete UI interface and you can do almost everything. In fact, I'm developing an app using urwid. But, as Paulo Scardine said, dialog is a better choice for a wizard-like app.
2
11
0
I'm currently rewriting a perl console application that was using curses, and planning to implement it in Python. So far I've narrowed my library options to straight curses, urwid, and dialog. The application is basically an installer for an appliance that will accommodate basic configuration (network options, hostname...
Python Console UI Suggestions
0.379949
0
0
1,317
4,783,308
2011-01-24T14:44:00.000
2
0
0
1
python,console-application,curses,urwid
4,783,572
2
false
0
0
Dialog is very easy to use and a good choice for an installer using 'wizard-like' interface.
2
11
0
I'm currently rewriting a perl console application that was using curses, and planning to implement it in Python. So far I've narrowed my library options to straight curses, urwid, and dialog. The application is basically an installer for an appliance that will accommodate basic configuration (network options, hostname...
Python Console UI Suggestions
0.197375
0
0
1,317
4,783,462
2011-01-24T14:59:00.000
1
0
1
0
python,grid,draw
4,784,164
1
true
0
1
tkinter has a canvas widget that is pretty easy to work with. It has primitives for lines and filled polygons and circles and so on. And with the event loop its pretty easy to do simple animations.
1
3
0
I want to draw a Grid World (similar to a table), where cells may contain robots or obstacles. A dot/arrow would do to represent the robot and colouring the cells in black for examples could represent the obstacles. I am not looking for anything complicated, just a simple python library that would help me do this. Any...
How to draw Grid World using Python
1.2
0
0
3,612
4,788,748
2011-01-25T00:22:00.000
0
0
0
0
python,module,import,matplotlib,pydev
52,617,040
3
false
0
0
Right click your project, then go to properties, then click PyDev - Interpreter/Grammar, click "Click here to configure an interpreter not listed". Then select the interpreter you are using, click Install/Uninstall with pip, then enter matplotlib for . Then restart Eclipse and it should work.
3
0
1
I am using Ubuntu 10.04 and have successfully configured PyDev to work with Python and have written a few simple example projects. Now I am trying to incorporate numpy and matplotlib. I have gotten numpy installed and within PyDev I did not need to alter any paths, etc., and after the installation of numpy I was automa...
Unable to import matplotlib in PyDev
0
0
0
3,642
4,788,748
2011-01-25T00:22:00.000
1
0
0
0
python,module,import,matplotlib,pydev
6,766,298
3
false
0
0
I added numpy to the Forced Builtins and worked like charm.
3
0
1
I am using Ubuntu 10.04 and have successfully configured PyDev to work with Python and have written a few simple example projects. Now I am trying to incorporate numpy and matplotlib. I have gotten numpy installed and within PyDev I did not need to alter any paths, etc., and after the installation of numpy I was automa...
Unable to import matplotlib in PyDev
0.066568
0
0
3,642
4,788,748
2011-01-25T00:22:00.000
2
0
0
0
python,module,import,matplotlib,pydev
4,999,217
3
true
0
0
Sounds like the interpreter you setup for Pydev is not pointing to the appropriate version of python (that you've install mpl and np). In the terminal, it's likely the effect of typing python is tantamount to env python; pydev might not be using this interpreter. But, if the pydev interpreter is pointed to the right...
3
0
1
I am using Ubuntu 10.04 and have successfully configured PyDev to work with Python and have written a few simple example projects. Now I am trying to incorporate numpy and matplotlib. I have gotten numpy installed and within PyDev I did not need to alter any paths, etc., and after the installation of numpy I was automa...
Unable to import matplotlib in PyDev
1.2
0
0
3,642
4,789,021
2011-01-25T01:09:00.000
0
0
0
0
python,django,django-authentication
50,211,377
13
false
1
0
User.objects.filter(username='tom', groups__name='admin').exists() That query will inform you user : "tom" whether belong to group "admin " or not
2
179
0
I created a custom group in Django's admin site. In my code, I want to check if a user is in this group. How do I do that?
In Django, how do I check if a user is in a certain group?
0
0
0
149,841
4,789,021
2011-01-25T01:09:00.000
11
0
0
0
python,django,django-authentication
32,197,405
13
false
1
0
If a user belongs to a certain group or not, can be checked in django templates using: {% if group in request.user.groups.all %} "some action" {% endif %}
2
179
0
I created a custom group in Django's admin site. In my code, I want to check if a user is in this group. How do I do that?
In Django, how do I check if a user is in a certain group?
1
0
0
149,841
4,789,318
2011-01-25T02:07:00.000
1
0
0
0
python,machine-learning,nltk,naivebayes,orange
10,869,425
3
false
0
0
NLTK is a toolkit that supports a four state model of natural language processing: Tokenizing: grouping characters as words. This ranges from trivial regex stuff to dealing with contractions like "can't" Tagging. This is applying part-of-speech tags to the tokens (eg "NN" for noun, "VBG" for verb gerund). This is typi...
2
11
1
We need a content classification module. Bayesian classifier seems to be what I am looking for. Should we go for Orange or NLTK ?
Orange vs NLTK for Content Classification in Python
0.066568
0
0
3,710
4,789,318
2011-01-25T02:07:00.000
3
0
0
0
python,machine-learning,nltk,naivebayes,orange
4,789,820
3
false
0
0
I don't know Orange, but +1 for NLTK: I've successively used the classification tools in NLTK to classify text and related meta data. Bayesian is the default but there are other alternatives such as Maximum Entropy. Also being a toolkit, you can customize as you see fit - eg. creating your own features (which is what I...
2
11
1
We need a content classification module. Bayesian classifier seems to be what I am looking for. Should we go for Orange or NLTK ?
Orange vs NLTK for Content Classification in Python
0.197375
0
0
3,710
4,789,397
2011-01-25T02:23:00.000
3
0
0
0
python,xml
4,789,451
2
true
0
0
If your data is only for the use of your Python programs, pickle might be an easier solution.
1
1
0
I am currently writing a non-web program using mostly python and have gotten to the point where I need to create a structure for save and settings files. I decided to use xml over creating my own format but have come into a bit of a barrier when trying to figure out what to use to actually process the xml. I want to k...
xml processing options in python
1.2
0
1
124
4,791,815
2011-01-25T09:35:00.000
5
0
1
0
python,multithreading,ubuntu-9.10
4,794,288
1
false
0
0
Short answer: Just make the def run() end. So, if you are waiting for data from a socket, do it with timeout, then if timeout occur just break the while that you should have, and the thread will be killed. You can check from main thread if a thread is alive with isAlive() method.
1
7
0
I'm writing a multi threaded Python app that makes many TCP connections to servers. Each connection is done on a separate thread. Sometimes the thread hangs for a long time which I don't want. How can I get the thread to kill itself after some given time period? From the main thread how can I determine that the child t...
Python: how can I get a thread to kill itself after a timeout?
0.761594
0
0
8,125
4,792,847
2011-01-25T11:18:00.000
1
0
1
0
javascript,python,jslint,pyflakes
4,793,157
2
false
1
0
In JSLInt there is an 'Assume Rhino' option on JSLint which, when set to true assumes that Rhino is present and, therefore, that the global properties it provides have been defined. I believe that this is 'false' by default. But as for a dependency, no, JSLint not dependent on Rhino. I've not used PyFlakes or PyLint, b...
1
1
0
Is there any such standalone package for Javascript, like PyFlakes for Python? I see there is JsLint, but it looks like it depends on some external things like Rhino. I prefer something basic&compact like PyFlakes, because it shows me 80% of bugs I make and has only 20% (or even less) of complexity of other tools like ...
PyFlakes for Javascript?
0.099668
0
0
439
4,793,234
2011-01-25T12:01:00.000
2
0
1
0
python,signals,pyro
4,816,577
1
true
0
0
Seems the issue here is by default Python sets up a handlers for SIGINT and SIGTERM which raise exceptions. If you therfore receive a signal while doing some Pyro comms, the exception is raised, and off it goes to look for an appropriate except clause, not finishing what it was doing, if you then try and use Pyro again...
1
3
0
I have been using Pyro 3 for a little while now, with great success, but occasionally I have noticed, that when a signal such as SIGHUP or SIGINT arrives while Pyro is doing some remote communications, the process hangs, hence the question, is Pyro signal safe? Thanks in advance.
Is Pyro signal safe?
1.2
0
0
317
4,793,250
2011-01-25T12:03:00.000
-2
0
1
0
python,pyqt4,xmpppy
50,261,727
2
false
0
1
when a python script .py has any error it shows in console but when you run python .exe file it genrates .exe.log file when error accured.so go to your folder and see that there is a .exe.log file is there showing errors.
1
0
0
I have made an application using Python and recently i found that i can use py2exe to make executables for windows. The problem is that a library i am using (xmpppy) produces this error DeprecationWarning: the md5 module is deprecated; use hashlib instead and when i try to run the executable a dialog appears saying t...
PyQt4 - "See the log file for details" error
-0.197375
0
0
974
4,794,707
2011-01-25T14:34:00.000
3
0
0
1
python,eclipse,pydev,twisted.application
4,871,001
1
false
0
0
First off, thank you all so much for your kind and gracious support in this matter! The key to running a twisted application via the PyDev module of Eclipse is to define twistd.py as the Main Module in the Run Configuration. The following steps can be used: These instructions assume you can already run twisted applicat...
1
3
0
I would like to debug a Twisted Application (10.0.0) using the Eclipse (3.5.2) PyDev Module (1.6.4) and Python (2.6.5). To run the application from the command line I would specify the following: c:\python26\python c:\python26\scripts\twistd.py -ny mytwistedapp.py To accomplish this using PyDev I created a new PyDev ...
Running a Twisted Application in PyDev
0.53705
0
0
2,436
4,796,720
2011-01-25T17:21:00.000
6
0
0
0
python,networking
4,796,814
1
true
0
0
urlopen documentation doesn't promise you to escape anything. Use urllib.quote() to escape it yourself.
1
1
0
On Linux, urllib.urlopen("https://www.facebook.com/fql.php?query=SELECT first_name FROM user") will have the spaces automatically quoted and run smoothly. (By the way, the URL is fictional) However on mac, this is not the case. Somehow the URL is not escaped, and an error would be thrown. I have checked both python ver...
Urllib trouble across platforms
1.2
0
1
68
4,798,596
2011-01-25T20:42:00.000
1
0
0
1
python,ethernet,iptables
4,799,871
1
true
0
0
twisted.pair.ethernet will give you a little bit of the parsing, but it doesn't do anything for actually getting the data in the first place, nor putting it back on the network (if you don't filter it out). For that you need to talk to the tuntap system, which Twisted doesn't do anything with.
1
0
0
I need to implement some low-level IP filtering/tracking. Typically I would use iptables for this, but since I am currently using twisted in a few projects I'd consider using it's ethernet library, if it's possible. Actually, I would prefer it (it's easier to deploy than iptables rules). Is it possible to use twisted...
twisted.pair.ethernet vs iptables
1.2
0
0
441
4,798,930
2011-01-25T21:17:00.000
-1
0
1
0
python,macos,python-idle,backslash
30,695,366
5
false
0
0
Everyone i have an excellent solution to this problem. Go to "Terminal": Write Python Now it works because it's like using IDLE just in terminal and in terminal the backslash will work perfectly fine.
4
1
0
I use a Mac and I use Shift + Alt + / when I want to type a \. I'm trying to learn Python and as you can see \ works fine, but not in IDLE. How do I make backslash (\) work in IDLE?
How do I make backslash (\) work in IDLE?
-0.039979
0
0
26,821
4,798,930
2011-01-25T21:17:00.000
0
0
1
0
python,macos,python-idle,backslash
4,799,404
5
false
0
0
Copy-Paste it from notepad. or Use command line python shell.
4
1
0
I use a Mac and I use Shift + Alt + / when I want to type a \. I'm trying to learn Python and as you can see \ works fine, but not in IDLE. How do I make backslash (\) work in IDLE?
How do I make backslash (\) work in IDLE?
0
0
0
26,821
4,798,930
2011-01-25T21:17:00.000
0
0
1
0
python,macos,python-idle,backslash
9,043,964
5
false
0
0
go to idle -> preferences -> General -> default source encoding -> Locale-defined
4
1
0
I use a Mac and I use Shift + Alt + / when I want to type a \. I'm trying to learn Python and as you can see \ works fine, but not in IDLE. How do I make backslash (\) work in IDLE?
How do I make backslash (\) work in IDLE?
0
0
0
26,821
4,798,930
2011-01-25T21:17:00.000
0
0
1
0
python,macos,python-idle,backslash
33,330,252
5
false
0
0
In IDLE, it worked with alt (option) + i.
4
1
0
I use a Mac and I use Shift + Alt + / when I want to type a \. I'm trying to learn Python and as you can see \ works fine, but not in IDLE. How do I make backslash (\) work in IDLE?
How do I make backslash (\) work in IDLE?
0
0
0
26,821
4,799,298
2011-01-25T21:55:00.000
5
0
1
1
python,configuration-files,distribute
4,799,345
2
true
0
0
Since the egg is hard to edit, it doesn't go in the egg. A user-editable configuration file goes in the user's HOME directory or a system-wide directory like /etc/myapp. Your app should search in a number of easy-to-find places. Follow the Linux guidelines for tracking down the .bashrc file for hints on how best to do...
1
1
0
I'm creating a python package, and using distribute to package it as an egg. I'd like to install a user-editable configuration file for each user of my software. What is the best way to accomplish this? I'm using Python 2.6 and am targeting the Windows platform.
How do I install a user-specific configuration file with the distribute python
1.2
0
0
304
4,800,425
2011-01-26T00:39:00.000
3
1
1
0
python
4,800,509
3
false
0
0
I don't think there is anything built in, but if you look up those file formats, you will find that the size is encoded near the beginning of the file. You can use the struct module to parse just enough of the header to work out the size
2
2
0
I'm gathering basic metadata for images - mainly their dimensions, although it'd be nice to get any other available metadata as well. The image formats I'm interested in are png, jpg, and gif. I'm using PIL at the moment, but it occurred to me there may be a simpler way that doesn't involve external dependencies or bi...
Python: Simplest (non-PIL) way to get image metadata (mainly size)
0.197375
0
0
1,574
4,800,425
2011-01-26T00:39:00.000
1
1
1
0
python
4,804,100
3
true
0
0
Answer: No there is not a simpler way than using an external library. If you are only going to care about one and one file format only, then yes. Then it's easy to implement something specific for that. But if you want to be generic, you need to support a lot of file formats, and then you don't want to do all that work...
2
2
0
I'm gathering basic metadata for images - mainly their dimensions, although it'd be nice to get any other available metadata as well. The image formats I'm interested in are png, jpg, and gif. I'm using PIL at the moment, but it occurred to me there may be a simpler way that doesn't involve external dependencies or bi...
Python: Simplest (non-PIL) way to get image metadata (mainly size)
1.2
0
0
1,574
4,800,650
2011-01-26T01:30:00.000
0
0
0
0
python,django
4,800,739
3
false
1
0
You will send the user an automatic error message.. You'd have to look how to over-ride..
1
2
0
This seems like a simple question but I can't seem to find a simple answer. Django seems to give this nifty simple way of limiting access to places using the permission required or login required decorators but I can't see from the Django docs how one would pass an error message (maybe using the messages framework). ...
Django - decorators and error messages
0
0
0
1,700
4,800,858
2011-01-26T02:16:00.000
4
0
1
0
python,data-structures
4,800,884
3
false
0
0
If you have uniform types of numbers & if speed is your primary goal (and you want to use python), use a Numpy array.
1
4
0
If I have a list with say 10 million objects, how do I filter the list quickly. It takes about 4-5 seconds for a complete iteration thru a list comprehension. Are there any efficient data structures or libraries for this in python? Or is python not suited for large sets of data?
Filtering / iterating through very large lists in python
0.26052
0
0
6,918
4,801,216
2011-01-26T03:40:00.000
2
0
0
0
iphone,python,cocoa,restful-authentication,web2py
4,809,129
2
true
1
0
I think you should post it to web2py group on google groups. web2py@googlegroups.com
1
2
0
I want to configure a simple webapplication to support an iphone app to connect with it in RESTFUL ways. Initially have a user login session enabled from the iphone to the web app. I'd like the iphone app to send a NSURL call to the webapp, with user and password and have the webapp respond if the suer exists or not. P...
can web2py support RESTful api calls? if so any pointers on how to build one?I
1.2
0
0
990
4,801,395
2011-01-26T04:24:00.000
0
0
0
0
python,django
4,801,807
4
false
1
0
Create new_settings.py file to contain part of settings.py, and import that file wherever you need it.
1
2
0
How do I do that? split up 2 files?
My settings.py file in Django is getting too long. How do I split it into two?
0
0
0
1,749
4,802,134
2011-01-26T07:10:00.000
0
0
0
0
wxpython,textctrl
4,807,514
1
false
0
1
If all you're doing is showing one file, then all you need is one TextCtrl. I would give the widget the wx.TE_MULTILINE style and add it to a sizer with an EXPAND flag: sizer.Add(myTxtCtrl, 0, wx.EXPAND) Then the user can see the file and you can save the data with a Save button or menu item. The handler for that would...
1
0
0
I am trying to build my first wx application I have a browse button in my panel, the user adds his file. i do some processing on the file. Now i want to show the information in a TextCtrl so that the user may modify it. Then i need to write it in a file. But I dont know how many TextCtrl box is needed before processing...
wxPython: TextCtrl problem
0
0
0
439
4,802,807
2011-01-26T09:09:00.000
7
0
0
1
python,django,celery
4,803,074
1
true
1
0
Have you tried to restart the celery service with --discard parameter ?
1
2
0
I accidently added too many things to the queue, and now it froze. Can't get it to do anything else.
How do I flush everything from Celery?
1.2
0
0
724
4,802,900
2011-01-26T09:20:00.000
0
0
0
0
python,data-structures
4,803,269
2
false
0
0
A database is just some indexes and fancy algorithms wrapped around a single data structure -- a table. You don't have a lot of control about what happens under the hood. I'd try using the built-in Python datastructures.
1
0
0
I'm writing a network scheduling like program in Python 2.6+ in which I have a complex queue requirement: Queue should store packets, should retrieve by timestamp or by packet ID in O(1), should be able to retrieve all the packets below a certain threshold, sort packet by priorities etc. It should insert and delete wit...
Need advice on customized datastructure vs using in-memory DB?
0
1
0
94
4,803,499
2011-01-26T10:30:00.000
1
1
0
0
java,jquery,python,ruby,email
4,803,954
4
true
1
0
Python has modules both for creating and sending emails in the standard library. Don't know about Java or Ruby. For generating HTML I'd use some HTML template language. There are tons of them for Python. Pick one you like.
1
1
0
I would like to ideally set up a user interface for designing emails that include text, html, and images, and would like this interface to output the raw encoded email so I can then pipe it to my mail application, save it in a database, etc.. Are there any libraries that I could look at for generating raw emails, and...
What libraries exist for creating raw multipart emails?
1.2
0
0
220
4,803,651
2011-01-26T10:49:00.000
5
0
1
0
python
4,803,888
2
false
0
0
Actual private methods is an evil. Mark your method as internal by adding a leading underscore. This tells programmers not to use it unless they know what they are doing.
1
0
0
I have a class with two methods A and B. The class will be subclassed. Is there an elegant way to enforce that B() is only ever called on an object of the class from within the A() method? Let's constrain it and say that A() is only called in one place but subclasses implement A() and can optionally call B() within tha...
python: enforce that a class method is only called from within another class method?
0.462117
0
0
1,272
4,806,911
2011-01-26T16:17:00.000
8
0
1
0
python,string,comparison
4,809,303
8
false
0
0
Python and just about every other computer language use the same principles as (I hope) you would use when finding a word in a printed dictionary: (1) Depending on the human language involved, you have a notion of character ordering: 'a' < 'b' < 'c' etc (2) First character has more weight than second character: 'az'...
2
82
0
I'm wondering how Python does string comparison, more specifically how it determines the outcome when a less than < or greater than > operator is used. For instance if I put print('abc' < 'bac') I get True. I understand that it compares corresponding characters in the string, however its unclear as to why there is more...
How are strings compared?
1
0
0
132,841
4,806,911
2011-01-26T16:17:00.000
0
0
1
0
python,string,comparison
69,465,704
8
false
0
0
The comparison uses lexicographical ordering For Python 3: Convert it into Unicode to get its order or number that is being used as "weightage" here For Python 2: Use ASCII to get its order or number that is being used as "weightage" here People already answered it in detail, I am leaving it here for anyone who is in a...
2
82
0
I'm wondering how Python does string comparison, more specifically how it determines the outcome when a less than < or greater than > operator is used. For instance if I put print('abc' < 'bac') I get True. I understand that it compares corresponding characters in the string, however its unclear as to why there is more...
How are strings compared?
0
0
0
132,841
4,807,957
2011-01-26T17:46:00.000
4
0
0
1
python,google-app-engine,expando
4,812,503
1
true
1
0
All properties are automatically indexed for simple queries. Simple queries, in this case, are those that either: Use only equality filters, with no sort orders or inequality filters. Have an inequality filter or sort order on a single field, with no other filters. If you want to do more complex queries - such as one...
1
3
0
The google app engine python sdk offers an Expando type object which can be used for adding dynamic properties to an object that can be persisted to the datastore. The app engine also requires that for any property on which the objects need to be searched or sorted, an index must be created before uploading the app to ...
Automatic indexes for expando properties in the google app engine for python
1.2
0
0
663
4,808,809
2011-01-26T19:08:00.000
1
0
1
1
python,macos,environment-variables,.profile
4,808,924
4
false
0
0
You can also the helper function os.getenv(varname[, value]) which will return the value of environment variable varname, and if it not present will return value which defaults to None
2
3
0
How can I lookup environment variables (e.g. export HG_USER from .profile) using python code in Mac OS X?
How to fetch environment variables in Mac OS X using python?
0.049958
0
0
9,575
4,808,809
2011-01-26T19:08:00.000
11
0
1
1
python,macos,environment-variables,.profile
4,808,824
4
true
0
0
os.environ is a dictionary containing all the environment variables. You need to import os before you can use it. So, for example HG_USER would be accessed by os.environ['HG_USER'].
2
3
0
How can I lookup environment variables (e.g. export HG_USER from .profile) using python code in Mac OS X?
How to fetch environment variables in Mac OS X using python?
1.2
0
0
9,575
4,809,950
2011-01-26T20:58:00.000
1
0
0
1
c++,python,dll,profiling
4,809,972
2
false
0
0
You can't profile code that isn't running- that's the definition of profiling. You will need to build something that can run (an executable file) that links to the DLL and use that.
2
2
0
I have project that creates dlls. These dlls are invoked from python later by special plugin system blue-sky. So in this project it's very hard to build executable file, but I need profiling. Are there any profilers that can work with pure dlls? I've tried Intel Amplifier, Microsoft VS2008 profiler they don't work. I'...
How can I profile pure dll?
0.099668
0
0
1,019
4,809,950
2011-01-26T20:58:00.000
1
0
0
1
c++,python,dll,profiling
4,810,355
2
true
0
0
If your dll is loaded by Python then you need to profile the Python process. With the Microsoft profiler as long as all the .pdb files are present it should resolve symbols within the dll. Another option is to create an executable that loads and calls the functions you're interested in and then profile said executabl...
2
2
0
I have project that creates dlls. These dlls are invoked from python later by special plugin system blue-sky. So in this project it's very hard to build executable file, but I need profiling. Are there any profilers that can work with pure dlls? I've tried Intel Amplifier, Microsoft VS2008 profiler they don't work. I'...
How can I profile pure dll?
1.2
0
0
1,019
4,812,144
2011-01-27T02:35:00.000
0
0
1
0
python,abstract-syntax-tree
4,812,214
2
false
0
0
There doesn't seem to be a way to get an AST except from source code. If you explain why you don't want to re-parse the source files, maybe we can help with that.
1
14
0
Let's say I've already imported a python module in the interpreter. How can I get the abstract syntax tree of the imported module (and any functions and classes within it) within the interpreter? I don't want to have to re-parse the source files. Thanks!
python: get the abstract syntax tree of imported function?
0
0
0
5,830
4,812,323
2011-01-27T03:02:00.000
1
0
0
0
python,design-patterns,user-interface,tkinter
4,812,333
3
false
0
1
Write your own main loop that calls the functions that check for and process GUI events.
2
2
0
I'm using python 3 / tkinter if that matters. In looking at code samples I noticed that the main loop is typically in the GUI part of the code, and the rest of the code provides callbacks for GUI to call when needed. But my simulation runs independently of the user interaction; the UI is there to provide a view, from t...
Can the main loop of a program be moved out of GUI?
0.066568
0
0
816
4,812,323
2011-01-27T03:02:00.000
2
0
0
0
python,design-patterns,user-interface,tkinter
4,812,403
3
true
0
1
Why not seperate your logic and presentation. Write your sim backend to respond to a single text based protcol to receive cmds and send back results, and then just talk to it from your gui program over e.g. unix sockets.
2
2
0
I'm using python 3 / tkinter if that matters. In looking at code samples I noticed that the main loop is typically in the GUI part of the code, and the rest of the code provides callbacks for GUI to call when needed. But my simulation runs independently of the user interaction; the UI is there to provide a view, from t...
Can the main loop of a program be moved out of GUI?
1.2
0
0
816
4,813,238
2011-01-27T06:04:00.000
67
0
0
1
python,subprocess,system
4,813,317
5
false
0
0
subprocess.Popen() is strict super-set of os.system().
1
166
0
What is the difference between subprocess.Popen() and os.system()?
Difference between subprocess.Popen and os.system
1
0
0
139,683
4,815,088
2011-01-27T10:17:00.000
0
1
0
0
python,windows,bluetooth,rssi
4,815,494
3
false
0
1
The _bluetooth module is a part of PyBluez. If you have installed a Windows release of PyBluez, it should work. I don't know enough about Bluetooth to even know what "getting the RSSI without using it" means or why it should be a problem, so can't help you there. :)
1
1
0
I'm using the pyBluez module on Python 2.6 on WindowsXP. I'd like to get the RSSI of other bluetooth devices around. I foudn some code but it makes use of _bluetooth, which I cannto find anywhere for Windows. Is it available / is there another way to circumvent the problem, getting the RSSI without using _bluetooth? Th...
RSSI with pyBluez on WindowsXP
0
0
0
1,917
4,815,384
2011-01-27T10:52:00.000
0
0
0
1
python,macos,dock,cx-freeze
25,462,666
2
false
0
0
My app has some helper command-line tools in one of its frameworks. If the tools are stored in the framework’s executable directory, Mac OS X wants to show them in the Dock. Since the tools run quickly, this appears as a brief flash where all the other Dock icons move to make space for the new icon and then move back. ...
2
0
0
I know you can remove the dock icon for an app by setting LSUIELEMENT = 1. I have an executable created by cx_freeze, which bundles a set of Python scripts into a single executable. How can I remove the dock icon, with or without using AppleScript?
Remove dock icon for shell executable in Mac OS X?
0
0
0
1,221
4,815,384
2011-01-27T10:52:00.000
0
0
0
1
python,macos,dock,cx-freeze
4,815,469
2
false
0
0
Ordinary executables (i.e. command line tools) do not show up in the dock.
2
0
0
I know you can remove the dock icon for an app by setting LSUIELEMENT = 1. I have an executable created by cx_freeze, which bundles a set of Python scripts into a single executable. How can I remove the dock icon, with or without using AppleScript?
Remove dock icon for shell executable in Mac OS X?
0
0
0
1,221
4,815,390
2011-01-27T10:53:00.000
2
0
0
0
python,session,wsgi
4,815,445
2
false
1
0
It's created by the session middle ware. There are no such thing as sessions in http itself. It's usually done by setting a cookie, but can be done in other ways too. So to answer the question of "when" it is created this is typically done by the session middleware, when it gets a request that does not already have a ...
1
2
0
Is there any way to retrieve sessions right from the WSGI (using a middleware)? I know that it depends on your SessionMiddleware but I wonder if there are hints to figure out when a session is created.
Reading session/cookies from WSGI
0.197375
0
0
1,810
4,816,766
2011-01-27T13:15:00.000
0
0
0
0
python,django,zend-framework
4,819,617
3
false
1
0
I love python as a language - but it's not the answer to everything. I know this is throwing mud in a python group, but python has one serious limitation - the rigid source code format. While going through a django tutorial - I noticed that you cannot insert python source code into a template, and that this was pres...
3
2
0
Does anyone have experience using Python in different variaty of applications? A little background - I am a 3D artist in an animation studio. I do programming in PHP and use Zend framework for my personal project. Python has always been a language I wanted to learn because it can be used within many applications our s...
Will learning Django translates well into other applications?
0
0
0
221
4,816,766
2011-01-27T13:15:00.000
0
0
0
0
python,django,zend-framework
4,818,297
3
false
1
0
I found Django a really good way to learn python. There's very little that's quirky, magical or un-pythonic in the framework. A bit of setup and you're away, writing standard python code.
3
2
0
Does anyone have experience using Python in different variaty of applications? A little background - I am a 3D artist in an animation studio. I do programming in PHP and use Zend framework for my personal project. Python has always been a language I wanted to learn because it can be used within many applications our s...
Will learning Django translates well into other applications?
0
0
0
221
4,816,766
2011-01-27T13:15:00.000
0
0
0
0
python,django,zend-framework
4,817,767
3
false
1
0
So if I learn Python with web application and Django in mind, will that limit my Python skill from applying it to other applications? No authenticate against Windows active directory Yes. You may need to customize an Authentication Backend. quick database update via AJAX interaction (drag and drop time line mostly...
3
2
0
Does anyone have experience using Python in different variaty of applications? A little background - I am a 3D artist in an animation studio. I do programming in PHP and use Zend framework for my personal project. Python has always been a language I wanted to learn because it can be used within many applications our s...
Will learning Django translates well into other applications?
0
0
0
221
4,817,726
2011-01-27T14:41:00.000
1
0
1
0
python,object
4,817,747
4
false
0
0
AFAIK objects are deleted by garbage collector in python. You can't force a delete yourself.
3
0
0
If I get the id of an object, how can I delete an object by it's id ?
Delete an object by id in python?
0.049958
0
0
3,699
4,817,726
2011-01-27T14:41:00.000
-2
0
1
0
python,object
4,817,783
4
false
0
0
You can delete objects by calling del() on them. But AFAIK id won't help in that.
3
0
0
If I get the id of an object, how can I delete an object by it's id ?
Delete an object by id in python?
-0.099668
0
0
3,699
4,817,726
2011-01-27T14:41:00.000
0
0
1
0
python,object
4,817,880
4
false
0
0
The id refers to a memory address. You "can't" delete (or free) a memory address, only its references, with the del statement
3
0
0
If I get the id of an object, how can I delete an object by it's id ?
Delete an object by id in python?
0
0
0
3,699
4,818,342
2011-01-27T15:33:00.000
2
0
1
0
python,pdf,ms-word
4,819,159
3
false
0
0
Install a PDF printer driver like CutePDF. Use COM automation to run MS Word; open the file, fill in the data, print the file as a PDF. Alternatively: convert the Word file into a PDF form; use ReportLab to fill in the form. Alternatively: print the Word file to a PDF file; use ReportLab to overlay text on the file.
1
4
0
I need to fill in a document and then try and convert it into a PDF. Any idea how I can do this?
Convert Word doc to PDF - Python
0.132549
0
0
13,293
4,818,779
2011-01-27T16:11:00.000
2
0
1
0
java,c++,python,parsing,compiler-construction
4,818,927
6
false
0
1
You can grab code for the Lua compiler from lua.org, they distribute full source, and you could also get GCC's source code, which is both C and C++ compiling.
2
1
0
I am currently taking a course on Compilers. I don't like the idea of blindly memorising facts without any sort of place to apply them to. I want to learn by hands-on doing. So, I would like to have the complete code of 3-4 compilers, possibly for languages with different syntax rules (python,c, c++, java) while worki...
Good source code for compiler components
0.066568
0
0
1,318
4,818,779
2011-01-27T16:11:00.000
0
0
1
0
java,c++,python,parsing,compiler-construction
4,820,418
6
false
0
1
Your course on compilers should be giving you the pieces that will eventually lead to a full blown compiler. For example, the section on lexical analysis can lead to a component called the Lexer. If you keep an eye open to generics and re-usability, you can turn this into a component that can be used later in your c...
2
1
0
I am currently taking a course on Compilers. I don't like the idea of blindly memorising facts without any sort of place to apply them to. I want to learn by hands-on doing. So, I would like to have the complete code of 3-4 compilers, possibly for languages with different syntax rules (python,c, c++, java) while worki...
Good source code for compiler components
0
0
0
1,318
4,819,111
2011-01-27T16:37:00.000
1
0
1
0
python,metaprogramming,rollback,magic-methods,copy-on-write
4,886,550
2
true
0
0
I've actually implemented two solutions to this question by now, and seeing as there are no other answers, I might as well share one. The easiest solution is to use Copy On Demand. If we have a proxy P targeting object O: P will have a __getattr__ method so that when P.x is attempted, it tries to copy from O.x, storing...
1
2
0
Premise: Given a Python object obj, I want to pass it along to some random function, and, when the function is done, I need the option to reset obj to it's original state. Additionally, no actual changes can be made to the obj as other code may still want to access it's original state. The optimal solution should be q...
Object roll-back, copy-on-write, versioned proxy etc in Python
1.2
0
0
560
4,820,021
2011-01-27T17:58:00.000
2
0
0
0
java,python,android,sockets
4,820,327
1
true
0
0
TCP will combine your writes into one packet if they are written before the packet is sent, meaning the information will be received concatenated. A common solution would be to incorporate an 'opcode' before your data. For example, prefix CHOICE before sending your integer. When you read CHOICE in your python script, y...
1
0
0
Im trying to send multiple data items over a tcp socket from an android client to a python server. The user on the client side can make multiple choices so im using a number sent as a character to differentiate between request types. I have to send the choice and specific data depending on the choice.For the current se...
distinguishable socket input
1.2
0
1
121
4,822,860
2011-01-27T22:48:00.000
-1
0
0
0
python,proxy,urllib2
4,823,009
1
true
0
0
ProxyHandler can use a different proxy for different protocols (HTTP, etc.) but I don't think it will help you. You should be able to write your own class for your needs without much difficulty.
1
0
0
Hello I'm have a task - create script, what will walk in internet and change proxy from list. I'm see in module urllib2: ProxyHandler and HTTPPasswordMgr, but manual is poor. 1. In documentation ProxyHandler get dict with many proxy-server, how to I'm can select from list and use for url_open? 2. HTTPPasswordMgr have m...
How to use multiple proxy in urllib2?
1.2
0
1
1,084
4,823,466
2011-01-28T00:17:00.000
2
0
0
1
python,google-app-engine
14,570,507
3
false
1
0
I had the same problem. Adding python.exe in front of dev_appserver.py solved the problem for me. c:\Programme\Python27\python.exe C:\Programme\Google\AppEngineSDK\google_appengine\dev_appserver.py MoviesBwu\
1
1
0
I'm trying to get a basic GAE tutorial to work with Windows 7. So far I have: Installed python 2.5.4 Installed the current GAE SDK Set my PATH varible to include python and the GAE Created a "hello, world" app with an app.yaml and main.py file as specified. When I call dev_appserver.py . in my app's directory or dev_...
dev_appserver.py doesn't recognize my files
0.132549
0
0
2,131
4,824,575
2011-01-28T03:29:00.000
0
0
1
0
python
4,824,593
2
false
0
0
You should iterate through the directory using the glob module, then using regex find the two groups in the file name and then you can do a shutil.move to rename the files.
1
0
0
I have a set of files which the names follow this pattern: xxx - 001, xxx - 002 ..... xxx - 700 What I would like to do it`s a python script which I can invert the order of the name of the files, doing the xxx - 700 to be the xxx - 0001!
invert filename order script
0
0
0
203
4,824,683
2011-01-28T03:53:00.000
3
0
1
0
python,package,zodb
4,824,783
1
true
0
0
There's no way to tell for sure if the package will work on another Python version, but using older packages on newer Python 2.x's is much much more likely to work than the other way around. One thing to watch out for: if you're installing a Windows kit, it may only install in the version it was meant for, due to regi...
1
4
0
Is there an easy way to tell if a Python package will work if not matched to my Python release? For example, I cannot get PyGreSQL for Python 2.7 on Win (only 2.6) and I can't get ZODB for Win any more recent than Python 2.4. Does the version mismatch guarantee incompatibility, or do I just need to rename the package...
Python Packages Backward Compatibility
1.2
0
0
376
4,825,055
2011-01-28T05:11:00.000
1
1
0
0
python,symbian,pys60
4,825,096
1
true
0
1
Open Application Manager on your Symbian phone, go to settings and select Software installation. Change it from Signed to All. This will allow you to install applications which don't have a certificate, such as the SIS file you just packaged. Also note that PythonForS60 2.0 works only with Python 2.5.
1
1
0
I am trying to create a small application for Symbian mobile phones using Python. Being a beginner i am having some trouble in setting up the environment for development. I installed Symbian3 SDK,PyS60 Application Manager ( for creating the .sis files to be installed on phones) and python 2.5.2 . I created a small hell...
Certificate Error on installing PythonForS60
1.2
0
0
900
4,826,617
2011-01-28T09:27:00.000
0
0
1
0
python
4,826,663
2
false
0
0
Variable number of arguments can be sent as list of args (usually denoted by) *args or as a key value pairs **kwargs. You should note that **kwargs should occur after *args if you are passing both. You can call a method dynamically using using the following syntax getattr(yourobject,'yourfunction')(params,*args,**kwa...
1
2
0
I want to create a method that accepts a variable number of objects and perform some actions(like calling object methods) based on number of other arguments supplied to the method. e.g. I have an object X with a method updateTable() which accepts a,b as arguments. What I want to do is that the common code to update tab...
Method with variable number of objects and a list of other arguments
0
0
0
238
4,826,686
2011-01-28T09:36:00.000
1
1
1
1
python,bash,shell
4,826,733
3
false
0
0
You can use os.system or subprocess.Popen or subprocess.call but when using subprocess methods make sure you use shell=True. And executing it via system call in all these methods is blocking. The python script will complete and then go the next step.
1
5
0
Will it continue the code after it's run? Or will it stop at that line until the script is done?
Inside python code, how do I run a .sh script?
0.066568
0
0
32,061
4,826,896
2011-01-28T09:59:00.000
1
1
0
0
c++,python,optimization,interaction
4,827,083
5
false
0
1
Firstly, just to be pedantic, there are no C++ scripts in normal use. C++ compiles, ultimately, to machine code, and the C++ program is properly referred to as a "program" and not a "script". But to answer your question, you could indeed set up the C++ program to stay in memory, where it listens for connections and sen...
1
1
0
I am trying to optimize the interaction between two scripts I have. Two things I thought of are the c++ program not terminating unless you manually kill it, or generating all info in python before feeding it to c++. Explanation of the problem: What the scripts do: C++ program (not made by me, and I can't program in c++...
Python and C++ script interaction
0.039979
0
0
2,200
4,827,207
2011-01-28T10:32:00.000
5
0
0
0
python,qt,pyqt,qcombobox
8,198,846
5
false
0
1
Both answers posted are correct, however they have a small bug wherein filtering the options in the combobox by typing then clicking a selection doesn't cause an activation signal to fire. You can fix this by placing self.activated[str].emit(self.itemText(index)) in on_completer_activated, on the line after self.setCur...
1
13
0
I need a QCombox which Items are filtered based on the text input. If I set the QCombobox editable, the user can insert text and the QCompleter is automatically created. But the items are not filtered and I don’t want the user to add new Items. Is there any possibility to add this functionality to the QCombobox?
How do I Filter the PyQt QCombobox Items based on the text input?
0.197375
0
0
15,195
4,828,041
2011-01-28T12:09:00.000
4
0
1
0
python
4,828,084
3
false
0
0
Tuples represent arbitrary sequences of values. When you need to describe an empty sequence of values, you can use an empty tuple.
2
22
0
Is there any other purpose (besides being there because it needs to be) the empty tuple may have? Or: what would you use the empty tuple for? If anything. I just can't find an answer (well, a positive answer as in: "yes, there is"), please help me out with getting this question out of my head. "for testing if another t...
Are there any uses of the empty tuple in Python?
0.26052
0
0
14,406
4,828,041
2011-01-28T12:09:00.000
8
0
1
0
python
4,828,076
3
false
0
0
You might want to store the arguments to a function as a tuple, without knowing the structure of the function in advance. If it happens that the function you need to store the parameters for takes no parameters, you will need to store an empty tuple. This is just one among many examples of why it's generally better not...
2
22
0
Is there any other purpose (besides being there because it needs to be) the empty tuple may have? Or: what would you use the empty tuple for? If anything. I just can't find an answer (well, a positive answer as in: "yes, there is"), please help me out with getting this question out of my head. "for testing if another t...
Are there any uses of the empty tuple in Python?
1
0
0
14,406
4,828,238
2011-01-28T12:32:00.000
0
0
0
0
python
4,828,260
3
true
0
0
httplib2 if you wanna make https call. Check out the doc for more info. --Sai
1
0
0
Let's say I want to connect an app I created to a website (SSL) to get values from the content at a certain page. How can I do it?
Connect to a website using Python
1.2
0
1
1,531
4,829,509
2011-01-28T14:49:00.000
0
0
1
0
python,excel
4,872,985
2
false
0
0
I've always done the manipulation of Excel spreadsheets and Word documents with standalone scripts which use COM objects to manipulate the documents. I've never come across a good use case for putting Python into a spreadsheet in place of VBA.
1
2
0
I am new to python and its workings. I have an excel spreadsheet which was got using some VBA's. Now I want to invoke Python to do some of the jobs... My question then is: How can I use python script instead of VBA in an excel spreadsheet? An example of such will be appreciated.
Use of python script instead of VBA in Excel
0
1
0
2,789
4,830,180
2011-01-28T15:51:00.000
0
0
0
0
python,tkinter
4,840,199
3
false
0
1
Tkinter does not support drawing on top of widgets. Your only choice for drawing arrows is to use a canvas. Your only other option is to draw directly on a image that is used by a label or button, but there's no support for that other than to set the value of individual pixels. Your only practical choice is to use a c...
1
0
0
I want to draw arrows (that change size dynamically) within a Label or any other widget. I have these arranged as a grid. How can I do this? Would I need a Canvas? (not used yet ... currently just a grid of labels). I am using Python & Tkinter Gui library.
Python Tkinter: Draw arrows within Label
0
0
0
1,937
4,830,995
2011-01-28T17:07:00.000
3
0
1
0
python,regex
4,831,070
5
false
0
0
This is not a problem regular expressions are meant to solve. Your best bet is to parse out the data into structures first (possibly using regexs to aid in "chunking" the data).
3
0
0
How do I restrict which parts of the text are searched using regular expressions? Given the example below, say I wanted to get the details of customer02. If I use Name:\s*(.+) then obviously I will get 3 results. So I want to restrict it to only search under the details for customer02 and stop when it gets to customer...
Restrict a regex to only search between two points
0.119427
0
0
733
4,830,995
2011-01-28T17:07:00.000
0
0
1
0
python,regex
4,831,039
5
false
0
0
The re module provides no way to limit the range of the match. You can match against a substring if you already know the indexes you want to limit them to.
3
0
0
How do I restrict which parts of the text are searched using regular expressions? Given the example below, say I wanted to get the details of customer02. If I use Name:\s*(.+) then obviously I will get 3 results. So I want to restrict it to only search under the details for customer02 and stop when it gets to customer...
Restrict a regex to only search between two points
0
0
0
733
4,830,995
2011-01-28T17:07:00.000
1
0
1
0
python,regex
4,857,079
5
true
0
0
If you know the specific boundaries to search between and you're looking to get a capture group, why not just do: import re text = "[Customer01]\nName: Mr Smith\nAddress: Somewhere\nTelephone: 01234567489\n[Customer02]\nName: Mr Jones\nAddress: Laandon\nTelephone:\n[Customer03]\nName: Mr Brown\nAddress: Bibble\nTelepho...
3
0
0
How do I restrict which parts of the text are searched using regular expressions? Given the example below, say I wanted to get the details of customer02. If I use Name:\s*(.+) then obviously I will get 3 results. So I want to restrict it to only search under the details for customer02 and stop when it gets to customer...
Restrict a regex to only search between two points
1.2
0
0
733
4,832,478
2011-01-28T19:59:00.000
2
0
1
0
python,debugging,python-3.x
4,834,711
5
true
0
0
Since you can change the contents of regular classes the way you want at any time, there's no need to update references to objects: you just update class's __dict__ with new methods and other attributes. The problem is with references to functions: you can't update a function without changing its identity. You can use...
3
8
0
Is there any debugger that allows Python code to be changed while debugging? In other words: run-time exception occurs, debugger stops, I change the code any way I like, and tell the program to continue. I am aware of the problems with this approach, such that references to functions would still point to the old defini...
changing Python code in the debugger
1.2
0
0
2,354
4,832,478
2011-01-28T19:59:00.000
1
0
1
0
python,debugging,python-3.x
4,835,623
5
false
0
0
Yes, pdb can do this. Although you have to do the editing in another editor, and the changes will be ignored until you restart. But since all you want to do is small changes, this is not a problem. But you can't change the running code (except with reload, see below), as changing the code would mean the code and the st...
3
8
0
Is there any debugger that allows Python code to be changed while debugging? In other words: run-time exception occurs, debugger stops, I change the code any way I like, and tell the program to continue. I am aware of the problems with this approach, such that references to functions would still point to the old defini...
changing Python code in the debugger
0.039979
0
0
2,354
4,832,478
2011-01-28T19:59:00.000
-1
0
1
0
python,debugging,python-3.x
62,288,347
5
false
0
0
name = (input("Enter Name: ")) if name == "e": print ("This word has a letter e") else : print("This word has no letter e")
3
8
0
Is there any debugger that allows Python code to be changed while debugging? In other words: run-time exception occurs, debugger stops, I change the code any way I like, and tell the program to continue. I am aware of the problems with this approach, such that references to functions would still point to the old defini...
changing Python code in the debugger
-0.039979
0
0
2,354
4,833,299
2011-01-28T21:38:00.000
0
0
0
0
python,django,web-services
4,834,228
2
false
1
0
This is what RESTful web services are all about. Your web server does two things. "displays the data". Presumably via HTML web pages. But maybe not. The question is too vague. Collects the data created by your application "that generates a lot of data in time". This is ordinary REST requests, usually using a POST,...
2
0
0
I'm writing two Django applications: one that generates a lot of data in time, and another part that displays it. The app that generate it will run on a machine at my home and the one that displays the data will be a machine on the internet. What do you believe it will be the best way to transfer the data from the appl...
What is the best method to tranfer data to a server from code
0
0
0
79
4,833,299
2011-01-28T21:38:00.000
0
0
0
0
python,django,web-services
4,833,366
2
true
1
0
Setup two databases - one master and one slave. Write on the master and make the slave to sync with the master. This way you will not need to worry when your connection is down.
2
0
0
I'm writing two Django applications: one that generates a lot of data in time, and another part that displays it. The app that generate it will run on a machine at my home and the one that displays the data will be a machine on the internet. What do you believe it will be the best way to transfer the data from the appl...
What is the best method to tranfer data to a server from code
1.2
0
0
79
4,833,458
2011-01-28T21:58:00.000
1
0
1
0
python,exception,multiprocessing
4,833,527
3
false
0
0
You can wrap your worker processes in try/except blocks where the except pushes a message onto a pipe before raising. Of course, polling isn't really worse than this and it's simpler.
1
4
0
I want to create some worker processes and if they crash due to an exception, I would like them to respawn. Aside from the is_alive method in the multiprocessing module, I can't seem to find a way to do this. This would require me to iterate over all the running processes (after a sleep) and check if they are alive. Th...
Python Multiprocessing respawn crashed processes
0.066568
0
0
1,926
4,833,901
2011-01-28T23:04:00.000
1
0
1
0
python
4,838,725
2
false
0
0
Are you sure you need to create a different variable for each point on the grid? If there are lots of points with default value of say 0, don't create an array with a bunch of 0s. Instead, create an empty dictionary D = {}. Store data as D[(x,y)] = anything. Access your data by D.get((x,y), 0). Where D.get(key, defau...
1
2
0
How would i go about making a function to create a certain number of uniquely named variables at runtime, based on initial user input? For instance, user enters dimensions 400 x 400, (x and y), so i would want the function to create 1600 (400 * 400) variables, each to represent every different point on a grid 400 by 40...
Runtime variable creation Python 3.1.2
0.099668
0
0
373
4,834,533
2011-01-29T01:33:00.000
1
0
1
0
python,module,egg
6,228,872
1
false
0
0
Note that you have 2 different site-packages locations; one is /usr/lib/python2.5/site-packages and the other is /usr/local/FOLDER/lib/python2.5/site-packages. The egg in the latter location is being preferred over the egg in the first location when the latter location comes first in your PYTHON_PATH. In iPython, you c...
1
0
0
I've updated a Python egg that is only being used locally. The update proceeded correctly and installed into /usr/lib/python2.5/site-packages/eggName-UpdatedVersionNumber-py2.5.egg However, when I open iPython and try to import the egg, I still get the old version. Running egg_name.__file__ gives me: /usr/local/FOLDE...
How to get iPython to use Updated Egg/Module
0.197375
0
0
593
4,835,484
2011-01-29T06:14:00.000
5
0
1
0
python,function,math
4,835,554
2
false
0
0
Functional equations, in their most general terms, are really really hard. It is no coincidence that pretty much every international mathematics competition features one of them, usually looking about as innocent as the one you've written. The methods of solving them vary from plain induction to infinite-dimensional Ba...
1
11
0
Given: F(F(n)) = n F(F(n + 2) + 2) = n F(0) = 1 where n is a non-negative integer. F(129) = ? How can we solve such kind of functional equations programmatically? My programming language of choice is Python.
Solving functional equations programmatically
0.462117
0
0
1,444
4,835,603
2011-01-29T06:56:00.000
0
0
1
1
python,filesystems
4,835,903
4
false
0
0
If you want to write the code of your own file system from scratch, one way or another you will end up rewriting a library. I have no knowledge of any library implementing an in-memory temporary file system in pure Python. As an alternative, in Linux you can use the tmpfs file system, usually mounted on /dev/shm. You c...
3
2
0
Is there a way to override all file operations in Python? File operations such as 'open', 'os.rename' and 'os.unlink'. I want to create a temporary, in-memory file system without rewriting a library. Does anyone know of a script or a library that has this feature? I want to run a library on Google App Engine and it is ...
Override file operations in Python
0
0
0
1,152
4,835,603
2011-01-29T06:56:00.000
0
0
1
1
python,filesystems
4,835,941
4
false
0
0
I found this which may be close enough to do the job code.google.com/p/pyfilesystem
3
2
0
Is there a way to override all file operations in Python? File operations such as 'open', 'os.rename' and 'os.unlink'. I want to create a temporary, in-memory file system without rewriting a library. Does anyone know of a script or a library that has this feature? I want to run a library on Google App Engine and it is ...
Override file operations in Python
0
0
0
1,152
4,835,603
2011-01-29T06:56:00.000
1
0
1
1
python,filesystems
4,835,828
4
false
0
0
"Override"? That word doesn't really make any sense in that context. You can replace them in various ways, depending on what you want really. Making a in memory file system can be done on most OS's through the operating system, like with tmpfs in most Unices. That's probably a better solution for you.
3
2
0
Is there a way to override all file operations in Python? File operations such as 'open', 'os.rename' and 'os.unlink'. I want to create a temporary, in-memory file system without rewriting a library. Does anyone know of a script or a library that has this feature? I want to run a library on Google App Engine and it is ...
Override file operations in Python
0.049958
0
0
1,152
4,836,375
2011-01-29T10:37:00.000
1
0
1
0
python,python-3.x,python-2.7,python-2.x
55,064,661
9
false
0
0
Python 2.7 wil be around forever. There is too much old code that uses it that no one wants to rewrite. There is already a fork called Tauthon, but we may see others if this pointless deadline gets real.
1
131
0
Is there a known date/timeframe when python 2.7 will not be supported any more in favor of python 3?
End of support for python 2.7?
0.022219
0
0
51,228
4,836,450
2011-01-29T10:49:00.000
1
1
0
1
python
4,851,152
1
false
0
0
Hi I dnt know y the error occurs but when i directed the print statements from my script to another file this error did not come and my script ran successfully Example: Myscript.py > test.log
1
2
0
I am running a Python script which downloads PDF files from the FTP. The script when run manually works perfectly but when i put it in crontab in my ubuntu machine and execute it i get a an error [Errno 32] Broken pipe. Any idea why this happens and how do i handle this?
[Errno 32]Broken pipe in Python Script in Crontab
0.197375
0
0
1,316
4,837,218
2011-01-29T13:55:00.000
3
0
1
0
python,jython
4,837,272
4
false
0
0
a) Python is a programming language. Interpreters of Python code are implemented using other programming languages like C (PyPy even using Python itself to implement one, I believe). b) CPython, aka Classic Python, is the reference implementation and is written in C. Jython is a Python interpreter written in Java. c) U...
2
11
0
Last night I came across the term called Jython which was kind of new to me so I started reading about it only to add more to my confusion about Python in general. I have never really used Python either. So here is what I am confused about. Python is implemented in C - Does that mean that the interpreter was written i...
Some basic clarifications about Python?
0.148885
0
0
299
4,837,218
2011-01-29T13:55:00.000
11
0
1
0
python,jython
4,837,242
4
false
0
0
"Python" is the name of the language itself, not of a particular interpreter implementation, just as "C" is the name of a programming language and not of a particular compiler. "CPython" is an implementation of an interpreter of the Python language written in C. It compiles Python source code to byte code and interpre...
2
11
0
Last night I came across the term called Jython which was kind of new to me so I started reading about it only to add more to my confusion about Python in general. I have never really used Python either. So here is what I am confused about. Python is implemented in C - Does that mean that the interpreter was written i...
Some basic clarifications about Python?
1
0
0
299
4,837,591
2011-01-29T15:11:00.000
0
1
0
0
python,django,web
4,837,665
2
false
1
0
Can You Explain What kind of application you Use? If you use some kind of database with your application then simply run delete query with some specific condition
1
1
0
Is there a simple way or code to delete the account from a user? I want to delete the username, email address, first_name, last_name and the profile-data. I do have two apps Thanks!
Simple way to delete users account?
0
0
0
405
4,838,074
2011-01-29T16:48:00.000
1
0
0
1
python,hadoop,mapreduce
4,839,045
1
false
0
0
Hadoop streaming has to take input from STDIN. I think the confusion you're having is you're trying to write code to do some of the things that Hadoop Streaming is doing for you. I did that when I first started Hadooping. Hadoop streaming can read in multiple files and even multiple zipped files which it then parses, ...
1
1
0
As we need to read in bunch of files to mapper, in non-Hadoop environment, I use os.walk(dir) and file=open(path, mode) to read in each file. However, in Hadoop environment, as I read that HadoopStreaming convert file input to stdin of mapper and conver stdout of reducer to file output, I have a few questions abou...
STDIN or file as mapper input in Hadoop environment?
0.197375
0
0
3,305
4,838,504
2011-01-29T18:04:00.000
7
0
1
0
python,list
4,838,530
6
false
0
0
The items[:100] other mentioned gives you a new list which contains the first 100 items of items. If you want to modify the list in-place, either use items[:] = items[:100] (slice assignment) or while len(items) > 100: items.pop()use del items[100:] as proposed by Ned Batchelder.
1
47
0
If I have a list and want to truncate it so it is no more than 100 items, how do I do this?
How do I truncate a list?
1
0
0
58,602
4,838,528
2011-01-29T18:09:00.000
0
0
0
0
python,orm,werkzeug
4,838,669
3
false
1
0
Is it a problem to use normal DB API, issue regular SQL queries, etc? cx_Oracle even has connection pooling biolt in to help you manage connections.
1
1
0
How do I use the Werkzeug framework without any ORM like SQLAlchemy? In my case, it's a lot of effort to rewrite all the tables and columns in SQLAlchemy from existing tables & data. How do I query the database and make an object from the database output? In my case now, I use Oracle with cx_Oracle. If you have a solut...
Werkzeug without ORM
0
1
0
445
4,839,597
2011-01-29T21:36:00.000
3
1
1
0
python,string,search,large-files
4,840,359
3
true
0
0
Greg's answer is good if you want to match on individual words. If you want to match on substrings you'll need something a bit more complicated, like a suffix tree (http://en.wikipedia.org/wiki/Suffix_tree). Once constructed, a suffix tree can efficiently answer queries for arbitrary substrings, so in your example it...
3
6
0
I downloaded the Wikipedia article titles file which contains the name of every Wikipedia article. I need to search for all the article titles that may be a possible match. For example, I might have the word "hockey", but the Wikipedia article for hockey that I would want is "Ice_hockey". It should be a case-insensit...
most efficient way to find partial string matches in large file of strings (python)
1.2
0
0
2,903