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
7,536,732
2011-09-24T03:08:00.000
0
0
0
0
python,xmpp,bots,xmpppy
7,558,640
1
false
0
0
Did you try waiting 30 minutes after the network failure? Depending on your network stack's settings, it could take this long to detect. However, if you're not periodically sending on the socket, you may never detect the outage. This is why many XMPP stacks periodically send a single space character, using an algori...
1
0
0
I am using xmpppy libary to write a XMPP IM robot. I want to act on disconnects, but I don't know how to detect disconnects. This could happen if your Jabber server crashes or if you have lost your internet connection. I found the callback, RegisterDisconnectHandler(self, DisconnectHandler), but it didn't work for the ...
A script im robot with xmpppy of python, how to detect network failure?
0
0
1
392
7,536,874
2011-09-24T03:42:00.000
0
0
1
0
python,deployment,packaging
7,538,321
1
true
0
0
I would include a custom script (bin/ command) which will poke the users' .hgrc and others. Doing it without the user consent would be rude. User story Install package: easy_install pkgname and this deploys myproject-init-hg (UNIX executable, can be also written in Python) The installation finished and tells the user ...
1
1
0
In this case, the application consists of one or more Python files, plus a settings.ini file. Now the Python files when being installed need to be installed in ~/.hg (as default) or prompted where the user want them installed. The installation also requires text to be appended to files like hgrc. Is there already a spe...
How would I package and deploy Python application like Mercurial hooks?
1.2
0
0
428
7,537,169
2011-09-24T05:09:00.000
1
0
0
0
python,templates
7,537,437
1
false
1
0
Let's take the simplest approach. Use whatever language and templating engine you want, write a script that generates a config by e.g. a device name. To check, generate a config for a device, download the actual config from that device, run diff. Mail the differences, if any, to people in charge of auditing. The temp...
1
1
0
I am looking for a template engine for pushing and pulling data from configuration files. To be more specific, Cisco router configuration files. My goal has two parts 1) To be able to template my router config and insert unique data (hostname, interface IP's, ...etc) from an authoritative source (Mysql). Afterwards,...
Need recommendation for templating configuration files and auditing
0.197375
0
0
275
7,537,397
2011-09-24T06:17:00.000
0
0
0
0
python,ajax,google-app-engine
7,540,983
2
false
1
0
To make a calculator in a browser that does not involve a page refresh, your best bet is to learn javascript. Searching google or stackoverflow for javascript tutorials will give you lots of options to work from. You don't need to learn python or App Engine to create the calculator. You could use app engine to serve...
1
0
0
I was wondering if it would be possible to write an application using the Google App Engine and Python to create a basic calculator? However, the real question is would it be possible to have the calculator do the math without having to refresh the page? To be more specific, I mean if there is an input box that a formu...
Google App Engine Live Updates (Python)
0
0
0
410
7,538,282
2011-09-24T09:58:00.000
3
0
0
0
python,user-interface,traits,enthought
7,538,648
3
true
0
1
Then Enthought Suite (not just TraitsUI) is the most complete as it provides everything from building the model to showing it including input validation. It plays nicely with numpy and scipy which is nice for a scientific app. Enthought UI can use Qt (via PySide or PyQt) or wx as backends. You can also use Qt directly...
1
2
0
I'm looking for a good cross platform (mac, windows & linux) python GUI framework / library that will make my life easier while writing a data analysis program. Since my data is represented by custom data classes, it would be great if the GUI framework / library could take away the burden of having to code input checks...
python GUI frameworks / libraries suited for data analysis programs
1.2
0
0
1,209
7,538,988
2011-09-24T12:25:00.000
10
0
0
1
python,zeromq
10,846,438
4
false
0
0
The send wont block if you use ZMQ_NOBLOCK, but if you try closing the socket and context, this step would block the program from exiting.. The reason is that the socket waits for any peer so that the outgoing messages are ensured to get queued.. To close the socket immediately and flush the outgoing messages from the ...
1
77
0
I just got started with ZMQ. I am designing an app whose workflow is: one of many clients (who have random PULL addresses) PUSH a request to a server at 5555 the server is forever waiting for client PUSHes. When one comes, a worker process is spawned for that particular request. Yes, worker processes can exist concurr...
zeromq: how to prevent infinite wait?
1
0
1
82,000
7,539,186
2011-09-24T13:02:00.000
2
0
0
0
python,algorithm,r
7,539,484
5
false
0
0
I would tackle this as follows: Divide into 3 equal subsets. Figure out the mean and variance of each subset. From them construct an "unevenness" measure. Compare each pair of elements, if swapping would reduce the "unevenness", swap them. Continue until there are either no more pairs to compare, or the total uneven...
2
5
1
For the purpose of conducting a psychological experiment I have to divide a set of pictures (240) described by 4 features (real numbers) into 3 subsets with equal number of elements in each subset (240/3 = 80) in such a way that all subsets are approximately balanced with respect to these features (in terms of mean and...
Divide set into subsets with equal number of elements
0.07983
0
0
9,742
7,539,186
2011-09-24T13:02:00.000
1
0
0
0
python,algorithm,r
7,548,438
5
false
0
0
In case you are still interested in the exhaustive search question. You have 240 choose 80 possibilities to choose the first set and then another 160 choose 80 for the second set, at which point the third set is fixed. In total, this gives you: 120554865392512357302183080835497490140793598233424724482217950647 * 920451...
2
5
1
For the purpose of conducting a psychological experiment I have to divide a set of pictures (240) described by 4 features (real numbers) into 3 subsets with equal number of elements in each subset (240/3 = 80) in such a way that all subsets are approximately balanced with respect to these features (in terms of mean and...
Divide set into subsets with equal number of elements
0.039979
0
0
9,742
7,540,147
2011-09-24T16:07:00.000
0
0
0
0
python,django,amazon-web-services,cdn,fabric
7,540,281
4
false
1
0
Seems to me the last part (change all templates and python code to use the new names) is easy. Store the current style "version number" in your settings. Make sure this version number is passed to your templates using the template context. Then, use that when rendering the templates to select the real URL to static ...
1
3
0
[I'm using AWS but I think this question is relevant to all CDNs] I'm looking to seamless deploy my Django server to the AWS cloud. All static content (e.g. images, javascript, etc.) go to the Amazon Cloudfront CDN. The problem is that I'm trying to make the upgrade as "atomic" as possible, while I have very little con...
Django seamless upgrades with CDN
0
0
0
570
7,541,397
2011-09-24T19:36:00.000
2
0
1
0
python,multithreading,multiprocessing
7,541,787
2
false
0
0
What you're describing is essentially graph traversal; Most graph traversal algorithms (That are more sophisticated than depth first), keep track of two sets of nodes, in your case, the nodes are url's. The first set is called the "closed set", and represents all of the nodes that have already been visited and process...
1
5
0
I am completely new to multiprocessing. I have been reading documentation about multiprocessing module. I read about Pool, Threads, Queues etc. but I am completely lost. What I want to do with multiprocessing is that, convert my humble http downloader, to work with multiple workers. What I am doing at the moment is, do...
Which strategy to use with multiprocessing in python
0.197375
0
0
2,128
7,541,834
2011-09-24T20:49:00.000
0
0
0
0
python,django
47,001,073
6
false
1
0
add 192.168.0.8 (or whatever your router ip is) as a string to ALLOWED_HOSTS list in settings then run server using python manage.py runserver 192.168.0.8:8000
2
4
0
I used python manage runserver 0.0.0.0:8000 to start the server so that I can access the project from other computers on my wifi network, but when i browse to internet-ipaddress:8000 on an another computer, the project doesn't load. Am I missing a setting?
Serve Django project on local WiFi Network
0
0
0
10,959
7,541,834
2011-09-24T20:49:00.000
6
0
0
0
python,django
7,541,893
6
false
1
0
What do you mean by internet-ipaddress? That sounds like you're using the external IP of your router. You should be using the IP of the particular machine you're serving from, which will be an internal address like 192.168.0.2.
2
4
0
I used python manage runserver 0.0.0.0:8000 to start the server so that I can access the project from other computers on my wifi network, but when i browse to internet-ipaddress:8000 on an another computer, the project doesn't load. Am I missing a setting?
Serve Django project on local WiFi Network
1
0
0
10,959
7,541,931
2011-09-24T21:06:00.000
16
0
0
1
python,django,asynchronous,queue,celery
11,125,501
1
true
1
0
Rate limited tasks are never dropped, they are queued internally in the worker so that they execute as soon as they are allowed to run. The token bucket algorithm does not specify anything about dropping packets (it is an option, but Celery does not do that).
1
6
0
I'm running a Django website where I use Celery to implement preventive caching - that is, I calculate and cache results even before they are requested by the user. However, one of my Celery tasks could, in some situation, be called a lot (I'd say sightly quicker than it completes on average, actually). I'd like to rat...
How is rate_limit enforced in Celery?
1.2
0
0
1,119
7,545,206
2011-09-25T11:28:00.000
0
0
0
1
java,c++,python,c,windows
7,545,592
3
false
0
0
The Java solution is to use Process to run the C++ or VBScript solution as a child process.
1
2
0
Is it possible to check whether a Windows installation is Genuine or not programmatically? Lets just say I want to check Windows 7 from C, C++, Java or Python.
How to check if a Windows version is Genuine or not?
0
0
0
2,226
7,546,026
2011-09-25T14:09:00.000
0
1
0
0
python,testing,connection,irc,bots
7,546,076
3
false
0
0
freenode is good.. You can create channels for yourself to test. Also check out this project called supybot, which is good for Python bots.
1
2
0
I am writing an IRC bot in Python using the Twisted library. To test my bot I need to connect several times to an IRC network as my bot requires a restart each time a change is made. Therefore I am often "banned" from these networks for a couple of minutes because I have made a lot of connections. This makes it annoyin...
Testing an IRC bot
0
0
1
3,842
7,551,546
2011-09-26T06:53:00.000
7
0
0
1
python,windows,linux,macos
7,552,255
6
true
0
0
Regarding Linux, if all you need is to enumerate devices, you can even skip pyudev dependency for your project, and simply parse the output of /sbin/udevadm info --export-db command (does not require root privileges). It will dump all information about present devices and classes, including USB product IDs for USB devi...
2
11
0
I have an 2-port signal relay connected to my computer via a USB serial interface. Using the pyserial module I can control these relays with ease. However, this is based on the assumption that I know beforehand which COM-port (or /dev-node) the device is assigned to. For the project I'm doing that's not enough since I...
Getting friendly device names in python
1.2
0
0
8,806
7,551,546
2011-09-26T06:53:00.000
0
0
0
1
python,windows,linux,macos
7,552,386
6
false
0
0
It will be great if this is possible, but in my experience with commercial equipments using COM ports this is not the case. Most of the times you need to set manually in the software the COM port. This is a mess, specially in windows (at least XP) that tends to change the number of the com ports in certain cases. In so...
2
11
0
I have an 2-port signal relay connected to my computer via a USB serial interface. Using the pyserial module I can control these relays with ease. However, this is based on the assumption that I know beforehand which COM-port (or /dev-node) the device is assigned to. For the project I'm doing that's not enough since I...
Getting friendly device names in python
0
0
0
8,806
7,552,283
2011-09-26T08:11:00.000
2
1
0
0
python,django,logging,django-email
7,552,429
4
false
1
0
I do not know if there exists a module that works this way, but writing a custom one is a piece of cake. Just create a separate model and every time you send an email, create a new instance ( use a custom method for email sending ). Then, link this model with the admin and bingo..
1
13
0
My Django application sends out quite a bit of emails and I've tried testing it thoroughly. However, for the first few months, I'd like to log all outgoing emails to ensure that everything is working smoothly. Is there a Django module that allows me to do this and makes the outgoing emails visible through the administr...
How can I log all outgoing email in Django?
0.099668
0
0
7,599
7,552,311
2011-09-26T08:13:00.000
0
0
1
0
python,pydev
47,538,044
2
false
0
0
I had the similar message and when I checked the script file name, I had a "-" [dash character] in the script name. After I removed the dash character and replaced with " _ " [an under score character], the warning message was gone.
1
12
0
I encountered the Invalid name for Python module: ...filename (it'll not be analyzed) warning message in PyDev and I tried to resolve it by replacing - in the filename with _ but the warning didn't disappeared. One of the problems is that in fact this is not a module, it's just a python script, still I get the warning...
Solving the invalid name for Python module warning in PyDev
0
0
0
15,759
7,553,200
2011-09-26T09:36:00.000
0
0
0
0
python,mysql
7,553,317
2
false
0
0
Have a look at os.path.normpath(thePath) I can't remember if it's that one, but there IS a standard os.path formating function that gives double backslashes, that can be stored in a db "as is" and reused later "as is". I have no more windows machine and cannot test it anymore.
1
0
0
I would like to store windows path in MySQL without escaping the backslashes. How can I do this in Python? I am using MySQLdb to insert records into the database. When I use MySQLdb.escape_string(), I notice that the backslashes are removed.
Storing windows path in MySQL without escaping backslashes
0
1
0
1,040
7,553,606
2011-09-26T10:14:00.000
3
1
0
0
python,email,pop3
7,556,750
1
true
0
0
Outlook logs in to a POP3 server and issues the STAT, LIST and UIDL commands; then if it decides the user has no new messages it logs out. I have observed Outlook doing this when tracing network traffic between a client and my DBMail POP3 server. I have seen Outlook fail to detect new messages on a POP3 server using ...
1
3
0
I'm trying to write a pop3 and imap clients in python using available libs, which will download email headers (and subsequently entire email bodies) from various servers and save them in a mongodb database. The problem I'm facing is that this client downloads emails in addition to a user's regular email client. So with...
Download POP3 headers from a certain date (Python)
1.2
1
0
1,501
7,555,519
2011-09-26T13:05:00.000
3
0
0
0
python,windows,svn,python-bindings
7,556,604
1
true
0
0
Apache Subversion is written in C and provides native libraries for the OS. On Windows, this means DLL's. Subversion provides "bindings" for a number of different languages, including Python. This gives you a shim that lets you write code in your language and the bindings handle making calls into the native librarie...
1
1
0
What is the alternative for the python svn bindings provided by CollabNet (this where you have 2 directories: svn and libsvn, the second with a lot of pre-compiled libraries)? The problem with it is that it just can't be configured to run with Windows version on Python. We've done what was written on various fora, but ...
What is the alternative for CollabNet's python svn bindings?
1.2
0
0
759
7,558,389
2011-09-26T16:47:00.000
1
0
0
0
java,python,serialization
7,558,455
2
false
1
0
You can use a Java JSON serializer like GSON or Jackson to serilaise quite easily and use a python json pickle to deserialize
1
10
0
I'm using a Python service that uses pickled messages as part of its protocol. I'd like to query this service from Java, but to do so, I need to pickle my message on the client (Java). Are there any implementations of pickle that run on the JVM (ideally with minimal dependencies)? Clarification: Modifying the server ...
How do I serialize a Java object such that it can be deserialized by pickle (Python)?
0.099668
0
1
8,413
7,559,170
2011-09-26T17:57:00.000
17
0
1
0
python,setattr
7,559,315
1
true
0
0
Reading this question again I misunderstood what @paper.cut was asking about: the difference between classic classes and new-style classes (not an issue in Python 3+). I do not know the answer to that. Original Answer* setattr(instance, name, value) is syntactic sugar for instance.__setattr__(name, value)**. You woul...
1
15
0
I know that you can't call object.__setattr__ on objects not inherited from object, but is there anything else that is different between the two? I'm working in Python 2.6, if this matters.
What's the difference between setattr() and object.__setattr__()?
1.2
0
0
9,335
7,559,224
2011-09-26T18:01:00.000
1
1
0
0
python,embedded,jenkins
7,560,987
1
true
0
0
What I have found, is that the best thing to do, is have something like jenkins, or if you're using enterprise, electric commander, manage a resource 'pool' the pool is essentially virtual devices, but they have a property, such that you can call into a python script w/ either an ip-address or serial port and communica...
1
3
0
I want to setup Jenkins to 1) pull our source code from our repository, 2) compile and build it 3) run the tests on an embedded device step 1 & 2 are quite easy and straight forward with Jenkins as for step 3, we have hundreds of those devices in various versions of them, and I'm looking for a utility (preferable in...
Handling hardware resources when testing with Jenkins
1.2
0
0
1,059
7,560,455
2011-09-26T19:46:00.000
21
0
1
0
python,python-3.x,decimal,currency
24,976,426
5
false
0
0
Falsehoods programmers believe about money: Monetary values can be stored or represented as a floating point. All currencies have a decimal precision of 2. All ISO 4217 defined currencies have a decimal precision. All currencies are defined in ISO 4217. Gold is not a currency. My system will never have to handle obscu...
1
28
0
How do I get my decimals to stay at 2 places for representing money using the decimal module? I've setting the precision, and damn near everything else, and met with failure.
Decimals to 2 places for money in Python 3
1
0
0
23,387
7,560,850
2011-09-26T20:21:00.000
2
1
1
0
java,python,performance,cython,bignum
7,561,424
1
false
0
0
First of all, I'm probably biased since I'm the maintainer of gmpy. gmpy uses the GMP multiple-precision library and GMP is usually considered the fastest general purpose multiple-precision library. But when it's "fastest" depends on on the operation and the size of the values. When I compare the performance between Py...
1
0
0
Are there any benchmark on this??? (I tried googling for some results but found none... and I couldn't test gmpy because gmplib wouldn't be installed on my laptop) thank you!
What's the fastest implementation for bignum? (Java's bigInteger / Cython's int / gmpy / etc...)
0.379949
0
0
1,269
7,561,969
2011-09-26T22:11:00.000
1
1
0
0
python,numpy,cron,installation
7,562,061
4
false
0
0
Your cron job is probably executing with a different python interpreter. Log in as you (via ssh), and say which python. That will tell you where your python is. Then have your cron job execute that python interpreter to run your script, or chmod +x your script and put the path in a #! line at the top of the script.
1
2
0
Right now I have a script which uses numpy that I want to run automatically on a server. When I ssh in and run it manually, it works fine. However, when I set it to run as a cron job, it can't find numpy. Apparently due to the shared server environment, the cron demon for whatever reason can't find numpy. I contact...
Workaround Way To Install Numpy?
0.049958
0
0
681
7,562,454
2011-09-26T23:18:00.000
1
1
1
0
python,frameworks
7,562,586
1
false
1
0
Learn from existing frameworks, I think. The Python web stack (wsgi, sqlalchemy, template engines, full stack frameworks, microframeworks) has spent a lot of time maturing. You'll have the opportunity to develop fast and learn from existing design.
1
0
0
I am an experienced PHP developer (10 years) who has built 3 different custom frameworks for extreme high traffic sites. I have recently started to get into programming a lot of python, usually just for fun (algorithms). I am starting to develop a new site as my side project and wanted to know if I should use a pre-exi...
Use Python Framework or Build Own
0.197375
0
0
481
7,564,100
2011-09-27T04:06:00.000
1
1
0
0
python,api,twitter,streaming,tweepy
7,640,150
2
true
0
0
How far back do you need? To fetch historical data, you might want to keep the stream on indefinitely (the stream API allows for this) and store the stream locally, then retrieve historical data from your db. I also use Tweepy for live Stream/Filtering and it works well. The latency is typically < 1s and Tweepy is ab...
2
0
0
I need to fetch twitter historical data for a given set of keywords. Twitter Search API returns tweets that are not more than 9 days old, so that will not do. I'm currently using Tweepy Library (http://code.google.com/p/tweepy/) to call Streaming API and it is working fine except the fact that it is too slow. For examp...
Is there any better way to access twitter streaming api through python?
1.2
0
1
1,072
7,564,100
2011-09-27T04:06:00.000
0
1
0
0
python,api,twitter,streaming,tweepy
7,569,606
2
false
0
0
streaming API too fast you get message as soon as you post it, we use twitter4j. But streamer streams only current messages, so if you not listening on streamer the moment you send tweet then message is lost.
2
0
0
I need to fetch twitter historical data for a given set of keywords. Twitter Search API returns tweets that are not more than 9 days old, so that will not do. I'm currently using Tweepy Library (http://code.google.com/p/tweepy/) to call Streaming API and it is working fine except the fact that it is too slow. For examp...
Is there any better way to access twitter streaming api through python?
0
0
1
1,072
7,565,812
2011-09-27T07:52:00.000
0
0
0
0
python,django,apache,mod-wsgi,mod-python
7,567,682
2
false
1
0
If you have control over what runs on the device side, consider using XML-RPC to talk from client to server.
1
0
0
I have been doing lots of searching and reading to solve this. The main goal is let a Django-based web management system connecting to a device which runs a http server as well. Django will handle user request and ask device for the real data, then feedback to user. Now I have a "kinda-work-in-concept" solution: Brows...
How to control Apache via Django to connect to mongoose(another HTTP server)?
0
1
0
320
7,567,157
2011-09-27T09:46:00.000
1
0
0
0
python,xcode
11,637,636
2
false
1
0
The best I can come with is the way I do it: By dragging only the .py files into the XCode project at the start. It's not ideal; there should be a way to filter out build files. This method also isn't great for sub-folders, since you have to create each folder and then drag the .py files in for each folder by hand. But...
1
1
0
I'm working on a fairly large django-project in Xcode 4. I prefer not to see all the automatically generated .pyc files in the project navigator. Does anyone know a way to hide the .pyc files from the interface? I don't necessarily want to remove them from disk. Thanks. - What fails: Checking "Show only files with sou...
Don't display .pyc files in the Xcode 4 project navigator
0.099668
0
0
423
7,567,318
2011-09-27T10:00:00.000
1
0
1
0
python,list,random
7,568,158
8
false
0
0
After that I would like to select another number from the remaining numbers of the list (N-1) and then use that also. Then you arguably do not really want to create a list of numbers from 1 to N just for the purpose of picking one (why not just ask for a random number in that range directly, instead of explicitly crea...
1
32
0
I have taken a count of something and it came out to N. Now I would like to have a list, containing 1 to N numbers in it. Example: N = 5 then, count_list = [1, 2, 3, 4, 5] Also, once I have created the list, I would like to randomly select a number from that list and use that number. After that I would like to select a...
How to make a list of n numbers in Python and randomly select any number?
0.024995
0
0
122,605
7,567,707
2011-09-27T10:33:00.000
2
0
0
0
python,gtk,window,pygtk,quit
7,839,037
2
false
0
1
Use the method gtk.main_level() to get the current nesting level of the main loop. The nesting level is increased by calling the gtk.main() function and reduced by calling the gtk.main_quit() function
1
5
0
Is there a way I can tell gtk to automatically call gtk.main_quit() when the last open window of the application is closed/destroyed? If there is no direct feature offering this functionality, I could think of the following: In the window's destroy method: get a list of open windows in the process, if its empty quit. I...
How to quit a pygtk application after last window is closed/destroyed
0.197375
0
0
3,003
7,572,410
2011-09-27T16:21:00.000
5
0
1
0
python,oop
7,572,433
5
false
0
0
python is dynamically typed so (in most cases) there is no need for generics/templates.
1
8
0
I worked for a few months as a C# programmer, and got used to the idea of generics/templates interfaces, which I could pass to a library without caring how the object was created. I'm about to start on a relatively large project, probably in python (I've written a lot of python before, but mostly my own code for data ...
Does Python have C#/Java-style interfaces?
0.197375
0
0
5,017
7,573,938
2011-09-27T18:27:00.000
1
1
0
0
php,python,cassandra
7,575,278
2
false
0
0
I believe that if you have a column with a type of UUID version 1, Cassandra will ignore the 'unique' component of the UUID and just use the time part for the range.
1
4
0
pycassa has pycassa.util.convert_time_to_uuid(time_arg, lowest_val=True, randomize=False) phpcassa has static string uuid1 ([string $node = null], [int $time = null]) Can phpcassa's uuid1 be used to get lowest/highest uuids like in pycassa? If not, what's the best approach to ensure you get everything between two given...
lowest possible timeuuid in php (phpcassa)
0.099668
0
0
411
7,574,453
2011-09-27T19:11:00.000
1
0
1
1
python,windows,linux,shebang
7,575,837
6
false
0
0
Install pywin32. One of the nice thing is it setups the file association of *.py to the python interpreter.
2
85
0
I have some small utility scripts written in Python that I want to be usable on both Windows and Linux. I want to avoid having to explicitly invoke the Python interpreter. Is there an easy way to point shebang notation to the correct locations on both Windows and Linux? If not, is there another way to allow implicit...
Shebang Notation: Python Scripts on Windows and Linux?
0.033321
0
0
92,049
7,574,453
2011-09-27T19:11:00.000
42
0
1
1
python,windows,linux,shebang
7,574,585
6
false
0
0
Unless you are using cygwin, windows has no shebang support. However, when you install python, it add as file association for .py files. If you put just the name of your script on the command line, or double click it in windows explorer, then it will run through python. What I do is include a #!/usr/bin/env python sheb...
2
85
0
I have some small utility scripts written in Python that I want to be usable on both Windows and Linux. I want to avoid having to explicitly invoke the Python interpreter. Is there an easy way to point shebang notation to the correct locations on both Windows and Linux? If not, is there another way to allow implicit...
Shebang Notation: Python Scripts on Windows and Linux?
1
0
0
92,049
7,574,704
2011-09-27T19:34:00.000
0
0
1
1
python,windows,python-idle
29,788,701
3
false
0
0
I've noticed this on Windows 7, running IDLE v2.7.3; Tk version 8.5; Python 2.7.3 However, it only seems to fail to close the process if you kill a program before it finishes on its own. If possible, let your programs run to their end.
2
0
0
Windows 7: I'm using Python3.2 with IDLE. Every time I edit and load my program, I get a new "pythonw.exe *32" process (as shown by Windows Task Manager)--even if the program just prints Hello World. This is a special nuisance if the program is on a static RAM drive, because then I have to kill each of these processes ...
Every Python IDLE run starts a new process
0
0
0
486
7,574,704
2011-09-27T19:34:00.000
3
0
1
1
python,windows,python-idle
7,574,883
3
true
0
0
Upgrade to version 3.2.2. That fixed the bug for me. I saw the same thing in 3.2.1.
2
0
0
Windows 7: I'm using Python3.2 with IDLE. Every time I edit and load my program, I get a new "pythonw.exe *32" process (as shown by Windows Task Manager)--even if the program just prints Hello World. This is a special nuisance if the program is on a static RAM drive, because then I have to kill each of these processes ...
Every Python IDLE run starts a new process
1.2
0
0
486
7,575,329
2011-09-27T20:36:00.000
0
0
1
0
python,performance,character-encoding,io,python-3.x
7,776,795
4
false
0
0
I don't know the capabilities of data input in Stata, and a quick search reveals that said capabilities are described in the User's Guide, which seems to be available only on dead-tree copies. So I don't know if my suggestion is feasible. An instant saving of half the size would be if you used 4-bits per character. You...
1
2
0
I am tabulating a lot of output from some network analysis, listing an edge per line, which results in dozens of gigabytes, stretching the limits of my resources (understatement). As I only deal with numerical values, it occurred to me that I might be smarter than using the Py3k defaults. I.e. some other character enco...
python precautions to economize on size of text file of purely numerical characters
0
0
0
202
7,576,309
2011-09-27T22:14:00.000
0
0
0
0
python,xls,xlsx,xlwt,openpyxl
7,576,355
3
false
0
0
Export a CSV don't use .xlsx..
1
3
0
I know about the XLWT library, which I've used before on a Django project. XLWT is very neat but as far as I know, it doesn't support .xlsx which is the biggest obstacle in my case. I'm probably going to be dealing with more than 2**16 rows of information. Is there any other mature similar library? Or even better, is t...
Exporting to Excel .xlsx from a Python Pyramid project
0
1
0
1,504
7,580,939
2011-09-28T09:16:00.000
2
1
0
0
python,automation,makefile,rake
7,581,531
8
false
1
0
Any decent test tool has a way of running the entire suite in a single command, and nothing is stopping you from using rake, make, or anything else, really. There is little reason to invent a new way of doing things when existing methods work perfectly well - why re-invent something just because YOU didn't invent it? (...
3
34
0
As a long time Python programmer, I wonder, if a central aspect of Python culture eluded me a long time: What do we do instead of Makefiles? Most ruby-projects I've seen (not just rails) use Rake, shortly after node.js became popular, there was cake. In many other (compiled and non-compiled) languages there are classic...
Why are there no Makefiles for automation in Python projects?
0.049958
0
0
12,445
7,580,939
2011-09-28T09:16:00.000
-3
1
0
0
python,automation,makefile,rake
7,581,523
8
true
1
0
Is there nothing to automate? Not really. All but two of the examples are one-line commands. tl;dr Very little of this is really interesting or complex. Very little of this seems to benefit from "automation". Due to documentation, I don't have to remember the commands to do this. Do most programmers prefer to r...
3
34
0
As a long time Python programmer, I wonder, if a central aspect of Python culture eluded me a long time: What do we do instead of Makefiles? Most ruby-projects I've seen (not just rails) use Rake, shortly after node.js became popular, there was cake. In many other (compiled and non-compiled) languages there are classic...
Why are there no Makefiles for automation in Python projects?
1.2
0
0
12,445
7,580,939
2011-09-28T09:16:00.000
2
1
0
0
python,automation,makefile,rake
53,604,587
8
false
1
0
The make utility is an optimization tool which reduces the time spent building a software image. The reduction in time is obtained when all of the intermediate materials from a previous build are still available, and only a small change has been made to the inputs (such as source code). In this situation, make is able ...
3
34
0
As a long time Python programmer, I wonder, if a central aspect of Python culture eluded me a long time: What do we do instead of Makefiles? Most ruby-projects I've seen (not just rails) use Rake, shortly after node.js became popular, there was cake. In many other (compiled and non-compiled) languages there are classic...
Why are there no Makefiles for automation in Python projects?
0.049958
0
0
12,445
7,581,963
2011-09-28T10:42:00.000
1
0
0
0
python,nul
7,791,175
1
true
0
0
I found out the problem was that I was running the code inside PyScripter and the in-built python interpreter terminates NUL bytes in the output. So there was no problem with my code, if I run it outside PyScripter everything works fine. Now running Wing IDE and never looking back :)
1
2
0
I'm downloading files over HTTPS, I request the files through urllib2.Request and they come back as a socket._fileobject. I'd ideally like to stream this to file to avoid loading it into memory but I'm not sure how to do this. My problem is if I call .read() on the object it only returns all the data up to the first NU...
read() stops after NUL character
1.2
0
1
406
7,584,546
2011-09-28T14:05:00.000
0
0
0
0
python,html,django,wkhtmltopdf,html2pdf
7,584,807
3
false
1
0
A possible, but not so elegant solution, is to run a small scripts which renders the html via a headless browser component (webkit/xvfb on Linux) and then saves it as a pdf.
2
3
0
I am trying to convert HTML into a PDF document in Django and haven't been successful. I have tried using wkhtmltopdf 0.9.9, however Apache throws an error that wkhtmltopdf cannot connect to server. When I use wkhtmltopdf directly, it runs perfectly fine and converts the HTML into a PDF document. I have also tried usin...
Convert HTML into PDF using Python
0
0
0
9,230
7,584,546
2011-09-28T14:05:00.000
0
0
0
0
python,html,django,wkhtmltopdf,html2pdf
7,584,643
3
false
1
0
I suggest you to use pisa, pypdf and html5lib combination, it worked for me.
2
3
0
I am trying to convert HTML into a PDF document in Django and haven't been successful. I have tried using wkhtmltopdf 0.9.9, however Apache throws an error that wkhtmltopdf cannot connect to server. When I use wkhtmltopdf directly, it runs perfectly fine and converts the HTML into a PDF document. I have also tried usin...
Convert HTML into PDF using Python
0
0
0
9,230
7,585,027
2011-09-28T14:42:00.000
1
0
0
0
python,django,xss
7,585,077
2
false
1
0
XSS is a Javascript vulnerability, it is unrelated to SQL injection. To prevent XSS, you need to do the same sensitization, regardless of how your data is stored. Based on its description, using that library and a CSRF token should be sufficient. EDIT While you do not need to worry about SQL injection with MongoDB. If...
1
0
0
I am running a 100% NoSQL backend (MongoDB) and developing using Django. The application I am building has a lot of different forms, and for a variety of reasons, I am trying to avoid using Django.Forms because they are complicated and do not seem to be very flexible. How worried do I need to be about XSS (as far as I ...
XSS With MongoDB / Django Forms
0.099668
0
0
1,441
7,585,284
2011-09-28T15:03:00.000
4
0
1
0
python
7,585,349
1
true
0
0
Yes. If you want __dict__, then just don't use __slots__.
1
4
0
The whole point of __slots__ is to save space. But I saw people add __dict__ to it so that new attributes can be added. Isn't this defeating the goal of __slots__?
python: what's the point of adding`__dict__` to `__slots__`
1.2
0
0
556
7,586,999
2011-09-28T17:14:00.000
0
0
0
0
python,django,database-design,amazon-web-services
7,587,624
3
false
1
0
You should actually be okay with low hundreds of writes per minute through SQLAlchemy (thats only a couple a second); if you're talking more like a thousand a minute, yeah that might be problematic. What kind of data do you have? If it's fairly flat (few tables, few relations), you might want to investigate a non-rela...
2
0
0
I am researching a project that would require hundreds of database writes per a minute. I have never dealt with this level of data writes before and I am looking for good scalable techniques and technologies. I am a comfortable python developer with experience in django and sql alchemy. I am thinking I will build the d...
Setup for high volume of database writing
0
1
0
324
7,586,999
2011-09-28T17:14:00.000
0
0
0
0
python,django,database-design,amazon-web-services
7,587,774
3
false
1
0
If it's just a few hundred writes you still can do with a relational DB. I'd pick PostgreSQL (8.0+), which has a separate background writer process. It also has tuneable serialization levels so you can enable some tradeoffs between speed and strict ACID compliance, some even at transaction level. Postgres is well docum...
2
0
0
I am researching a project that would require hundreds of database writes per a minute. I have never dealt with this level of data writes before and I am looking for good scalable techniques and technologies. I am a comfortable python developer with experience in django and sql alchemy. I am thinking I will build the d...
Setup for high volume of database writing
0
1
0
324
7,587,939
2011-09-28T18:42:00.000
2
0
0
0
python,http,request
7,588,103
3
false
1
0
For requests that you know will take a long time (more than a few seconds) to process, you must assume at minimum that the connection may be forcibly severed by a firewall. I would say you should implement a queue system on the backend. The request to perform the operation becomes a request to queue the operation. Wh...
2
2
0
Lets say an operation could take 2 to 10 minutes on the server to perform, for example to update an index which is time consuming. Would you perform the operation while holding the request? ie not sending a HTTP Response until the operation has finished? And if the client/browser drops the request, just continue with ...
Should you hold a HTTP request while the server performs a time consuming operation? Or let the request go?
0.132549
0
1
489
7,587,939
2011-09-28T18:42:00.000
3
0
0
0
python,http,request
7,588,099
3
true
1
0
You might also use a chunked response. First, push a chunk with some code that would display the “please wait” screen, flush the response and start the work. Then you can either push and flush chunks with periodical progress updates or just push one at the end with a “completed” information. Obviously you can employ Ja...
2
2
0
Lets say an operation could take 2 to 10 minutes on the server to perform, for example to update an index which is time consuming. Would you perform the operation while holding the request? ie not sending a HTTP Response until the operation has finished? And if the client/browser drops the request, just continue with ...
Should you hold a HTTP request while the server performs a time consuming operation? Or let the request go?
1.2
0
1
489
7,591,320
2011-09-29T00:59:00.000
2
0
1
0
python,linux,build,installation,itk
7,612,310
5
true
0
0
Sept, 30, 2011 : WARNING ITKv4 is still in beta and is under VERY active development. Please do not take the current state of documentation as reflective of the process that will be available in the final version.
1
0
0
I want to use the python bindings with the ITK 4.0. Is there any complete guide that how to build and install and correctly set the options for the wrappers? I am using Linux 11.04. Thanks a lot.
Is there any complete guide to the building and installation of ITK 4.0?
1.2
0
0
1,285
7,592,008
2011-09-29T03:02:00.000
1
0
1
1
python,process,python-idle
7,592,072
1
true
0
0
Have you tried using python.exe instead of pythonw.exe? Im pretty sure this is the intended default behavior for the window python interperter (pythonw.exe). If its a .pyw file, just right click "Open With..." and use python.exe
1
2
0
Every time I restart the shell or run a script and instance of pythonw.exe*32 is created. When I close out of IDLE these processes don't go away in the task manager. Any ideas on how to fix this? Thanks!
pythonw.exe processes not quitting after running script
1.2
0
0
2,421
7,595,124
2011-09-29T09:20:00.000
0
0
0
0
java,python,ajax,web-applications
7,595,177
1
true
1
0
Some direct benefits of using Django instead of rolling your own Database ORM Templating User authentication Pluggable applications (use other people's stuff, yay!) Also, Django can be deployed as a FCGI application.
1
0
0
I'm building a web based 2 player game, client side interface will all be done in an ajax manor with html/css/javascript. I want clients to be able to initiate games and join others, chat etc, but I'm stuck on what the best way to code and communicate with the server is, I would like to use either Java or Python. Pytho...
What back end tech to use for a 2-player, turn based, ajax web game?: Python or Java, FastCGI or app server?
1.2
0
0
253
7,595,709
2011-09-29T10:05:00.000
0
0
1
0
python,visual-c++,manifest,cx-freeze,pyd
7,717,497
2
false
0
0
The dynamic python file I had created was compiled using Visual C++ 2010. Hence in order for it to work, the MSVCR100.dll files were needed. However as I had also created an application (.exe) of my final program, it depended on MSVCR90.dll. As Microsoft insist that these dlls should be in a folder with a particular n...
1
0
0
have created a dynamic python file (pyd) using VC++. Using cx_freeze, I have created an exe. In order for this program to work on other computers, I need to have a file msvcr100.dll in the applications folder. And I do get the desired output. However the distribution license for Microsoft clearly states that the dll f...
DLL in sub folder rather than in application folder
0
0
0
749
7,595,809
2011-09-29T10:14:00.000
2
0
0
0
python,web-applications,background
7,595,902
1
true
1
0
Timout duration is up to you, you could just make it longer. Anyway there are plenty of flash or AJAX uploaders out there, nothing you can do only server side AFAIK
1
3
0
I have got a working web application in Python that downloads a file into the web server upon a user's request. This works fine for small file downloads but when the user requests a larger file, the connection times out. So, I think I need to process the download in the background but I'm not sure what tool is most sui...
Downloading files in background with Python
1.2
0
1
751
7,596,108
2011-09-29T10:41:00.000
2
0
1
0
python
7,596,161
2
false
0
0
Sounds like it's time to redesign your program. Replace list 2 with a defaultdict(None) mapping the objects in list 1 to their node properties. Call it node so you can get the node of an object x with node[x]. You can get the list of all nodes (unordered) with node.values() in O(m) time where m is the number of objects...
1
0
0
I have two list. List1 contain objects and each object has node1 property. List2 contain lists of node which are the properties of objects stored in list1. I want to create separate list which contain list of objects whose node present in list2. I want to create this list without using for loop because my object list i...
Getting list element's Attribute
0.197375
0
0
101
7,598,346
2011-09-29T13:51:00.000
4
0
1
0
python,function,immutability,mutable,subroutine
7,598,404
3
true
0
0
All names in Python are references. And no, there are no "out" references (e.g. in a C++ sense) available. You need to pass a mutable object and then you can mutate it in the function. But then again, returning new value(s) should be the preferred way.
2
1
0
Is there any way (hack) to push Python function (def) to return results by reference even for immutable types? A proposal application (swap as subroutine): def swap(a, b): .....a,b = b,a Note: def swap(a, b): .....return b,a works as function which is not the answer of the question! For example there is a function ran...
Python: variables by references (hack)
1.2
0
0
351
7,598,346
2011-09-29T13:51:00.000
3
0
1
0
python,function,immutability,mutable,subroutine
7,598,469
3
false
0
0
No, such things don't exist, because you get the given object as a reference, but if you re-assign it, it won't be changed back. You either have to work with a mutable container (list, dict, object with attributes) in this case.
2
1
0
Is there any way (hack) to push Python function (def) to return results by reference even for immutable types? A proposal application (swap as subroutine): def swap(a, b): .....a,b = b,a Note: def swap(a, b): .....return b,a works as function which is not the answer of the question! For example there is a function ran...
Python: variables by references (hack)
0.197375
0
0
351
7,601,098
2011-09-29T17:31:00.000
1
0
1
0
python,dependencies,virtualenv,pip
7,602,082
1
true
1
0
Using pip + virtualenv you can't have two versions of a library installed at the same time. And, unfortunately, I don't know of any good ways of handling this situation. Sorry.
1
0
0
I have 2 local libraries which are dependent on different version of suds. Example - Module-A-1.0's setup.py has a requirement of suds ==0.3.9. Module-B-1.0's setup.py has a requirement of suds ==0.4.0. Both these modules are required by Module-C, which has the following its setup.py django Module-A-1.0 Module-B...
dependency resolution pip virtualenv
1.2
0
0
512
7,603,674
2011-09-29T21:36:00.000
2
0
0
0
python,pyramid,beaker
7,608,095
2
true
1
0
Changing the timeout isn't supported by beaker. If you are trying to make a session stick around that long, you should probably just put it into a separate cookie. A common use-case is the "remember me" checkbox on login. This helps you track who the user is, but generally the actual session shouldn't be sticking aroun...
1
3
0
I am using pyramid to create a web application. I am then using pyramid-beaker to interface beaker into pyramid's session management system. Two values affect the duration of a user's session. The session cookie timeout The actual session's life time on either disk/memcache/rdbms/etc I currently have to cookie defau...
How do I override the default session timeout with pyramid + pyramid-beaker + beaker
1.2
0
0
2,326
7,603,790
2011-09-29T21:50:00.000
5
0
1
0
python,database,multithreading,sqlalchemy,multiprocessing
7,603,832
1
false
0
0
The MetaData and its collection of Table objects should be considered a fixed, immutable structure of your application, not unlike your function and class definitions. As you know with forking a child process, all of the module-level structures of your application remain present across process boundaries, and table de...
1
1
0
Problem I am writing a program that reads a set of documents from a corpus (each line is a document). Each document is processed using a function processdocument, assigned a unique ID, and then written to a database. Ideally, we want to do this using several processes. The logic is as follows: The main routine creates...
How to use simple sqlalchemy calls while using thread/multiprocessing
0.761594
1
0
1,473
7,604,966
2011-09-30T01:01:00.000
4
0
1
0
python,integer
62,487,421
9
false
0
0
sys.maxsize is not the actually the maximum integer value which is supported. You can double maxsize and multiply it by itself and it stays a valid and correct value. However, if you try sys.maxsize ** sys.maxsize, it will hang your machine for a significant amount of time. As many have pointed out, the byte and bit si...
1
1,070
0
How do I represent minimum and maximum values for integers in Python? In Java, we have Integer.MIN_VALUE and Integer.MAX_VALUE.
Maximum and Minimum values for ints
0.088656
0
0
1,576,625
7,605,212
2011-09-30T01:53:00.000
1
0
0
0
python,mysql,django,macos,mysql-python
7,605,229
3
false
1
0
Install pip if you haven't already, and run pip install MySQL-Python
2
2
0
So I am pretty sure that I have managed to dork up my MySQLdb installation. I have all of the following installed correctly on a fresh install of OS X Lion: phpMyAdmin MySQL 5.5.16 Django 1.3.1 And yet when I try to run "from django.db import connection" in a django console, I get the following: from django.db im...
Having an issue with setting up MySQLdb on Mac OS X Lion in order to support Django
0.066568
1
0
3,834
7,605,212
2011-09-30T01:53:00.000
5
0
0
0
python,mysql,django,macos,mysql-python
12,027,574
3
false
1
0
I found the following solution for this issue. It worked for me. I have encountered this problem when I was running python console from PyCharm. sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
2
2
0
So I am pretty sure that I have managed to dork up my MySQLdb installation. I have all of the following installed correctly on a fresh install of OS X Lion: phpMyAdmin MySQL 5.5.16 Django 1.3.1 And yet when I try to run "from django.db import connection" in a django console, I get the following: from django.db im...
Having an issue with setting up MySQLdb on Mac OS X Lion in order to support Django
0.321513
1
0
3,834
7,605,254
2011-09-30T02:03:00.000
0
0
0
0
image,button,wxpython,label,background-image
7,611,324
1
true
0
1
There is no built-in button that allows a background image underneath the text. You can probably look at one of the generic button widgets though and use them as a template. Basically you just need to draw the bitmap on and then draw text on top, probably by using wx.DC or wx.GCDC or similar. The generic buttons includ...
1
0
0
Can I create a button with text with a background image? In wxPython, there are certain functions which create buttons such as wx.lib.buttons.GenBitmapTextButton and other functions like that. I'm wondering if I can create a button with a fancy background image, as well as label text.
wxPython Button Background Image
1.2
0
0
707
7,606,111
2011-09-30T04:57:00.000
1
1
0
0
python,audio,signal-processing,frequency
7,632,584
4
false
1
0
I would tackle the receiving end using two FIR filters, one for each frequency that you are trying to detect. The coefficients of the filters are just a copy of the signal you are looking for (i.e. 250Hz in one case and 450Hz in the other). You would have to look at the output of your solar panel to decide whether that...
2
5
0
I'm currently working on a project that has been relatively easy, up until now. The underlying project is to transmit data/messages over lasers using audio transformation. In a nutshell the process is currently like this The user enters a message Message is turned into binary For each 1 and 0 in the binary message, it...
Python Audio Transfer Through Lasers
0.049958
0
0
1,017
7,606,111
2011-09-30T04:57:00.000
1
1
0
0
python,audio,signal-processing,frequency
7,614,995
4
false
1
0
Did you do a sanity check by listening to the sound files (both transmit and receive), or viewing the waveforms with an audio editor, to see if they roughly sound or look the same? That way you can narrow down the problem to channel induced errors versus your software analysis. Your decoding/demodulation software will...
2
5
0
I'm currently working on a project that has been relatively easy, up until now. The underlying project is to transmit data/messages over lasers using audio transformation. In a nutshell the process is currently like this The user enters a message Message is turned into binary For each 1 and 0 in the binary message, it...
Python Audio Transfer Through Lasers
0.049958
0
0
1,017
7,606,614
2011-09-30T06:18:00.000
7
0
0
0
python,django,virtualenv
7,611,630
3
false
1
0
This issue was solved by using pip to install "pillow" instead of "pil" which allows easy deployment to virtualenv.
1
5
0
I have PIL installed, however whenever I try to upload a .png file to an image field through the Django Admin for my model, I get this error: "Upload a valid image. The file you uploaded was either not an image or a corrupted image." Other image types work fine. I have tried several different PNG files. I have tried r...
Django ImageField "Upload a valid image. The file you uploaded was either not an image or a corrupted image."
1
0
0
5,678
7,608,503
2011-09-30T09:33:00.000
16
0
1
1
python,win64,pypy
7,609,593
4
false
0
0
PyPy is not compatible with 64bit windows. Primary reason is that sizeof(void*) != sizeof(long) which is a bit annoying. Contributions are more than welcome :)
3
14
0
I am trying to use PyPy on a Windows 7 x64 machine but do not find any way to do it. Apparently there is a win32 binary, but no x64 binary or installation guide. I am currently using Python 2.7.2 win64 (Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on win32). Installation from sources raised...
PyPy on Windows 7 x64?
1
0
0
10,736
7,608,503
2011-09-30T09:33:00.000
6
0
1
1
python,win64,pypy
7,608,534
4
false
0
0
There's no version available for 64 bit Python on Windows. You appear to have the following options: Download the source to PyPy and port it to 64 bit. Switch to 32 bit Python. Option 2 looks more tractable.
3
14
0
I am trying to use PyPy on a Windows 7 x64 machine but do not find any way to do it. Apparently there is a win32 binary, but no x64 binary or installation guide. I am currently using Python 2.7.2 win64 (Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on win32). Installation from sources raised...
PyPy on Windows 7 x64?
1
0
0
10,736
7,608,503
2011-09-30T09:33:00.000
3
0
1
1
python,win64,pypy
29,459,581
4
false
0
0
Just an update on this issue if anyone read it nowadays: PyPy seems to have solved their issues with Windows x64, you can download the 32-bit version of PyPy and it will work flawlessly under Windows 7 x64 (I even have a 64-bit python install beside, and pypy is working nicely along, I just have to specify the full pat...
3
14
0
I am trying to use PyPy on a Windows 7 x64 machine but do not find any way to do it. Apparently there is a win32 binary, but no x64 binary or installation guide. I am currently using Python 2.7.2 win64 (Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on win32). Installation from sources raised...
PyPy on Windows 7 x64?
0.148885
0
0
10,736
7,611,759
2011-09-30T14:21:00.000
1
0
0
0
python,frameworks,pyramid
11,603,886
4
false
1
0
As RonakG first pointed, it all depends on the kind of website you intend to have up and running. Actually, your question is too general for a single, definitive answer. There are more aspects to consider other than just being in python. For example, deadlines. This means considering the learning curve to achieve your ...
4
4
0
The site won't be that complicated and will resemble a modern blog (users, messages, news and other similar features). Do I need to use a framework for this, and if so, which is best? Pyramid, Django?
Do I need to use a web framework for a simple website?
0.049958
0
0
1,425
7,611,759
2011-09-30T14:21:00.000
3
0
0
0
python,frameworks,pyramid
7,612,176
4
true
1
0
It depends on what kind of website you are planning to come up with. If the website is going to be just a set of static HTML files, then you don't really need a framework. But if your website will have lots of dynamic content that will get updated on regular basis, you should go with some framework. That will make y...
4
4
0
The site won't be that complicated and will resemble a modern blog (users, messages, news and other similar features). Do I need to use a framework for this, and if so, which is best? Pyramid, Django?
Do I need to use a web framework for a simple website?
1.2
0
0
1,425
7,611,759
2011-09-30T14:21:00.000
2
0
0
0
python,frameworks,pyramid
7,611,778
4
false
1
0
Go with Django - 10,000 Elvis fans can't be wrong. Or roll your own from scratch. You'll learn a lot, know everything about how you site works, and better appreciate what a framework does for you.
4
4
0
The site won't be that complicated and will resemble a modern blog (users, messages, news and other similar features). Do I need to use a framework for this, and if so, which is best? Pyramid, Django?
Do I need to use a web framework for a simple website?
0.099668
0
0
1,425
7,611,759
2011-09-30T14:21:00.000
8
0
0
0
python,frameworks,pyramid
7,612,742
4
false
1
0
You certainly don't need a webframework to create a simple website. Given that you're new to python and interested in building a python website, I imagine this implies: you're interested in learning python. If you're exclusively interested in learning django-python, there's no reason you can't jump in to django, as R...
4
4
0
The site won't be that complicated and will resemble a modern blog (users, messages, news and other similar features). Do I need to use a framework for this, and if so, which is best? Pyramid, Django?
Do I need to use a web framework for a simple website?
1
0
0
1,425
7,613,525
2011-09-30T16:47:00.000
1
0
1
1
python,msys
7,613,945
1
true
0
0
Find where in the msys path libgcc_s_dw2-1.dll is. Find the environmental variable in MSYS that has that path in it. Add that environmental variable to Windows.
1
4
0
I've got a short python script that will eventually edit an input file, run an executable on that input file and read the output from the executable. The problem is, I've compiled the executable through msys, and can only seem to run it from the msys window. I'm wondering if the easiest way to do this is to somehow use...
How can I run a program in msys through Python?
1.2
0
0
2,618
7,613,616
2011-09-30T16:57:00.000
0
0
0
0
python,django,testing,tdd
7,613,691
2
false
1
0
Make sure you use sqlite for testing purposes. There's a considerable difference in speed compared to other db engines.
1
2
0
I currently use a single fixtures file per application, but as projects grow, the tests are taking far too long and I believe that the (now large) fixtures being loaded for each test class are at fault. I've avoided having lots of smaller fixtures because of concerns about duplication and maintenance, but I know think ...
What are your best practices for working with test data in Django?
0
0
0
199
7,615,317
2011-09-30T19:45:00.000
6
0
0
0
python,flask
7,615,352
1
true
1
0
If you run with app.debug = True and serve media files (images, css, js etc.) from Flask, they also count as full requests. If that is not the case, then please provide some more information about your setup.
1
4
0
I added an app.logger.error('test') inside my @app.before_request and noticed that there are up to 8 lines of test in my log per request, even if it's just abort(500). I just can't seem to find out why, what could cause this?
Flask's @before_request executes more than once
1.2
0
0
1,899
7,618,493
2011-10-01T06:02:00.000
1
0
1
0
python,dynamic,dynamic-programming,knapsack-problem
14,783,965
2
false
0
0
A basic array implementation can help you keep track of what items enabled a new DP state to get it's value. For example, if your DP array is w[] then you can have another array p[]. Every time a state is generated for w[i], you set p[i] to the item you used to get to 'w[i]'. Then to output the list of items used for w...
2
1
0
I'm teaching myself basic programming principles, and I'm stuck on a dynamic programming problem. Let's take the infamous Knapsack Problem: Given a set of items, each with a weight and a value, determine the count of each item to include in a collection so that the total weight is less than or equal to a given limit an...
Keeping Track of Dynamic Programming Steps
0.099668
0
0
844
7,618,493
2011-10-01T06:02:00.000
2
0
1
0
python,dynamic,dynamic-programming,knapsack-problem
7,618,509
2
false
0
0
Consider each partial solution a Node. Simply add whatever you use into each of these nodes and whichever node becomes the answer at the end will contain the set of items you used. So each time you find a new solution you just set the list of items to the list of items of the new optimal solution and repeat for each.
2
1
0
I'm teaching myself basic programming principles, and I'm stuck on a dynamic programming problem. Let's take the infamous Knapsack Problem: Given a set of items, each with a weight and a value, determine the count of each item to include in a collection so that the total weight is less than or equal to a given limit an...
Keeping Track of Dynamic Programming Steps
0.197375
0
0
844
7,618,503
2011-10-01T06:05:00.000
0
0
1
0
python,syntax-error
32,766,211
2
false
0
0
Just switch your keyboard setting between normal US English for coding, and US English International for texting, that worked for me.
2
3
0
Newbie disclaimer: I am new to Python and just started using IDLE to play around with Python. My problem is the interpreter does not recognize strings, whether enclosed in ¨¨ or ´´. I configured IDLE to use UTF-8. but it does not seem to be an IDLE issue. What I tried is to test this string in the interpreter directly....
My python interpreter does not recognize strings
0
0
0
2,296
7,618,503
2011-10-01T06:05:00.000
7
0
1
0
python,syntax-error
7,618,528
2
true
0
0
You need to use "" or '', not ¨¨, ´´ or any other fancy characters.
2
3
0
Newbie disclaimer: I am new to Python and just started using IDLE to play around with Python. My problem is the interpreter does not recognize strings, whether enclosed in ¨¨ or ´´. I configured IDLE to use UTF-8. but it does not seem to be an IDLE issue. What I tried is to test this string in the interpreter directly....
My python interpreter does not recognize strings
1.2
0
0
2,296
7,621,249
2011-10-01T15:47:00.000
1
0
0
0
python
7,621,359
3
false
0
0
You could try something like urllib2.urlopen('url').read().splitlines()[1] but I guess that would download the entire file to memory
1
0
0
I asked a similar question yesterday but I included some code that basically took my question on a different tangent than I had intended. So I shall try again. I am rewriting a python script that crawls a website to find a few hundred text files, I have no interest in any content of the text file beyond the second lin...
opening files from a website
0.066568
0
1
124
7,621,477
2011-10-01T16:26:00.000
0
1
0
0
python,eclipse,pygtk,pydev,documentation-generation
7,651,572
2
false
0
0
Make sure that your PYTHONPATH includes pygtk.
1
3
0
In Eclipse PyDev plugin, all document of default library of python will be load, but document of pygtk doesn't load in Eclipse. Any way to load them to eclipse?
How to load PyGTK documentation in Eclipse PyDev Plugin in auto-completion?
0
0
0
887
7,623,600
2011-10-01T23:25:00.000
1
0
0
0
python,http,httpclient,urllib2,if-modified-since
7,623,988
3
false
0
0
You can add a header called ETag, (hash of your file, md5sum or sha256 etc ), to compare if two files are different instead of last-modified date
2
3
0
I have an HTTP server which host some large file and have python clients (GUI apps) which download it. I want the clients to download the file only when needed, but have an up-to-date file on each run. I thought each client will download the file on each run using the If-Modified-Since HTTP header with the file time of...
Sync local file with HTTP server location (in Python)
0.066568
0
1
1,447
7,623,600
2011-10-01T23:25:00.000
0
0
0
0
python,http,httpclient,urllib2,if-modified-since
7,623,922
3
false
0
0
I'm assuming some things right now, BUT.. One solution would be to have a separate HTTP file on the server (check.php) which creates a hash/checksum of each files you're hosting. If the files differ from the local files, then the client will download the file. This means that if the content of the file on the server ch...
2
3
0
I have an HTTP server which host some large file and have python clients (GUI apps) which download it. I want the clients to download the file only when needed, but have an up-to-date file on each run. I thought each client will download the file on each run using the If-Modified-Since HTTP header with the file time of...
Sync local file with HTTP server location (in Python)
0
0
1
1,447
7,623,795
2011-10-02T00:12:00.000
7
0
1
0
python,pydev
7,623,803
2
false
0
0
I don't know Pydev, but in most editors Shift+Tab will do the trick.
2
3
0
I am using pydev for python development. I am facing issue while removing indentation for a block of statement. If I have to add indentation I used to press SHIFT + down arrow key until I reach the end of block of statements which I want to indent and then press the TAB key.This is how i used to add indent for a block...
Removing indent in PYDEV
1
0
0
2,441
7,623,795
2011-10-02T00:12:00.000
2
0
1
0
python,pydev
7,626,593
2
false
0
0
From pydev.org, their page: Block indent (and dedent) Tab / Shift-Tab Smart indent (and dedent) Enter / Backspace
2
3
0
I am using pydev for python development. I am facing issue while removing indentation for a block of statement. If I have to add indentation I used to press SHIFT + down arrow key until I reach the end of block of statements which I want to indent and then press the TAB key.This is how i used to add indent for a block...
Removing indent in PYDEV
0.197375
0
0
2,441
7,623,858
2011-10-02T00:27:00.000
1
0
0
1
java,python,hadoop,hbase,thrift
7,707,068
2
false
1
0
Yes, you should get data local code execution with streaming. You do not push the data to where the program is, you push the program to where the data is. Streaming simply takes the local input data and runs it through stdin to your python program. Instead of each map running inside of a java task, it spins up and ins...
1
3
0
Sorry in advance if this is a basic question. I'm reading a book on hbase and learing but most of the examples in the book(and well as online) tend to be using Java(I guess because hbase is native to java). There are a few python examples and I know I can access hbase with python(using thrift or other modules), but I'...
Is there any loss of functionality with streaming jobs in hbase/hadoop versus using java?
0.099668
0
0
758
7,625,984
2011-10-02T11:07:00.000
3
0
1
0
python,python-imaging-library,pixel
12,994,553
4
false
0
1
New in version 1.1.5 of PIL is the method getcolors() which should do exactly what you're looking for. The documentation from the PIL web documentation follows: getcolors im.getcolors() => a list of (count, color) tuples or None im.getcolors(maxcolors) => a list of (count, color) tuples or None (New in 1.1.5) Returns ...
1
3
0
I want to create a program that loads the RGB values of each pixel in a image and saves them in some kind of list/dictionary/tuple and then when I type in a value it tells me how much pixels in the image have that value. So far I have read through the whole PIL documentation trying to find a method that could fit my ne...
Pixel Loading and Evaluating with PIL
0.148885
0
0
2,218
7,627,752
2011-10-02T16:48:00.000
1
0
0
0
python,security,web-applications,authentication,login
7,627,865
2
false
1
0
It's hard to be specific without knowing your setup. However, the one thing you should not do is reinventing the wheel. Security is tricky, if your wheel is lacking something you may not know until it's too late. I wouldn't be surprised if your web framework came with a module/library/plugin for handling users, logins ...
1
5
0
I am making a web application in python and I would like to have a secure login system. I have done login systems many times before by having the user login and then a random string is saved in a cookie which is also saved next to that user in a database which worked fine but it was not very secure. I believe understan...
Secure authentication system in python?
0.099668
0
0
6,817
7,628,889
2011-10-02T20:07:00.000
1
0
0
1
python,django,sockets,mod-wsgi,freebsd
7,630,026
1
false
1
0
Use Celery or some other back end service which runs as root. Having a web application process run as root is a security problem waiting to happen. This is why mod_wsgi blocks you running daemon processes as root. Sure you could hack the code to disable the exclusion, but I am not about to tell you how to do that.
1
2
0
I'm currently writing a web application using Django, Apache, and mod_wsgi that provides some FreeBSD server management and configuration features, including common firewall operations. My Python/C library uses raw sockets to interact directly with the firewall and works perfectly fine when running as root, but raw so...
Python/C Raw Socket Operations using Django, Mod_WSGI, Apache
0.197375
0
0
344
7,629,288
2011-10-02T21:18:00.000
4
0
0
0
python,security,encryption,oauth
12,785,969
1
true
0
0
Hashing won't work, since, as skjaidev mentions, it's one way. If you have a reasonable fear that your file or database will get stolen(*), encryption is the way to go. But indeed as you mention, your app will need the decryption key, so the question is where to store it. Obviously storing it in the same spot as the da...
1
6
0
I'm developing a small webapp in python that'll interact with a users dropbox account. What is the best way to store the Oauth tokens for that account in a flat file? Is hashing the tokens secure enough? Or should I encrypt them? If encrypting them is the way to go, how would you suggest storing the key, since 2 way e...
Securely store Oauth token(s) in file
1.2
0
0
3,876
7,629,403
2011-10-02T21:38:00.000
1
1
0
0
python,real-time,pyserial
7,629,435
3
false
0
0
This is more a matter of latency than speed. Python always performs memory allocation and release, but if the data is reused, the same memory will be reused by the C library. So the OS (C library / UDP/IP stack) will have more impact than Python itself. I really think you should use a serial port on your RTOS machine a...
2
5
0
I have an infrared camera/tracker with which I am communicating via the serial port. I'm using the pyserial module to do this at the moment. The camera updates the position of a tracked object at the rate of 60 Hz. In order to get the position of the tracked object I execute one pyserial.write() and then listen for an ...
pyserial/python and real time data acquisition
0.066568
0
0
4,369
7,629,403
2011-10-02T21:38:00.000
0
1
0
0
python,real-time,pyserial
7,630,217
3
true
0
0
Python should keep up fine, but the best thing to do is make sure you monitor how many reads per second you are getting. Count how many times the read completed each second, and if this number is too low, write to a performance log or similar. You should also consider decoupling the I/O part from the rest of your pytho...
2
5
0
I have an infrared camera/tracker with which I am communicating via the serial port. I'm using the pyserial module to do this at the moment. The camera updates the position of a tracked object at the rate of 60 Hz. In order to get the position of the tracked object I execute one pyserial.write() and then listen for an ...
pyserial/python and real time data acquisition
1.2
0
0
4,369