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
2,022,067
2010-01-07T17:01:00.000
4
0
0
0
python,payment-gateway,payment
2,258,716
5
true
1
0
You might want to take a look at Adyen (www.adyen.com). They are European and provide a whole lot of features and a very friendly interface. They don't charge a monthly or set up fee and seem to be reasonably priced per transaction. Their hosted payments page can be completely customised which was an amazing improvement for us.
3
9
0
I'm looking for a payment gateway company so we can avoid tiresome PCI-DSS certification and its associated expenses. I'll get this out the way now, I don't want Paypal. It does what I want but it's really not a company I want to trust with any sort of money. It needs to support the following flow: User performs actions on our site, generating an amount that needs to be paid. Our server contacts the gateway asynchronously (no hidden inputs) and tells it about the user, how much they need to pay. The gateway returns a URL and perhaps a tentative transaction ID. Our server stores the transaction ID and redirects the user to the URL provided by the gateway. The user fills out their payment details on the remote server. When they have completed that, the gateway asynchronously contacts our server with the outcome, transaction id, etc and forwards them back to us (at a predestined URL). We can show the user their order is complete/failed/etc. Fin. If at all possible, UK or EU based and developer friendly. We don't need any concept of a shopping basket as we have that all handled in our code already. We have (or at least will have by launch) a proper merchant banking account - so cover services like Paypay aren't needed. If their API covers Python (we're using Django) explicitly, all the better but I think I'm capable enough to decipher any other examples and transcode them into Python myself.
Looking for a payment gateway
1.2
0
1
3,656
2,022,067
2010-01-07T17:01:00.000
2
0
0
0
python,payment-gateway,payment
2,023,033
5
false
1
0
I just finished something exactly like this using First Data Global Gateway (don't really want to provide a link, can find with Google). There's no Python API because their interface is nothing but http POST. You have the choice of gathering credit card info yourself before posting the form to their server, as long as the connection is SSL and the referring URL is known to them (meaning it's your form but you can't store or process the data first). In the FDGG gateway "terminal interface" you configure your URL endpoints for authorization accepted/failed and it will POST transaction information. I can't say it was fun and their "test" mode was buggy but it works. Sorry, don't know if it's available in UK/EU but it's misnamed if it isn't :)
3
9
0
I'm looking for a payment gateway company so we can avoid tiresome PCI-DSS certification and its associated expenses. I'll get this out the way now, I don't want Paypal. It does what I want but it's really not a company I want to trust with any sort of money. It needs to support the following flow: User performs actions on our site, generating an amount that needs to be paid. Our server contacts the gateway asynchronously (no hidden inputs) and tells it about the user, how much they need to pay. The gateway returns a URL and perhaps a tentative transaction ID. Our server stores the transaction ID and redirects the user to the URL provided by the gateway. The user fills out their payment details on the remote server. When they have completed that, the gateway asynchronously contacts our server with the outcome, transaction id, etc and forwards them back to us (at a predestined URL). We can show the user their order is complete/failed/etc. Fin. If at all possible, UK or EU based and developer friendly. We don't need any concept of a shopping basket as we have that all handled in our code already. We have (or at least will have by launch) a proper merchant banking account - so cover services like Paypay aren't needed. If their API covers Python (we're using Django) explicitly, all the better but I think I'm capable enough to decipher any other examples and transcode them into Python myself.
Looking for a payment gateway
0.07983
0
1
3,656
2,022,178
2010-01-07T17:18:00.000
0
0
0
0
python,django,mod-python
2,022,368
3
false
1
0
A user's login status is stored using sessions. As far as I can tell from comparing trunk to the 0.96 source, the sessions are committed to a cookie the same way, and auth stores the user ID and backend the same way, so as long as the two apps use the same session storage and are on the same domain, it should work. (Just to be safe, I wouldn't use secure cookies in case the backend logic has changed - I didn't check out that part.) However, 0.96 did not feature pluggable session stores like modern Django does. Probably, to get a current version of Django to work with your 0.96 sessions, you would need to write a session backend for the current Django that connects to the 0.96 database and manipulates the sessions there. I'm not sure how well that would work, though.
3
0
0
Brand new to django. We have a legacy django project using django 0.96x that does authentication, ldap, etc., and it's pretty involved so we don't want to rewrite that code. We want to add a forum solution (off the shelf) but all of the ones I've seen so far require django 1.x I'm trying to figure out how to get this working and I've narrowed it down to the following: Use an old forum solution that works w/django 0.96 (does this exist?) Try to patch a forum solution to make it "backwards compatible" with 0.96 (possible nightmare) Use two different djangos: 0.96 and 1.x and (since we're using Apache w/mod_python) have two different Location directives; adjust PYTHONPATH for each appropriately (or use virtualenv, etc.) But will option #3 even work? I don't know enough about how django.contrib.auth and friends work so if I run two different versions of django will the user stay logged in? I didn't mention trying to patch our 0.96 project to bring it to 1.x but we don't really have the time to do that. Any suggestions?
Running Different Django Versions But Sharing Authentication
0
0
0
129
2,022,178
2010-01-07T17:18:00.000
1
0
0
0
python,django,mod-python
2,022,407
3
true
1
0
It's possible, but it may be pretty painful to do option #3. How about Option 4: bite the bullet and upgrade to Django 1.1.1. I did this with a couple of 0.97pre sites and it took less time than I thought it would. The biggest pain was dealing with admin stuff. Instead of going with separate admin.py files, we simply put the Admin classes directly below the Model classes. I use Mercurial for my DVCS and I just cloned, hacked, merged and it worked. It took about 3-5 hours per site and that included some custom template tag munging.
3
0
0
Brand new to django. We have a legacy django project using django 0.96x that does authentication, ldap, etc., and it's pretty involved so we don't want to rewrite that code. We want to add a forum solution (off the shelf) but all of the ones I've seen so far require django 1.x I'm trying to figure out how to get this working and I've narrowed it down to the following: Use an old forum solution that works w/django 0.96 (does this exist?) Try to patch a forum solution to make it "backwards compatible" with 0.96 (possible nightmare) Use two different djangos: 0.96 and 1.x and (since we're using Apache w/mod_python) have two different Location directives; adjust PYTHONPATH for each appropriately (or use virtualenv, etc.) But will option #3 even work? I don't know enough about how django.contrib.auth and friends work so if I run two different versions of django will the user stay logged in? I didn't mention trying to patch our 0.96 project to bring it to 1.x but we don't really have the time to do that. Any suggestions?
Running Different Django Versions But Sharing Authentication
1.2
0
0
129
2,022,178
2010-01-07T17:18:00.000
0
0
0
0
python,django,mod-python
2,029,226
3
false
1
0
It's possible to expose Django 0.96 tables to 1.1 - you can use unmanaged models wrapped around database VIEWs. In other words you issue: CREATE VIEW auth_user AS SELECT * from django096db.auth_user; (and similar cmd for other tables) and then you have Django 1.1 synchronized with 0.96 (assuming 0.96 tables are compatible with 1.1, I haven't checked that).
3
0
0
Brand new to django. We have a legacy django project using django 0.96x that does authentication, ldap, etc., and it's pretty involved so we don't want to rewrite that code. We want to add a forum solution (off the shelf) but all of the ones I've seen so far require django 1.x I'm trying to figure out how to get this working and I've narrowed it down to the following: Use an old forum solution that works w/django 0.96 (does this exist?) Try to patch a forum solution to make it "backwards compatible" with 0.96 (possible nightmare) Use two different djangos: 0.96 and 1.x and (since we're using Apache w/mod_python) have two different Location directives; adjust PYTHONPATH for each appropriately (or use virtualenv, etc.) But will option #3 even work? I don't know enough about how django.contrib.auth and friends work so if I run two different versions of django will the user stay logged in? I didn't mention trying to patch our 0.96 project to bring it to 1.x but we don't really have the time to do that. Any suggestions?
Running Different Django Versions But Sharing Authentication
0
0
0
129
2,022,211
2010-01-07T17:25:00.000
2
1
0
0
python,proxy,smtp,asyncore,smtpd
2,022,273
1
true
0
0
I think it's a fair assumption that given a good C version and a good Python version, the C version will be faster and more scalable but in your case, you might want to run a profiler and see why and where your program is not scaling up as much as the C version. Perhaps you can uncover the tight spots and optimise it to squeeze some more performance out of your code. Also, I don't know much about asyncore but the first Python library people seem to gravitate towards when they want to do async stuff is twisted. So, perhaps there is a performance improvement there.
1
2
0
i'm stress testing 2 different projects: one is proxsmtpd - smtp proxy written in C And the other one, smtp_proxy.py, which i developed under 1 hour, with use of asyncore and smtpd python modules. I stressed both projects under heavy load, and found out that proxsmtpd is able to hold 400 smtp sessions / sec, while my python program, is able to do only 160 smtp sessions /sec. So, my question is, does it because there are some performance limitations in asyncore, or C programs are just faster? Or maybe it's me, using asyncore in inefficient way?
Python asyncore vs plain old C
1.2
0
0
694
2,022,376
2010-01-07T17:48:00.000
1
0
1
0
python,wxpython,cherrypy
2,022,467
4
false
0
1
One way to decouple them would be to start them up as two separate processes and have them communicate via some kind of IPC mechanism. You might have to write a small adaptor to have them speak a common protocol. Since you're doing CherryPy, you might also be able to expose a control interface via HTTP which the wx GUI can use to drive your server.
1
7
0
I'm trying to make a cherrypy application with a wxpython ui. The problem is both libraries use closed loop event handlers. Is there a way for this to work? If I have the wx ui start cherrypy is that going to lock up the ui?
cherrypy and wxpython
0.049958
0
0
1,519
2,022,967
2010-01-07T19:17:00.000
1
0
1
0
python,desktop-application
2,022,996
4
false
0
0
wxPython is a phenomenal GUI toolkit for developing native applications. I highly recommend it. Also, if you combine it with py2exe you can create .exe files for running on Windows.
1
2
0
I'm interested in getting started w/ developing Python based applications for a desktop environment and have a few (seemingly simple) questions: What is the best method for developing GUI applications? I've seen several frameworks but the indexes I've found are a bit convoluted and mix (what seem to be) legacy packages. In your opinion, what is the best approach in this regard? I've been reading a few books I recently picked up, but have been having trouble finding (rather, recognizing) a decent 'getting started' tutorial that focuses on Python apps for the desktop. Do you have any recommendations? Thanks very much in advance! :)
Getting started w/ Python on the desktop
0.049958
0
0
4,623
2,023,458
2010-01-07T20:37:00.000
0
0
1
0
python,ruby-on-rails,ruby
2,023,828
3
false
1
0
If you're parsing data with python, presumably it's going be put into a database. As long as this is the case you can just run two apps standalone. Saying that, using one language and framework is a better solution, especially when you think that you won't be able reuse any code between the two applications if they are written in two different languages. Also I know Ruby has good libraries to do all of what is mentioned in your post, as I'm sure Python also does, so there seems little advantage in using the two together.
3
0
0
the front end and end-user data-collection we want to build in RoR since it's just some simple forms connected to a database. The integration with other external api's such as twitter and facebook and parsing of the data entered by the users we want to do in python, mostly because the developer for that part knows python. Is that possible?
dumb question alert: use *both* ruby on rails and python possible?
0
0
0
184
2,023,458
2010-01-07T20:37:00.000
0
0
1
0
python,ruby-on-rails,ruby
2,023,546
3
false
1
0
Yes, it is possible at some degree using Java. You may use JRuby and Jython in the same app.
3
0
0
the front end and end-user data-collection we want to build in RoR since it's just some simple forms connected to a database. The integration with other external api's such as twitter and facebook and parsing of the data entered by the users we want to do in python, mostly because the developer for that part knows python. Is that possible?
dumb question alert: use *both* ruby on rails and python possible?
0
0
0
184
2,023,458
2010-01-07T20:37:00.000
3
0
1
0
python,ruby-on-rails,ruby
2,023,703
3
true
1
0
It sounds like the only place the two parts will interact is the database: the RoR parts collect data from the user, the python parts collect data from Twitter and elsewhere. As long as your database is supported by both languages, there's no a priori reason why this wouldn't work. Even if you end up needing the two parts to interact more directly, there are plenty of ways of providing an API in one part of the app that the other parts of the app can use regardless of what language they're written in - for instance, it should be easy to have the RoR parts provide a nice RESTful API, and have the python parts interact through that. If you're going to have different parts of the app developed by different teams, they're going to need a strong interface contract in order to make their parts work together anyway; having that contract be in the form of a RESTful API just makes the parts even more modular and gives you more freedom in the future.
3
0
0
the front end and end-user data-collection we want to build in RoR since it's just some simple forms connected to a database. The integration with other external api's such as twitter and facebook and parsing of the data entered by the users we want to do in python, mostly because the developer for that part knows python. Is that possible?
dumb question alert: use *both* ruby on rails and python possible?
1.2
0
0
184
2,023,608
2010-01-07T20:57:00.000
3
0
1
0
python,debugging,exception,file
16,674,146
11
false
0
0
There are some limitations to the accepted response, in that it does not seem to count pipes. I had a python script that opened many sub-processes, and was failing to properly close standard input, output, and error pipes, which were used for communication. If I use the accepted response, it will fail to count these open pipes as open files, but (at least in Linux) they are open files and count toward the open file limit. The lsof -p solution suggested by sumid and shunc works in this situation, because it also shows you the open pipes.
3
65
0
I'm getting an error in a program that is supposed to run for a long time that too many files are open. Is there any way I can keep track of which files are open so I can print that list out occasionally and see where the problem is?
check what files are open in Python
0.054491
0
0
54,549
2,023,608
2010-01-07T20:57:00.000
1
0
1
0
python,debugging,exception,file
2,023,659
11
false
0
0
I'd guess that you are leaking file descriptors. You probably want to look through your code to make sure that you are closing all of the files that you open.
3
65
0
I'm getting an error in a program that is supposed to run for a long time that too many files are open. Is there any way I can keep track of which files are open so I can print that list out occasionally and see where the problem is?
check what files are open in Python
0.01818
0
0
54,549
2,023,608
2010-01-07T20:57:00.000
9
0
1
0
python,debugging,exception,file
2,023,691
11
false
0
0
On Linux, you can use lsof to show all files opened by a process.
3
65
0
I'm getting an error in a program that is supposed to run for a long time that too many files are open. Is there any way I can keep track of which files are open so I can print that list out occasionally and see where the problem is?
check what files are open in Python
1
0
0
54,549
2,025,311
2010-01-08T03:31:00.000
0
0
1
0
python
2,025,533
3
false
0
0
Another option is to set up a remote server on Slicehost or Rackspace cloud and SSH in from your friend's machine. You'll have full control over what libraries you want installed.
1
1
0
I'm in an interesting situation. My current computer is going to go in for repairs, and in the meantime I want to get some work done on a friend's computer, but I can't and really don't want to have to set up my development environment on the new PC. Is there a way I can carry around a working Python development environment on a Flash drive? At the very least I'm going to need the Python 2.6 Interpreter + all the libraries I've got installed, and some form of source control (preferably Mercurial).
mobile python 2.6 distribution/development environment?
0
0
0
120
2,025,964
2010-01-08T06:49:00.000
0
1
0
1
python,uri,decode,gstreamer,codec
2,026,830
1
true
0
0
I guess you can try to play it and see if that raises any error - in fact, there's no way to know the set of codecs necessary without opening the file. Some distributions even have hooks in place that ask the user to download the right codec when you start playing something.
1
1
0
I'm trying to write a simple command line audio player using the Python Gstreamer bindings. Is there a function in the gstreamer API that determines in advance whether or not a particular file (URI) can be decoded and played by the currently installed set of codecs?
How do you ask gstreamer if a file can be played?
1.2
0
0
208
2,026,091
2010-01-08T07:28:00.000
1
0
0
1
python,twisted
2,026,161
2
false
1
0
You could write something similar to paster's reloader, that would work like this: start your main function, and before importing / using any twisted code, fork/spawn a subprocess. In the subprocess, run your twisted application. In the main process, run your code which checks for changed files. If code has changed, reload the subprocess. However, the issue here is that unlike a development webserver, most twisted apps have a lot more state and just flat out killing / restarting the process is a bad idea, you may lose some state. There is a way to do it cleanly: When you spawn the twisted app, use subprocess.Popen() or similar, to get stdin/stdout pipes. Now in your subprocess, use the twisted reactor to listen on stdin (there is code for this in twisted, see twisted.internet.stdio which allows you to have a Protocol which talks to a stdio transport, in the usual twisted non-blocking manner). Finally, when you decide it's time to reload, write something to the stdin of the subprocess telling it to shutdown. Now your twisted code can respond and shut down gracefully. Once it's cleanly quit, your master process can just spawn it again. (Alternately you can use signals to achieve this, but this may not be OS portable)
1
3
0
I've written a specialized JSON-RPC server and just started working my way up into the application logic and finding it is a tad annoying to constantly having to stop/restart the server to make certain changes. Previously I had a handler that ran in intervals to compare module modified time stamps with the past check then reload the module as needed. Unfortunately I don't trust it to work correctly now. Is there a way for a reactor to stop and restart itself in a manner similar to Paster's Reloadable HTTPServer?
Strategies or support for making parts of a Twisted application reloadable?
0.099668
0
0
457
2,026,475
2010-01-08T09:05:00.000
4
0
0
0
python,postgresql,sqlalchemy,postgis
2,027,143
1
true
0
0
Table objects in SQLAlchemy have two roles. They can be used to issue DDL commands to create the table in the database. But their main purpose is to describe the columns and types of tabular data that can be selected from and inserted to. If you only want to select, then a view looks to SQLAlchemy exactly like a regular table. It's enough to describe the view as a Table with the columns that interest you (you don't even need to describe all of the columns). If you want to use the ORM you'll need to declare for SQLAlchemy that some combination of the columns can be used as the primary key (anything that's unique will do). Declaring some columns as foreign keys will also make it easier to set up any relations. If you don't issue create for that Table object, then it is just metadata for SQLAlchemy to know how to query the database. If you also want to insert to the view, then you'll need to create PostgreSQL rules or triggers on the view that redirect the writes to the correct location. I'm not aware of a good usage recipe to redirect writes on the Python side.
1
2
0
Two questions: i want to generate a View in my PostGIS-DB. How do i add this View to my geometry_columns Table? What i have to do, to use a View with SQLAlchemy? Is there a difference between a Table and View to SQLAlchemy or could i use the same way to use a View as i do to use a Table? sorry for my poor english. If there a questions about my question, please feel free to ask so i can try to explain it in another way maybe :) Nico
Work with Postgres/PostGIS View in SQLAlchemy
1.2
1
0
1,758
2,028,025
2010-01-08T14:01:00.000
2
0
1
0
python,image-editor
2,029,356
4
true
0
1
So, the fact is that creating a complex app with a nice UI takes time - I am just expanding a little bit on the answer by THC4k. PIL, at least PIL alone is useless for this: it does have some functions to manipulate images, but the complicate task here is creating and tunning your desired UI. That's where the widgets toolkits come in: You would have to pick a toolkit platform that can offer you buttons, images, load and save the image files, maybe some specialzed widgets you can use to create your color swatches, etc. both GTK+ and QT4.5 have a liberal license, are very complete and very unpythonic on their use :-( (While you are at it, when using these libraries and toolkits our app can easily be multiplatform: you don't have to make it windows specific, it is equally easy to create an app that will run on Windows, Linux and Mac using python and either GTK+ or Qt4) One thing I would suggest is for you to learn to proper use GIMP: it is an Image editor, and certainly it will lack a lot of tools you are needing for sprites: but you can expand it's capabilities with Python plug-ins. On the other hand GIMP does have thousands of features that you'd no longer will need to create for your stand-alone app. (think on layer support, color filters, image rotation etc...) Check around on how to install GIMP with Python support on Windows, then spend some hours learning the app, with some book-like text around preferably so you can find the hidden features. Ah, ok, finally: If you want a very simple thing, just for the taste of "i did it" - you can use Pygame: You have to do all the drawing on the window, including text - but have straighter access to pixels, colors, mouse clicks and coordinates than with GTK+ or Qt, in a sense it would be a lot less of overhead for you to learn in terms of API's and internal working.
2
6
0
I need a tile/sprite editor kind of like Pixen, but I couldn't find one for Windows so I thought it might be a good exercise for me to try and put one together. I use Python, so are there any libraries out there that are suited to the task of putting together a simple tile/sprite editor?
Creating an image editing application in Python
1.2
0
0
8,722
2,028,025
2010-01-08T14:01:00.000
6
0
1
0
python,image-editor
2,028,056
4
false
0
1
You just need a gui toolkit (gtk, qt, wx) a image library (PIL) and 500 hours of free time ...
2
6
0
I need a tile/sprite editor kind of like Pixen, but I couldn't find one for Windows so I thought it might be a good exercise for me to try and put one together. I use Python, so are there any libraries out there that are suited to the task of putting together a simple tile/sprite editor?
Creating an image editing application in Python
1
0
0
8,722
2,028,515
2010-01-08T15:22:00.000
0
0
0
0
python,django,authentication
17,344,403
5
false
1
0
I'm facing the exact same problem and I've been reading a lot (about how to solve that problem in 1.5) and I just thought of a much simpler solution. What if you just add a fixed-length prefix with the organization id to store the username? I.e. Organization id = 115, chosen username = "john" and a fixed length of 6. So in the data base you store as username "000115_john". When you do the login you just join the two parameters and try to authenticate with what Django provides. I'm not sure if the fixed length is strictly necessary but could avoid undesirable results if a user chooses a username with only numbers.
2
11
0
I'm working on a project in django which calls for having separate groups of users in their own username namespace. So for example, I might have multiple "organizations", and username should only have to be unique within that organization. I know I can do this by using another model that contains a username/organization id, but that still leaves this useless (and required) field on the defualt django auth User that I would have to populate with something. I've already written by own auth backend that authenticates a user against LDAP. However, as I mentioned before, I am still stuck with the problem of how to populate / ignore the username field on the default django user. Is there a way to drop the uniqueness constraint for the username for Django auth users?
Django - Allow duplicate usernames
0
0
0
9,747
2,028,515
2010-01-08T15:22:00.000
1
0
0
0
python,django,authentication
2,029,080
5
false
1
0
I have not personally been required to find a solution to this, but one way to tackle this (from an SAAS perspective) would be to prefix the username with an organizational identifier (presuming unique organizations). For example: subdomain.yoursite.com would equate to a user with the username: subdomain_username. You would just have to code some business logic on login to a subdomain to tack that onto the username.
2
11
0
I'm working on a project in django which calls for having separate groups of users in their own username namespace. So for example, I might have multiple "organizations", and username should only have to be unique within that organization. I know I can do this by using another model that contains a username/organization id, but that still leaves this useless (and required) field on the defualt django auth User that I would have to populate with something. I've already written by own auth backend that authenticates a user against LDAP. However, as I mentioned before, I am still stuck with the problem of how to populate / ignore the username field on the default django user. Is there a way to drop the uniqueness constraint for the username for Django auth users?
Django - Allow duplicate usernames
0.039979
0
0
9,747
2,028,723
2010-01-08T15:50:00.000
2
0
1
0
python,dictionary
2,028,783
6
false
0
0
dicts are for when the order isn't important but you want store values for different names. lists are ordered sequences of objects, usually of the same type and the position doesn't mean anything particular. tuples are ordered sequences of objects, possibly of different types and each different position has a specific meaning.
1
2
0
I hope somebody can help. I am using Python and I would like to be able to do the following. I have a set of objects (shapes for example) and a series of commands to act on these objects. The commands have the a format of a command string followed by a variable number of parameters which can be strings or integers For example the shape 'Rectangle' may have the following commands 'ChangeColor' 'green' 'FillStyle' 'hatch' 'Dimensions' 10 15 etc..... What would be the best data structure to store this information. I need to be able to easily retrieve these commands from the data structure given the 'shape' of the object. Would a dictionary be the correct choice, I have never used these before Thanks
Python data structures, dictionary?
0.066568
0
0
2,032
2,031,745
2010-01-09T00:27:00.000
2
0
0
0
python,http,urllib,python-2.6,python-2.x
2,031,786
3
false
0
0
There isn't any way to do that, which is precisely the reason urllib is deprecated in favour of urllib2. So just use urllib2 rather than writing new code to a deprecated interface.
1
0
0
I am trying to make an HTTP request in Python 2.6.4, using the urllib module. Is there any way to set the request headers? I am sure that this is possible using urllib2, but I would prefer to use urllib since it seems simpler.
Any way to set request headers when doing a request using urllib in Python 2.x?
0.132549
0
1
872
2,032,617
2010-01-09T06:49:00.000
2
0
0
1
python,user-interface,pygtk,interactive,spawn
2,032,648
2
false
0
0
Your main GUI thread will freeze if you spawn off a process and wait for it to completely. Often, you can simply use subprocess and poll it now and then for completion rather than waiting for it to finish. This will keep your GUI from freezing.
2
2
0
Python have been really bumpy for me, because the last time I created a GUI client, the client seems to hang when spawning a process, calling a shell script, and calling outside application. This have been my major problem with Python since then, and now I'm in a new project, can someone give me pointers, and a word of advice in order for my GUI python application to still be interactive when spawning another process?
Interactive Python GUI
0.197375
0
0
1,183
2,032,617
2010-01-09T06:49:00.000
4
0
0
1
python,user-interface,pygtk,interactive,spawn
2,032,635
2
false
0
0
Simplest (not necessarily "best" in an abstract sense): spawn the subprocess in a separate thread, communicating results back to the main thread via a Queue.Queue instance -- the main thread must periodically check that queue to see if the results have arrived yet, but periodic polling isn't hard to arrange in any event loop.
2
2
0
Python have been really bumpy for me, because the last time I created a GUI client, the client seems to hang when spawning a process, calling a shell script, and calling outside application. This have been my major problem with Python since then, and now I'm in a new project, can someone give me pointers, and a word of advice in order for my GUI python application to still be interactive when spawning another process?
Interactive Python GUI
0.379949
0
0
1,183
2,034,128
2010-01-09T17:07:00.000
1
1
0
0
python,turbogears
2,035,944
4
false
0
0
Don't quiz. Get some real (possibly broken) code from you vcs. Get them to tell you how they would fix it / add a feature. If they can, ask them to bring some samples of previous work.
2
7
0
If you were looking to hire a web developer who would primarily be working with TurboGears/Python - what sort of questions should you ask them?
Good interview questions for a Python/TurboGears web developer?
0.049958
0
0
2,484
2,034,128
2010-01-09T17:07:00.000
1
1
0
0
python,turbogears
2,034,217
4
false
0
0
Ask him for: Instrospection Model-View-Control design Documenting tools If he know a lot about that, surely know a lot about other issues.
2
7
0
If you were looking to hire a web developer who would primarily be working with TurboGears/Python - what sort of questions should you ask them?
Good interview questions for a Python/TurboGears web developer?
0.049958
0
0
2,484
2,034,373
2010-01-09T18:18:00.000
0
0
0
0
python,firefox,command-line-interface,bookmarks
2,034,590
2
false
0
0
I don't know about all the features you've mentioned but "Organize bookmars" option in the Bookmarks menu is pretty decent with respect to features.
1
1
0
Has anyone done a Python CLI to edit Firefox bookmarks ? My worldview is that of Unix file trees; I want find /re/ in given or all fields in given or all subtrees cd ls with context mv this ../there/ Whether it uses bookamrks.html or places.sqlite is secondary -- whatever's easier. Clarification added: I'd be happy to quit Firefox, edit bookmarks in the CLI, import the new database in Firefox. In otherwords, database locking is a moot point; first let's see code for a rough cut CLI. (Why a text CLI and not a GUI ? CLIs are simpler (for me), and one could easily program e.g. mv old-bookmarks to 2009/same-structure/. Nonetheless links to a really good bookmarker GUI, for Firefox or anything else, would be useful too.)
Python CLI to edit Firefox bookmarks?
0
0
1
2,530
2,034,517
2010-01-09T18:57:00.000
6
0
1
0
python,tabs,indentation,spaces
2,034,535
7
false
0
0
Just don't interchange them :) Set your IDE/editor to input 4 spaces upon pressing "tab" and you are good to go.
2
37
0
I decided, that I learn a bit of Python. The first introduction says that it uses indentation to group statements. While the best habit is clearly to use just one of these what happens if I interchange them? How many spaces will be considered equal to one tab? Or will it fail to work at all if tabs and spaces are mixed?
Python's interpretation of tabs and spaces to indent
1
0
0
54,473
2,034,517
2010-01-09T18:57:00.000
2
0
1
0
python,tabs,indentation,spaces
2,034,526
7
false
0
0
Four spaces are one tab (in my setup), but as far as I know, they are not interchanged. You can use either spaces or tabs, not both.
2
37
0
I decided, that I learn a bit of Python. The first introduction says that it uses indentation to group statements. While the best habit is clearly to use just one of these what happens if I interchange them? How many spaces will be considered equal to one tab? Or will it fail to work at all if tabs and spaces are mixed?
Python's interpretation of tabs and spaces to indent
0.057081
0
0
54,473
2,034,584
2010-01-09T19:13:00.000
0
0
1
0
python,database-design,google-app-engine
2,034,622
2
false
1
0
I'm not that familiar with Google App Engine, but here are some thoughts. First is to consider if "tags" are more appropriate than category & sub categories. Will their be a rigid 2 level category scheme? Will all items have a main and subcategory assignment? Rather than having a class for each category, have you considered a CategoryList class that would have a incrementCategoryByName(str name) method? The class contain a dictionary of classes without having to have the overhead of a class for each category.
1
1
0
I'm creating a Trivia app, and need some help designing my model relationships. This question may get fairly complicated, but I'll try to be concise. Trivia questions will all be part of a particular category. Categories may be a category within another category. If a trivia question is created/removed, I need to make sure that I also update a counter. In this way, I'll be able to see how many questions are in each category, and display that back to users. If a category has 'child' categories, I will need a way of displaying a cumulative counter of all sub-categories. Accurate tallies are fairly important, but not mission critical. I do not mind using sharded counters. My question is, how should I design this so that it will adopt GAE denormalization, and maintain optimization? I was thinking of having a Category class, with a ListProperty in each, which will represent the ancestor tree. It will contain a key to each parent entity in the tree, in order. But, should I also specify a parent when constructing the entities, or is that not needed in this case? I'm thinking that I may have to run my counter updates in transaction, which is why I am considering a parent-child relationship. Or perhaps there is more optimized way of designing my relationships that will still allow me to keep fairly accurate counters of all questions in each category. Thanks in advance for any help.
Datastore Design Inquiry
0
0
0
151
2,034,684
2010-01-09T19:46:00.000
1
0
0
1
python,django,google-app-engine
2,428,291
8
false
1
0
I prefer webapp. It scales better according to Google and seems to better integrated with the App Engine infrastructure. Plus it's more lightweight.
3
12
0
Currently I have a website on the Google App Engine written in Google's webapp framework. What I want to know is what are the benefits of converting my app to run with django? And what are the downsides? Also how did you guys code your GAE apps? Did you use webapp or django? Or did you go an entirely different route and use the Java api? Thanks
GAE and Django: What are the benefits?
0.024995
0
0
2,741
2,034,684
2010-01-09T19:46:00.000
2
0
0
1
python,django,google-app-engine
2,035,524
8
false
1
0
GAE is a great tool for new and small projects, that do not require a relational database. I use a range of web hosting solutions. 1) I built www.gaiagps.com on the App Engine, because it was just some brochureware, and a tiny key-value store for the blog part. 2) My colleague also built a web crawler on GAE, because it was just some simple Python scripts that collected web pages. That app actually sends the data over to EC2 though, where more work is done. 3) I host www.trailbehind.com on EC2 because it uses a geo-database (PostGIS) which you would basically have to implement yourself on App Engine. 4) I host TRAC and SVN on WebFaction, because it's off-the-shelf for any slice there. If I need to do a site in a couple of days, I use GAE. If it's a large or existing project, or has a funky database, I use something else.
3
12
0
Currently I have a website on the Google App Engine written in Google's webapp framework. What I want to know is what are the benefits of converting my app to run with django? And what are the downsides? Also how did you guys code your GAE apps? Did you use webapp or django? Or did you go an entirely different route and use the Java api? Thanks
GAE and Django: What are the benefits?
0.049958
0
0
2,741
2,034,684
2010-01-09T19:46:00.000
0
0
0
1
python,django,google-app-engine
2,590,020
8
false
1
0
try kay-framework if you are looking for framework specifically designed for google app engine.
3
12
0
Currently I have a website on the Google App Engine written in Google's webapp framework. What I want to know is what are the benefits of converting my app to run with django? And what are the downsides? Also how did you guys code your GAE apps? Did you use webapp or django? Or did you go an entirely different route and use the Java api? Thanks
GAE and Django: What are the benefits?
0
0
0
2,741
2,034,932
2010-01-09T21:00:00.000
0
0
0
0
python
2,035,429
9
false
0
1
A project I wish someone would write: a friendly GUI that wraps around the scanner library and the PDF library, and lets the user easily scan and file documents. It would have a toolbar with big buttons: "scan letter", "scan brochure", "scan photo". These would respectively choose high-resolution black-and-white, medium-resolution color, and high-resolution color. The user would plop down the document and hit one of those buttons. Python would wake up the scanner and have it scan, and then would use Python Image Library or something to auto-detect the size of the actual scanned document and auto-crop down to minimal size. For "scan photo" you would get a JPEG. For the others, you would get a PDF. And it would have an option where you could scan several pages and then select the scanned pages, and say "group" and it would make a single PDF out of them. Other useful toolbar buttons would be: "Copy Letter", "Copy Brochure", "Copy Photo". These would scan and then immediately print on an appropriate output device (or just on the default output device for your first version). If you want to go crazy, you could add an OCR function to try to recover searchable text from the scanned images, and put that in the PDF as tags or something. Someday I will write this if nobody else does...
4
7
0
I'm downloading Python 3.1.1 and that comes with the IDLE correct? I'm also downloading QT for Windows which I'm told is a good GUI framework to work with Python. What projects should I try to make in order to grasp some of the goodies Python brings to the table? Thanks a bunch SO.
What are some good projects to make for a newbie Python (but not new to programming) developer?
0
0
0
44,661
2,034,932
2010-01-09T21:00:00.000
3
0
0
0
python
2,035,296
9
false
0
1
Do the next project you intended to program with your prefered language with Python.
4
7
0
I'm downloading Python 3.1.1 and that comes with the IDLE correct? I'm also downloading QT for Windows which I'm told is a good GUI framework to work with Python. What projects should I try to make in order to grasp some of the goodies Python brings to the table? Thanks a bunch SO.
What are some good projects to make for a newbie Python (but not new to programming) developer?
0.066568
0
0
44,661
2,034,932
2010-01-09T21:00:00.000
1
0
0
0
python
2,035,019
9
false
0
1
Write a simple Text Editor. That was one of the projects i started when i first learned python. It gets you used to the GUI framework, file IO, many types, OOP, lots... It's something that you can grow over time as your confidence builds and it's cross platform so it's handy.
4
7
0
I'm downloading Python 3.1.1 and that comes with the IDLE correct? I'm also downloading QT for Windows which I'm told is a good GUI framework to work with Python. What projects should I try to make in order to grasp some of the goodies Python brings to the table? Thanks a bunch SO.
What are some good projects to make for a newbie Python (but not new to programming) developer?
0.022219
0
0
44,661
2,034,932
2010-01-09T21:00:00.000
1
0
0
0
python
2,034,997
9
false
0
1
If you are new to python, why not start with some simpler command line projects? I know you said you are not new to development, but maybe you should spend some time with the core python stuff before tacking on a GUI framework. Just a suggestion. Also, I would point out that Python 3+ code looks a bit different than a lot of the python 2.x code samples you will see around the internet. I have found Python 3 to be not the best in terms of backward compatibility. You might want to start out with a 2.x version of Python to get the most out of the plethora of Python tutorials on the internet, then move to Python 3 if you need it.
4
7
0
I'm downloading Python 3.1.1 and that comes with the IDLE correct? I'm also downloading QT for Windows which I'm told is a good GUI framework to work with Python. What projects should I try to make in order to grasp some of the goodies Python brings to the table? Thanks a bunch SO.
What are some good projects to make for a newbie Python (but not new to programming) developer?
0.022219
0
0
44,661
2,035,249
2010-01-09T22:40:00.000
5
0
0
1
python,qt,cross-platform
2,040,550
6
false
0
1
As other posters mentioned, the key issue is making sure you never touch a different non-Qt non-cross-platform API. Or really even a different non-Qt crossplatform API, if you use Qt you kind of need to commit to it, it's a comprehensive framework and for the most part sticking with Qt is easier than going to anything else. There's some nice advantages as the basic primitives in your program will work the same way all over the place. (i.e. a QString in your networking code will be the same as a QString in your interface code.) Portability-wise, if you stay within the API Qt provides you, it should work on multiple platforms. There will be areas where you may need to call some Qt functions which provide specific cross-platform tweaks more important to some platforms than others (e.g. dock icons) and you won't immediately have a polished application on all three platforms. But in general, you should remain very close to an application that compiles and runs on all three. (Try to use qmake or a similar build system too, as the build process for Qt applications varies depending on the platform. Different flags, etc.) There's some odd issues that come up when you mix Qt with other APIs like OpenGL, in particular the way windows locks GL contexts differs from the way OS X and Linux does, so if you intend to use OpenGL with multiple threads, try to periodically compile on the other platforms to make sure nothing is completely busted. This will also quickly point out areas where you might have inadvertently used a non-cross-platform system API. I've used Qt with a team to build a multi-threaded 3-d multiplayer real-time networked game (read: non-trivial application that fully utilized many many areas of Qt) and we were nothing but blown away by the effectiveness of Qt's ability to support multiple platforms. (We developed on OS X while targeting Windows and I regularly made sure it still ran on Linux as well.) We encountered only a few platform specific bugs, almost all of which arose from the use of non-Qt APIs such as OpenGL. (Which should really tell you something, that OpenGL was more of a struggle to use cross platform than Qt was.) At the end of the experience we were pleased at how little time we needed to spend dealing with platform-specific bugs. It was surprising how well we could make a GUI app for windows given almost none of the team actually used it as a primary development platform through the project. But do test early and often. I don't think your approach of writing an entire application and then testing is a good idea. It's possible with Qt, but unlikely if you don't have experience writing portable code and/or are new to Qt.
5
5
0
I'm under the impressions that Python runs in the Triforce smoothly. A program that runs in Windows will run in Linux. Is this sentiment correct? Having said that, if I create my application in QT For Windows, will it run flawlessly in Linux/Mac as well? Thanks.
If I use QT For Windows, will my application run great on Linux/Mac/Windows?
0.16514
0
0
1,271
2,035,249
2010-01-09T22:40:00.000
1
0
0
1
python,qt,cross-platform
2,035,284
6
false
0
1
Generally - as long as you don't use code that is not covered by Qt classes - yes. I have several time just recompiled applications I wrote in Linux(64bit) under Windows, and the other way arround. It works for me every time. Depends on your needs, you might also find compiler problems, but I am sure you will know how to work around them. Other people mentioned some issues you should look for, just read the other posts in the question.
5
5
0
I'm under the impressions that Python runs in the Triforce smoothly. A program that runs in Windows will run in Linux. Is this sentiment correct? Having said that, if I create my application in QT For Windows, will it run flawlessly in Linux/Mac as well? Thanks.
If I use QT For Windows, will my application run great on Linux/Mac/Windows?
0.033321
0
0
1,271
2,035,249
2010-01-09T22:40:00.000
0
0
0
1
python,qt,cross-platform
2,035,265
6
false
0
1
It might run well, but it will take some testing, and of course Qt only handles the GUI portability, not the myriad of other things that might cause portability problems. Qt apps generally don't fit in very well on MacOS because they don't have Applescript support by default and don't necessarily have the right keybindings. But if you do the work to fix those issues, they work, but not nicely. On the Mac, it's far better to build a native UI. If this is an in-house app, Qt is probably OK, but if it's for sale, you won't make many sales and will create yourself some support hassles.
5
5
0
I'm under the impressions that Python runs in the Triforce smoothly. A program that runs in Windows will run in Linux. Is this sentiment correct? Having said that, if I create my application in QT For Windows, will it run flawlessly in Linux/Mac as well? Thanks.
If I use QT For Windows, will my application run great on Linux/Mac/Windows?
0
0
0
1,271
2,035,249
2010-01-09T22:40:00.000
8
0
0
1
python,qt,cross-platform
2,035,272
6
true
0
1
Yes. No. Maybe. See also: Java and "write once, run anywhere". Filesystem layout, external utilities, anything you might do with things like dock icons, character encoding behaviors, these and more are areas you might run into some trouble. Using Qt and Python, and strenuously avoiding anything that seems tied to Windows-specific libraries or behaviors whenever possible will make running the application on Mac and Linux much easier, but for any non-trivial application, the first time someone tries it, it will blow up in their face. But through careful choice of frameworks and libraries, making the application work cross-platform will be much more like bug fixing than traditional "porting".
5
5
0
I'm under the impressions that Python runs in the Triforce smoothly. A program that runs in Windows will run in Linux. Is this sentiment correct? Having said that, if I create my application in QT For Windows, will it run flawlessly in Linux/Mac as well? Thanks.
If I use QT For Windows, will my application run great on Linux/Mac/Windows?
1.2
0
0
1,271
2,035,249
2010-01-09T22:40:00.000
0
0
0
1
python,qt,cross-platform
2,035,601
6
false
0
1
As the others said, everything which is done using Qt-Functionality will most likely run quite flawlessly, WHEN you dont use platform specific functionality of qt. There isnt that much (most of it has to do with window-manager stuff) , but some things might not work on other systems. But such things are surely mentiond in the documentation of Qt. Still there are things which cant be done using Qt, so you will have to do that yourself using plain Python... Yeah "Python" itself is platform-independent (well it should), but there are lots of other things involved ... well mainly the OS. And how the OS reacts you will plainly have to findout yourself by testing the application on all target OS. Recently i wrote an quite simple GUI-application, while it ran flawlessy on Windows, it didnt run on Linux, because on Linux Python interpreted files encoded in unicode differently than on Windows. Additionally a small script which should return the hostname of the machine, which it did on Windows, only returned "localhost" on Linux, which was obviously not what i wanted.
5
5
0
I'm under the impressions that Python runs in the Triforce smoothly. A program that runs in Windows will run in Linux. Is this sentiment correct? Having said that, if I create my application in QT For Windows, will it run flawlessly in Linux/Mac as well? Thanks.
If I use QT For Windows, will my application run great on Linux/Mac/Windows?
0
0
0
1,271
2,035,285
2010-01-09T22:52:00.000
2
0
1
0
python,file,merge,sorting
2,035,315
5
false
0
0
im thinking importing it into a db (mysql, sqlite, etc) will give better performance than merging it in script. the db typically has optimized routines for loading csv and the join will be probably be as fast or much faster than merging 2 dicts (one being very large) in python.
3
4
0
I have two groups of files that contain data in CSV format with a common key (Timestamp) - I need to walk through all the records chronologically. Group A: 'Environmental Data' Filenames are in format A_0001.csv, A_0002.csv, etc. Pre-sorted ascending Key is Timestamp, i.e.YYYY-MM-DD HH:MM:SS Contains environmental data in CSV/column format Very large, several GBs worth of data Group B: 'Event Data' Filenames are in format B_0001.csv, B_0002.csv Pre-sorted ascending Key is Timestamp, i.e.YYYY-MM-DD HH:MM:SS Contains event based data in CSV/column format Relatively small compared to Group A files, < 100 MB What is best approach? Pre-merge: Use one of the various recipes out there to merge the files into a single sorted output and then read it for processing Real-time merge: Implement code to 'merge' the files in real-time I will be running lots of iterations of the post-processing side of things. Any thoughts or suggestions? I am using Python.
Python synchronised reading of sorted files
0.07983
0
0
380
2,035,285
2010-01-09T22:52:00.000
1
0
1
0
python,file,merge,sorting
2,035,600
5
false
0
0
This is a similar to a relational join. Since your timestamps don't have to match, it's called a non-equijoin. Sort-Merge is one of several popular algorithms. For non-equijoins, it works well. I think this would be what you're called "pre-merge". I don't know what you mean by "merge in real time", but I suspect it's still a simple sort-merge, which is a fine technique, heavily used by real databases. Nested Loops can also work. In this case, you read the smaller table in the outer loop. In the inner loop you find all of the "matching" rows from the larger table. This is effectively a sort-merge, but with an assumption that there will be multiple rows from the big table that will match the small table. This, BTW, will allow you to more properly assign meaning to the relationship between Event Data and Environmental Data. Rather than reading the result of a massive sort merge and trying to determine which kind of record you've got, the nested loops handle that well. Also, you can do "lookups" into the smaller table while reading the larger table. This is hard when you're doing non-equal comparisons because you don't have a proper key to do a simple retrieval from a simple dict. However, you can easily extend dict (override __contains__ and __getitem__) to do range comparisons on a key instead of simple equality tests.
3
4
0
I have two groups of files that contain data in CSV format with a common key (Timestamp) - I need to walk through all the records chronologically. Group A: 'Environmental Data' Filenames are in format A_0001.csv, A_0002.csv, etc. Pre-sorted ascending Key is Timestamp, i.e.YYYY-MM-DD HH:MM:SS Contains environmental data in CSV/column format Very large, several GBs worth of data Group B: 'Event Data' Filenames are in format B_0001.csv, B_0002.csv Pre-sorted ascending Key is Timestamp, i.e.YYYY-MM-DD HH:MM:SS Contains event based data in CSV/column format Relatively small compared to Group A files, < 100 MB What is best approach? Pre-merge: Use one of the various recipes out there to merge the files into a single sorted output and then read it for processing Real-time merge: Implement code to 'merge' the files in real-time I will be running lots of iterations of the post-processing side of things. Any thoughts or suggestions? I am using Python.
Python synchronised reading of sorted files
0.039979
0
0
380
2,035,285
2010-01-09T22:52:00.000
0
0
1
0
python,file,merge,sorting
2,035,309
5
true
0
0
I would suggest pre-merge. Reading a file takes a lot of processor time. Reading two files, twice as much. Since your program will be dealing with a large input (lots of files, esp in Group A), I think it would be better to get it over with in one file read, and have all your relevant data in that one file. It would also reduce the number of variables and read statements you will need. This will improve the runtime of your algorithm, and I think that's a good enough reason in this scenario to decide to use this approach Hope this helps
3
4
0
I have two groups of files that contain data in CSV format with a common key (Timestamp) - I need to walk through all the records chronologically. Group A: 'Environmental Data' Filenames are in format A_0001.csv, A_0002.csv, etc. Pre-sorted ascending Key is Timestamp, i.e.YYYY-MM-DD HH:MM:SS Contains environmental data in CSV/column format Very large, several GBs worth of data Group B: 'Event Data' Filenames are in format B_0001.csv, B_0002.csv Pre-sorted ascending Key is Timestamp, i.e.YYYY-MM-DD HH:MM:SS Contains event based data in CSV/column format Relatively small compared to Group A files, < 100 MB What is best approach? Pre-merge: Use one of the various recipes out there to merge the files into a single sorted output and then read it for processing Real-time merge: Implement code to 'merge' the files in real-time I will be running lots of iterations of the post-processing side of things. Any thoughts or suggestions? I am using Python.
Python synchronised reading of sorted files
1.2
0
0
380
2,035,657
2010-01-10T01:06:00.000
4
0
0
1
python,linux,environment
2,035,693
4
false
0
0
Sometimes people run a mix of desktop environments. Make your app desktop-agnostic using xdg-utils; that means using xdg-open to open a file or url, using xdg-user-dir DOCUMENTS to find the docs folder, xdg-email to send e-mail, and so on.
1
6
0
How can I get to know what my desktop environment is using Python? I like the result to be gnome or KDE or else.
What is my current desktop environment?
0.197375
0
0
4,870
2,036,987
2010-01-10T12:25:00.000
2
1
0
0
python,testing,ide
10,032,718
15
false
0
0
Repl.it has a python interpreter and terminal among others. It may not be a full-fledged IDE. I'm not sure how you define that.
2
30
0
Is there any web-based IDE that I can use to run quick tests? There're a dozen for PHP and some for even Java but I haven't found yet that runs Python. If there's an open-source IDE available that I can host and run myself, that'd be better. Thanks
Online IDE for Python
0.02666
0
0
30,513
2,036,987
2010-01-10T12:25:00.000
1
1
0
0
python,testing,ide
2,037,081
15
false
0
0
I'm pretty sure that IDE's are the last kind of programs that will ever go web based, because a good IDE needs to be so extremely interactive if it wants to be good. I really don't see a reason for this and others seem to agree because there isn't any. And no, an interactive web shell or compiler has nothing to do with an IDE.
2
30
0
Is there any web-based IDE that I can use to run quick tests? There're a dozen for PHP and some for even Java but I haven't found yet that runs Python. If there's an open-source IDE available that I can host and run myself, that'd be better. Thanks
Online IDE for Python
0.013333
0
0
30,513
2,036,996
2010-01-10T12:28:00.000
0
0
0
0
python,sqlalchemy
2,037,291
2
true
0
0
I've found its a bug in sa, this happens only for string fields, they dont get server_default property for some unknow reason, filed a ticket for this already
1
0
0
hmm, is there any reason why sa tries to add Nones to for varchar columns that have defaults set in in database schema ?, it doesnt do that for floats or ints (im using reflection). so when i try to add new row : like u = User() u.foo = 'a' u.bar = 'b' sa issues a query that has a lot more cols with None values assigned to those, and db obviously bards and doesnt perform default substitution.
Problem with sqlalchemy, reflected table and defaults for string fields
1.2
1
0
900
2,037,290
2010-01-10T14:35:00.000
1
0
1
0
python,buildout
2,037,871
2
false
0
0
It is not the prettiest list, but you can look at .installed.cfg in your buildout's directory. For every part, it shows which options it knows about. (For some reason several parts are often shown multiple times).
1
6
0
I'd like to find out, exactly what variables are available when using zc.buildout. I can always look at the source, but ideally I'd find a list somewhere, or be able to query buildout to find out what it thinks are the variables available at any one time. Is this possible?
Listing buildout configuration variables
0.099668
0
0
1,096
2,040,769
2010-01-11T09:05:00.000
2
0
0
0
c++,python,qt,gnuradio
2,040,813
3
false
0
1
Spawn python script as a new process using fork() and execv(). execv() (or any other function of the exec family) lets you pass arguments to the Python script. Use the child process ID to send a kill signal when you are done with the Python script.
1
3
0
I try to explain the situation: I have a QT application written in C++ and QT. This QT application starts a separate console C++ application that runs in the background. These two communicate using perhaps sockets, don't know yet. Console C++ application needs to start and stop my gnuradio python script. Also it needs to send parameters to it. Once started, this gnuradio script runs independedly in infinite loop sending information to either the console or the QT application using sockets perhaps. My console application needs to stop this gnuradio script from running when the order is given by the QT application. The question is how can I stop this separate python script from my C++ console application ? Also is there anything I could do to make this more simple ? Regards, Spitz
Best way to start, stop and send parameters to separate Python script from C++ application?
0.132549
0
0
903
2,041,352
2010-01-11T11:02:00.000
2
0
1
0
python,usb,voice
2,041,675
3
false
0
0
I think the smart way is to leave it a professional Voice/IP app such as ribbit or Twilio. I would personally recommend twilio which has Python libraries
1
4
0
I'm writting a small python program to send voice file to other telephone. The phone is connected to pc over usb. How to make phone calls using Python?
How to make phone calls using Python?
0.132549
0
0
4,270
2,042,133
2010-01-11T13:37:00.000
1
0
0
0
python,sockets,protocols
2,042,187
4
false
0
0
Read some protocols, and try to find one that looks like what you need. Does it need to be message-oriented or stream-oriented? Does it need request order to be preserved, does it need requests to be paired with responses? Do you need message identifiers? Retries, back-off? Is it an RPC protocol, a message queue protocol?
1
3
0
I have built a Python server to which various clients can connect, and I need to set a predefined series of messages from clients to the server - For example the client passes in a name to the server when it first connects. I was wondering what the best way to approach this is? How should I build a simple protocol for their communication? Should the messages start with a specific set of bytes to mark them out as part of this protocol, then contain some sort of message id? Any suggestions or further reading appreciated.
Python Sockets - Creating a message format
0.049958
0
1
2,451
2,042,426
2010-01-11T14:34:00.000
4
0
1
1
python
2,042,452
6
false
0
0
$ python -c "import py_compile; py_compile.compile('yourfile.py')" or $ python -c "import py_compile; py_compile.compileall('dir')"
1
53
0
Is there a way to compile a Python .py file from the command-line without executing it? I am working with an application that stores its python extensions in a non-standard path with limited permissions and I'd like to compile the files during installation. I don't need the overhead of Distutils.
compile python .py file without executing
0.132549
0
0
87,360
2,043,058
2010-01-11T16:15:00.000
0
1
0
0
python,ruby,perl,http,scripting
2,043,069
12
false
1
0
What about using PHP+Curl, or just bash?
1
8
0
Often times I want to automate http queries. I currently use Java(and commons http client), but would probably prefer a scripting based approach. Something really quick and simple. Where I can set a header, go to a page and not worry about setting up the entire OO lifecycle, setting each header, calling up an html parser... I am looking for a solution in ANY language, preferable scripting
Scripting HTTP more effeciently
0
0
1
4,483
2,043,138
2010-01-11T16:26:00.000
1
0
0
0
javascript,python,django,cookies
2,043,172
2
false
1
0
The cookie was probably set with 'domain' parameter. Set the cookie to be accessible from all the subdomains of the domain the cookie is being set in. I'm not the python guy, but my knowledge of http protocol shows that this might be the problem.
2
2
0
I need to remove a cookie that was previously set for parent domain while browsing host at subdomain of the parent. I.e., a cookie "xyz" was set for example.com, and I am trying to remove it on subdomain.example.com, using Django backend. The request.COOKIES given to the view does not contain any cookies except those from subdomain.example.com, so I can't write just response.delete_cookie(...) in order to delete it. It is possible to perform such deletion either in Python or Javascript?
Could not get cookie from another (parent) domain in Django
0.099668
0
0
2,034
2,043,138
2010-01-11T16:26:00.000
0
0
0
0
javascript,python,django,cookies
2,043,336
2
false
1
0
You can attempt to call delete_cookie even for a cookie you haven't been able to read. Django will output the relevant Set-Cookie headers to delete the cookie regardless. Naturally the domain and path you pass to delete_cookie must match the cookie you intend to delete. However, if you haven't been able to read the cookie, it is likely there is another problem, which might prevent you deleting it. Are you sure the cookie from the parent domain was set with a domain=parentdomain.tld parameter? If not then it wouldn't be visible or deletable from the subdomain, except in IE due to that browser's bad handling of no-domain-specified cookies.
2
2
0
I need to remove a cookie that was previously set for parent domain while browsing host at subdomain of the parent. I.e., a cookie "xyz" was set for example.com, and I am trying to remove it on subdomain.example.com, using Django backend. The request.COOKIES given to the view does not contain any cookies except those from subdomain.example.com, so I can't write just response.delete_cookie(...) in order to delete it. It is possible to perform such deletion either in Python or Javascript?
Could not get cookie from another (parent) domain in Django
0
0
0
2,034
2,044,364
2010-01-11T19:33:00.000
0
0
1
0
python,netbeans
2,044,412
2
false
0
0
added solution is debugging if don't have any compiling error
1
0
0
When I run some python code in NetBeans, which raises an error, the output in NetBeans just gives an error message and no further information, such as line number. Is there any way to fix that?
NetBeans and Python
0
0
0
451
2,045,131
2010-01-11T21:36:00.000
2
1
0
0
php,python,session
2,045,154
1
true
1
0
In PHP, store the session information in a database, encoded in JSON. In Python, pull the session ID from the cookie and look up the session information in the database.
1
2
0
I have a sign up process that is in a legacy framework and we are trying to switch to a new framework...in fact a different language. So let's say that there are 3 steps in the sign up process and each of those 3 steps has it's own file(step1.php, step2.php, step3.php). Now if I want to change page2.php to a python file I will still need the session information from page1.php. How can I transfer this information between the two pages while maintaining a valid session and obviously security. We want to integrate this language switch in the same repository as the original one and doing releases of the new changes. So that's the agile part. (I'm still not sold that this is the best way to do it but I'm more curious)
Pass session information from php to python securely? (in agile)
1.2
0
0
575
2,045,175
2010-01-11T21:46:00.000
0
0
1
0
python,regex
2,045,196
8
false
0
0
A* means match "A" zero or more times. For an even number of "A", try: (AA)+
2
19
0
I need to match an expression in Python with regular expressions that only matches even number of letter occurrences. For example: AAA # no match AA # match fsfaAAasdf # match sAfA # match sdAAewAsA # match AeAiA # no match An even number of As SHOULD match.
Regex match even number of letters
0
0
0
30,176
2,045,175
2010-01-11T21:46:00.000
0
0
1
0
python,regex
2,045,190
8
false
0
0
First of all, note that /A*/ matches the empty string. Secondly, there are some things that you just can't do with regular expressions. This'll be a lot easier if you just walk through the string and count up all occurences of the letter you're looking for.
2
19
0
I need to match an expression in Python with regular expressions that only matches even number of letter occurrences. For example: AAA # no match AA # match fsfaAAasdf # match sAfA # match sdAAewAsA # match AeAiA # no match An even number of As SHOULD match.
Regex match even number of letters
0
0
0
30,176
2,046,727
2010-01-12T04:28:00.000
2
0
0
0
python,sockets
2,046,760
1
true
0
0
You should have your User class implement a fileno(self) method which returns self.thesocket.fileno() -- that's the way to make select work on your own classes (sockets only on windows, arbitrary files on Unix-like systems). Not sure what switch is supposed to me -- don't recognize it as a standard library (or built-in) Python concept...?
1
1
0
I more or less know how to use select() to take a list of sockets, and only return the ones that are ready to read/write something. The project I'm working on now has a class called 'user'. Each 'user' object contains its own socket. What I would like to do is pass a list of users to a select(), and get back a list of only the users where user.socket is ready to read/write. Any thoughts on where to start on this? Edit: Changed switch() to select(). I need to proofread better.
Creating waitable objects in Python
1.2
0
1
547
2,046,887
2010-01-12T05:25:00.000
0
0
0
0
python,django,geodjango
7,258,668
2
false
1
0
I am going to try something similar soon... I have a small database of about 40 locations, and I want the user to be able to filter these 40 locations by entering any zip code or city name, using a function that will return a list of location that are within a 5, 10, 15, 20, etc radius distance. I am thinking of using geocoding web services to store the lat/lng for each location in the database. Then when the user enters a city name or a zip code, use one web service call to get the latitude/longitude of that, and do a straightforward non-trigonometric distance calculation (driving distance) in a python list comprehension. So in answer to the question, I think that's what it involves but it could explode pretty fast if there is no way to limit the amount of calculations that need to be done.
1
0
0
How can I use geodjango to search by city and state or zip code in my django application? I am very new to geodjango and just trying to wrap my head around what would be involved in this. Also, does anyone know of an app that already implements this functionality?
geodjango - search by city, state or zip code
0
0
0
2,044
2,048,041
2010-01-12T10:02:00.000
2
0
1
0
python,matplotlib
10,303,500
4
false
0
0
There is a very good book: Sandro Tosi, Matplotlib for Python Developers, Packt Pub., 2009.
1
6
1
I have installed Matplotlib, and I have created two lists, x and y. I want the x-axis to have values from 0 to 100 in steps of 10 and the y-axis to have values from 0 to 1 in steps of 0.1. How do I plot this graph?
How do I plot a graph in Python?
0.099668
0
0
5,478
2,048,345
2010-01-12T10:57:00.000
0
0
0
1
python,open-source,development-environment
2,048,362
4
false
0
0
Install any of the Linux distributions on your computer. If you have a preference, great. If not, try Ubuntu, Fedora, Debian. Any of them is pretty user and developer friendly too. IDE, well I don't use one. But you may try NetBeans with Python support or Eclipse (with PyDev). Code style- well, try and learn to be pythonic. It should come with practice and asking questions I think that should get you started!
1
2
0
How to setup a Linux/Unix machine for python development? Which Linux/Unix version should I use? What IDE should be used? What development plugins should I have? What code style should would be THE BEST? All above, a great development machine for open source (python developers) development? Can i ask for screenshot of some great personalized IDE for Python? All platform users are invited. Please, do include the source/plugin/article how you made it. Thanks.
Can I ask for screenshot of some great personalized IDE for python?
0
0
0
266
2,048,874
2010-01-12T12:30:00.000
3
0
1
0
python,coding-style,copyright-display
2,049,123
4
false
0
0
As I know, there is currently no standard way. Each company/organization will have their own template to doc the copyright information. If this is your personal project, then just feel free to doc it in the way you feel most comforable. Adding a LICENSE file is a very common way for projects with many source files. Even in Python, there is currently no standard on the structure of docstrings. Python provides a lot of freedom, so just let it be dude ;)
1
39
0
What is the standard way of writing "copyright information" in python code? Should it be inside docstring or in block comments? I could not find it in PEPs.
Writing copyright information in python code
0.148885
0
0
32,264
2,049,247
2010-01-12T13:36:00.000
2
1
0
1
java,python,file,file-io
4,406,823
7
false
0
0
In Linux, Solaris, Unix this is easy. Just use rename() from your program or mv. The files need to be on the same filesystem. On Windows, this is possible if you can control both programs. LockFileEx. For reads, open a shared lock on the lockfile. For writes, open an exclusive lock on the lockfile. Locking is weird in Windows, so I recommend using a separate lock file for this.
6
31
0
How do I build up an atomic file write operation? The file is to be written by a Java service and read by python scripts. For the record, reads are far greater than writes. But the write happens in batches and tend to be long. The file size amounts to mega bytes. Right now my approach is: Write file contents to a temp file in same directory Delete old file Rename temp file to old filename. Is this the right approach? How can avoid conditions where the old file is deleted but the new filename is yet to be renamed? Do these programming languages (python and java) offer constructs to lock and avoid this situation?
Atomic file write operations (cross platform)
0.057081
0
0
15,100
2,049,247
2010-01-12T13:36:00.000
13
1
0
1
java,python,file,file-io
2,049,282
7
true
0
0
AFAIK no. And the reason is that for such an atomic operation to be possible, there has to be OS support in the form of a transactional file system. And none of the mainstream operating system offer a transactional file system. EDIT - I'm wrong for POSIX-compliant systems at least. The POSIX rename syscall performs an atomic replace if a file with the target name already exists ... as pointed out by @janneb. That should be sufficient to do the OP's operation atomically. However, the fact remains that the Java File.renameTo() method is explicitly not guaranteed to be atomic, so it does not provide a cross-platform solution to the OP's problem. EDIT 2 - With Java 7 you can use java.nio.file.Files.move(Path source, Path target, CopyOption... options) with copyOptions and ATOMIC_MOVE. If this is not supported (by the OS / file system) you should get an exception.
6
31
0
How do I build up an atomic file write operation? The file is to be written by a Java service and read by python scripts. For the record, reads are far greater than writes. But the write happens in batches and tend to be long. The file size amounts to mega bytes. Right now my approach is: Write file contents to a temp file in same directory Delete old file Rename temp file to old filename. Is this the right approach? How can avoid conditions where the old file is deleted but the new filename is yet to be renamed? Do these programming languages (python and java) offer constructs to lock and avoid this situation?
Atomic file write operations (cross platform)
1.2
0
0
15,100
2,049,247
2010-01-12T13:36:00.000
6
1
0
1
java,python,file,file-io
2,049,334
7
false
0
0
At least on POSIX platforms, leave out step 3 (delete old file). In POSIX, rename within a filesystem is guaranteed to be atomic, and renaming on top of an existing file replaces it atomically.
6
31
0
How do I build up an atomic file write operation? The file is to be written by a Java service and read by python scripts. For the record, reads are far greater than writes. But the write happens in batches and tend to be long. The file size amounts to mega bytes. Right now my approach is: Write file contents to a temp file in same directory Delete old file Rename temp file to old filename. Is this the right approach? How can avoid conditions where the old file is deleted but the new filename is yet to be renamed? Do these programming languages (python and java) offer constructs to lock and avoid this situation?
Atomic file write operations (cross platform)
1
0
0
15,100
2,049,247
2010-01-12T13:36:00.000
1
1
0
1
java,python,file,file-io
2,049,333
7
false
0
0
You could try and use an extra file to act as a lock, but I'm not sure if that will work out ok. (It would force you to create lock-checking and retry logic at both sides, java and python) Another solution might be to not create files at all, maybe you could make your java process listen on a port and serve data from there rather than from a file?
6
31
0
How do I build up an atomic file write operation? The file is to be written by a Java service and read by python scripts. For the record, reads are far greater than writes. But the write happens in batches and tend to be long. The file size amounts to mega bytes. Right now my approach is: Write file contents to a temp file in same directory Delete old file Rename temp file to old filename. Is this the right approach? How can avoid conditions where the old file is deleted but the new filename is yet to be renamed? Do these programming languages (python and java) offer constructs to lock and avoid this situation?
Atomic file write operations (cross platform)
0.028564
0
0
15,100
2,049,247
2010-01-12T13:36:00.000
3
1
0
1
java,python,file,file-io
2,049,395
7
false
0
0
It's a classic producer/consumer problem. You should be able to solve this by using file renaming, which is atomic on POSIX systems.
6
31
0
How do I build up an atomic file write operation? The file is to be written by a Java service and read by python scripts. For the record, reads are far greater than writes. But the write happens in batches and tend to be long. The file size amounts to mega bytes. Right now my approach is: Write file contents to a temp file in same directory Delete old file Rename temp file to old filename. Is this the right approach? How can avoid conditions where the old file is deleted but the new filename is yet to be renamed? Do these programming languages (python and java) offer constructs to lock and avoid this situation?
Atomic file write operations (cross platform)
0.085505
0
0
15,100
2,049,247
2010-01-12T13:36:00.000
1
1
0
1
java,python,file,file-io
2,049,386
7
false
0
0
Have the python scripts request permission from the service. While the service is writing it would place a lock on the file. If the lock exists, the service would reject the python request.
6
31
0
How do I build up an atomic file write operation? The file is to be written by a Java service and read by python scripts. For the record, reads are far greater than writes. But the write happens in batches and tend to be long. The file size amounts to mega bytes. Right now my approach is: Write file contents to a temp file in same directory Delete old file Rename temp file to old filename. Is this the right approach? How can avoid conditions where the old file is deleted but the new filename is yet to be renamed? Do these programming languages (python and java) offer constructs to lock and avoid this situation?
Atomic file write operations (cross platform)
0.028564
0
0
15,100
2,049,467
2010-01-12T14:08:00.000
1
0
1
0
python,dll,ipc,code-injection
4,621,980
2
false
0
0
If you don't care about realtime, then you can use the file system for communication: a log file for the DLL's output, and a config file that is read every now and then to change the DLLs behavior.
1
5
0
Hello stack overflow: Sometimes reader, first time poster. Background: Windows box running XP SP3, soon to be upgraded to Windows Seven (MSDNAA <3) I have an injected DLL which gets cycles by hooking a function that is called thousands of times a second. I would like to communicate/control this DLL via a python app. Basically, the DLL does the work, the python app supplies the brains/decision making. My game plan for doing this, is I would have a counter and an if statement in the DLL. Each time the hooked function is called, counter++ and then jump back to the original function until something like if ( counter == 250 ) { // dostuff(); }. My though behind this it will allow the target app to run mostly unimpeded, but will still let me do interesting things. Problem: I'm at an utter loss on which IPC method I should use to do the communication. We have sockets, shared memory, pipes, filemapping(?), RPC, and other (seemingly) esoteric stuff like writing to the clipboard. I've NEVER implemented any kind of IPC beyond toy examples. I'm fairly sure I need something that: Can handle talking back and forth between python and a DLL Doesn't block/wait Can check for waiting data, and continue if there isn't any If locks are involved, can continue instead of waiting Doesn't cost lots of time to read/write too Help? Thank you for your time, I hope I've provided enough general information and not broken any accepted conventions. I would like to add that the related questions box is very cool, and I did peruse it before posting.
IPC between python app and injected DLL
0.099668
0
0
745
2,050,256
2010-01-12T15:57:00.000
0
0
0
1
python,google-app-engine,proxy
2,218,463
5
false
1
0
I'm currently having the same problem and i was thinking about this solution (not yet tried) : -> develop an app that fetch what you want -> run it locally -> fetch your local server from your initial so the proxy is your computer which you know as not blocked Let me know if it's works !
3
4
0
My (Python) AppEngine program fetches a web page from another site to scrape data from it -- but it seems like the 3rd party site is blocking requests from Google App Engine! -- I can fetch the page from development mode, but not when deployed. Can I get around this by using a free proxy of some sort? Can I use a free proxy to hide the fact that I am requesting from App Engine? How do I find/choose a proxy? -- what do I need? -- how do I perform the fetch? Is there anything else I need to know or watch out for?
AppEngine fetch through a free proxy
0
0
0
888
2,050,256
2010-01-12T15:57:00.000
2
0
0
1
python,google-app-engine,proxy
2,050,288
5
false
1
0
Probably the correct approach is to request permission from the owners of the site you are scraping. Even if you use a proxy, there is still a big chance that requests coming through the proxy will end up blocked as well.
3
4
0
My (Python) AppEngine program fetches a web page from another site to scrape data from it -- but it seems like the 3rd party site is blocking requests from Google App Engine! -- I can fetch the page from development mode, but not when deployed. Can I get around this by using a free proxy of some sort? Can I use a free proxy to hide the fact that I am requesting from App Engine? How do I find/choose a proxy? -- what do I need? -- how do I perform the fetch? Is there anything else I need to know or watch out for?
AppEngine fetch through a free proxy
0.07983
0
0
888
2,050,256
2010-01-12T15:57:00.000
0
0
0
1
python,google-app-engine,proxy
3,731,700
5
false
1
0
Well to be fair, if they don't want you doing that then you probably shouldn't. It's not nice to be mean. But if you really want to do it, the best approach would be creating a simple proxy script and running it on a VPS or some computer with a decent enough connection. Basically you expose a REST API from your server to your GAE, then the server just makes all the same requests it gets to the target site and returns the output.
3
4
0
My (Python) AppEngine program fetches a web page from another site to scrape data from it -- but it seems like the 3rd party site is blocking requests from Google App Engine! -- I can fetch the page from development mode, but not when deployed. Can I get around this by using a free proxy of some sort? Can I use a free proxy to hide the fact that I am requesting from App Engine? How do I find/choose a proxy? -- what do I need? -- how do I perform the fetch? Is there anything else I need to know or watch out for?
AppEngine fetch through a free proxy
0
0
0
888
2,053,857
2010-01-13T01:47:00.000
0
0
1
0
python,svn,multiprocessing
2,053,972
2
false
0
0
You can keep polling the stdout of the svn process, and test how often you get new files. If you don't get a new file within x seconds, bounce the process. Launch svn using subprocess from within your master script, and poll stdout while waiting for the process to complete.
1
1
0
I have a python script to download source code from a list of repositories, some of them are big. Sometimes, svn hangs in the middle of a check out. Is there a way to watch over svn process, and so I know it is hang or not?
Watch over another process (svn)
0
0
0
695
2,053,949
2010-01-13T02:16:00.000
0
0
0
0
python,qt,pyqt4
2,060,398
1
false
0
1
Looking in Qt's source code, in the file src/gui/kernel/qwindowdefs.h, you'll find that WId is typedef'd to long for 64-bits OSX (it's int for 32-bits OSX). A long on 64-bits OSX is 8 bytes long (or 64 bits), and therefore 4318283408 is a valid value. If you want to force winId() to return a 32 bits value, you will need to link to a 32-bits version of the Qt's library.
1
0
0
Im trying to embed a display from an alien application (python OCC) into (Py)Qt using the winId of the widget. But when i pass it to OCC i get an overflow error. Inspecting the winId qt returns its 4318283408 which is more than a 32bit number. Im running 64bits (osx) and both libraries are compiled for 64bit, but i have a hunch that OCC only likes 32bit numbers still. So my question is, is there any way to control the range of the winId that Qt return? Thanks Henrik
Qt winId() forcing 32bit values
0
0
0
394
2,054,422
2010-01-13T04:32:00.000
1
0
1
0
python,regex,string
2,054,457
5
false
0
0
I would use ([^\d]+)?(\d{5})? as my regular expression, and use match so it only matches the beginning of the string. This way it won't fail on bad input and will make its best guess as to what was intended. Then you can split the first capture group on ",".
2
2
0
I'd like to be able to parse out the city, state or zip from a string in python. So, if I entered Boulder, Co 80303 Boulder, Colorado Boulder, Co 80303 ... any variation of these it would return the city, state or zip. This is all going to be user inputted data and inputted in one text field.
get city, state or zip from a string in python
0.039979
0
0
6,305
2,054,422
2010-01-13T04:32:00.000
3
0
1
0
python,regex,string
2,054,463
5
false
0
0
Just ask for their zip only, then give a (short) list of applicable cities by using a geocode database. That way you get nice clean 5-digit input, they save time, and you all go home happy. If you already have the data, look just for the zip, find a list of possible cities (there will only be one applicable state) and match for the city name after making everything lowercase.
2
2
0
I'd like to be able to parse out the city, state or zip from a string in python. So, if I entered Boulder, Co 80303 Boulder, Colorado Boulder, Co 80303 ... any variation of these it would return the city, state or zip. This is all going to be user inputted data and inputted in one text field.
get city, state or zip from a string in python
0.119427
0
0
6,305
2,054,626
2010-01-13T05:21:00.000
2
1
0
1
python,unix,signals,curses
2,054,648
2
true
0
0
See the termios module, and the termios(3) man page.
1
3
0
I'm writing a curses application in Python under UNIX. I want to enable the user to use C-Y to yank from a kill ring a la Emacs. The trouble is, of course, that C-Y is caught by my shell which then sends SIGTSTP to my process. In addition, C-Z also results in SIGTSTP being sent, so catching the signal means that C-Y and C-Z are not distinguishable (though even without this the only solutions I can think of are extremely hackish). I know what I'm asking is possible (in C if not in Python), since Emacs does it. How can I disable the shell's special handling of certain control characters sent from the keyboard and have the characters in question appear on the process' stdin?
How to disable shell interception of control characters?
1.2
0
0
543
2,055,355
2010-01-13T08:30:00.000
5
1
1
0
python,c,compilation,bytecode
2,055,381
5
true
0
0
I did it by creating .py library and simple .py program that uses that library. Then I compiled library to .pyc and distributed: program as .py source and library as compiled .pyc.
2
10
0
Is it possible to distribute only the bytecode version (.pyc file) of a Python script instead of the original .py file? My app embeds the Python interpreter and calls PyImport_Import to load a script. How can I tell it to look for a .pyc file and import that?
How to protect Python source code?
1.2
0
0
15,521
2,055,355
2010-01-13T08:30:00.000
5
1
1
0
python,c,compilation,bytecode
2,056,647
5
false
0
0
Since you are writing your main program in C++, you can do whatever you want to protect your Python files. You could encrypt them for distribution, then decrypt them just in time to import them into the Python interpreter, for example. Since you are using PyImport_Import, you can write your own __import__ hook to import the modules not from a file but from a memory buffer, so your transformation to .pyc file can happen all in memory, with no understandable Python code on disk at all.
2
10
0
Is it possible to distribute only the bytecode version (.pyc file) of a Python script instead of the original .py file? My app embeds the Python interpreter and calls PyImport_Import to load a script. How can I tell it to look for a .pyc file and import that?
How to protect Python source code?
0.197375
0
0
15,521
2,055,738
2010-01-13T09:51:00.000
1
0
1
0
python,string
2,055,750
7
false
0
0
Open the file Read each line and parse the line via line.split( )
1
1
0
I have a program which reads commands from a text file for example, the command syntax will be as follows and is a string 'index command param1 param2 param3' The number of parameters is variable from 0 up to 3 index is an integer command is a string all the params are integers I would like to split them so that I have a list as follows [index,'command',params[]] What is the best way to do this? Thanks
Help with Python strings
0.028564
0
0
203
2,056,594
2010-01-13T12:33:00.000
3
0
0
1
python,popen
2,056,745
3
true
0
0
The Popen object is effectively just a wrapper for the child processes PID, stdin, stdout, and stderr, plus some convenience functions for using those. So the question is why do you need access to the Popen object? Do you want to communicate with the child, terminate it, or check whether it's still running? In any case there is no way reacquire a Popen object for an already running process. The proper way to approach this is to launch the child as a daemon, like Tobu suggested. Part of the procedure for daemonising a process is to close stdin and stdout, so you cannot use those to talk to the child process. Instead most daemons use either pipes or sockets to allow clients to connect to them and to send them messages. The easiest way to talk to the child is to open a named pipe from the child process at e.g. /etc/my_pipe, open that named pipe from the parent / controlling process, and write / read to / from it. After a quick look at python-daemon it seems to me that python-daemon will help you daemonise your child process, which is tricky to get right, but it doesn't help you with the messaging side of things. But like I said, I think you need to tell us why you need a Popen object for the child process before we can help you any further.
2
2
0
I have a python program that uses subprocess.Popen to launch another process (python process or whatever), and after launching it I save the child's PID to a file. Let's suppose that suddenly the parent process dies (because of an exception or whatever). Is there any way to access again to the object returned by Popen? I mean, the basic idea is to read the file at first, and if it exists and it has a PID written on it, then access to that process someway, in order to know the return code or whatever. If there isn't a PID, then launch the process with Popen. Thanks a lot!!
Recover process with subprocess.Popen?
1.2
0
0
1,293
2,056,594
2010-01-13T12:33:00.000
1
0
0
1
python,popen
2,056,808
3
false
0
0
If a process dies, all its open file handles are closed. This includes any unnamed pipes created by popen(). So, no, there's no way to recover a Popen object from just a PID. The OS won't even consider your new process the parent, so you won't even get SIGCHLD signals (though waitpid() might still work). I'm not sure if the child is guaranteed to survive, either, since a write to a pipe with no reader (namely, the redirected stdout of the child) should kill the child with a SIGPIPE. If you want your parent process to pick up where the child left off, you need to spawn the child to write to a file, usually in /tmp or /var/log, and have it record its PID like you are now (the usual location is /var/run). (Having it write to a named pipe risks getting it killed with SIGPIPE as above.) If you suffix your filename with the PID, then it becomes easy for the manager process to figure out which file belongs to which daemon.
2
2
0
I have a python program that uses subprocess.Popen to launch another process (python process or whatever), and after launching it I save the child's PID to a file. Let's suppose that suddenly the parent process dies (because of an exception or whatever). Is there any way to access again to the object returned by Popen? I mean, the basic idea is to read the file at first, and if it exists and it has a PID written on it, then access to that process someway, in order to know the return code or whatever. If there isn't a PID, then launch the process with Popen. Thanks a lot!!
Recover process with subprocess.Popen?
0.066568
0
0
1,293
2,056,752
2010-01-13T13:03:00.000
0
1
1
0
java,python,properties
2,056,762
6
false
1
0
Do you want to create new fields/getters/setters in the class? If you want to do this in runtime, you have to create completely new class with your fields and methods, and load it into the JVM. To create new class you can use library like ASM or CGLib, but if you're new to Java, this isn't something you want to start with.
2
10
0
I'm new to Java, and I'd like to create some class variables that are dynamically calculated when accessed, as you can do in Python by using the property() method. However, I'm not really sure how to describe this, so Googling shows me lots about the Java "Property" class, but this doesn't appear to be the same thing. What is the Java equivalent of Python's property()?
What is the Java Equivalent of Python's property()?
0
0
0
3,624
2,056,752
2010-01-13T13:03:00.000
2
1
1
0
java,python,properties
2,056,814
6
false
1
0
They don't really exist. In Java it's common practice to declare members as private or protected and only allow access to them via methods. Often this leads to lots of small getFoo() and setFoo(newFoo) methods. Python doesn't really have private and protected and it's more common to allow direct access to members.
2
10
0
I'm new to Java, and I'd like to create some class variables that are dynamically calculated when accessed, as you can do in Python by using the property() method. However, I'm not really sure how to describe this, so Googling shows me lots about the Java "Property" class, but this doesn't appear to be the same thing. What is the Java equivalent of Python's property()?
What is the Java Equivalent of Python's property()?
0.066568
0
0
3,624
2,058,492
2010-01-13T16:45:00.000
8
0
0
0
c++,python,qt,pyqt,pyside
2,058,512
3
true
0
1
We were recently thinking about using PySide, but we haven't found any information about whether it is supported by py2exe. That's why we kept to PyQt. If you need to develop for Windows, it's safer to use good ol' PyQt :-)
3
18
0
I currently develop many applications in a Qt heavy C++/Python environment on Linux, porting to PC/Mac as needed. I use Python embedded in C++ as well as in a stand alone GUI. Qt is used fro xml parsing/event handling/GUI/threading and much more. Right now all my Python work is in PyQt and I wanted to see how everyone views PySide. I'm interested because it is in house and as such should support more components with hopefully better integration. What are your experiences? I know this has been asked before, but I want to revive the conversation.
PyQt vs PySide comparison
1.2
0
0
9,387
2,058,492
2010-01-13T16:45:00.000
-1
0
0
0
c++,python,qt,pyqt,pyside
2,058,548
3
false
0
1
PySide currently does not run on Windows, which limits your capability. If you were developing on Linux and needed to avoid pure GPL, then PySide is a candidate. From an API standpoint, I find the signal/slots capability feels more "Pythonic".
3
18
0
I currently develop many applications in a Qt heavy C++/Python environment on Linux, porting to PC/Mac as needed. I use Python embedded in C++ as well as in a stand alone GUI. Qt is used fro xml parsing/event handling/GUI/threading and much more. Right now all my Python work is in PyQt and I wanted to see how everyone views PySide. I'm interested because it is in house and as such should support more components with hopefully better integration. What are your experiences? I know this has been asked before, but I want to revive the conversation.
PyQt vs PySide comparison
-0.066568
0
0
9,387
2,058,492
2010-01-13T16:45:00.000
0
0
0
0
c++,python,qt,pyqt,pyside
4,828,827
3
false
0
1
As of PySide 1.0 beta (Qt 4.7.1), there is an official Windows installer that works. It doesn't include QtDesigner and other tools, only uic.
3
18
0
I currently develop many applications in a Qt heavy C++/Python environment on Linux, porting to PC/Mac as needed. I use Python embedded in C++ as well as in a stand alone GUI. Qt is used fro xml parsing/event handling/GUI/threading and much more. Right now all my Python work is in PyQt and I wanted to see how everyone views PySide. I'm interested because it is in house and as such should support more components with hopefully better integration. What are your experiences? I know this has been asked before, but I want to revive the conversation.
PyQt vs PySide comparison
0
0
0
9,387
2,058,532
2010-01-13T16:50:00.000
3
0
0
0
python,django
3,299,378
10
false
1
0
My worst mistake was using absolute imports like <project_name>.<app_name>.models rather than <app_name>.models. This way when I made a branch and wanted to check it out in different directory (like having and -stable of my project), it wouldn't run. I managed to revert in one project and use only relative imports in one project, but in another, larger one, we have to stick with it (we have there both absolute and relative). I won't make this mistake again.
6
23
0
What are the worst mistakes made using Django framework, that you have noticed? Have you seen some real misuses, that maybe should go as warnings to the Django docs?
Worst practices in Django you have ever seen
0.059928
0
0
2,848
2,058,532
2010-01-13T16:50:00.000
5
0
0
0
python,django
2,060,365
10
false
1
0
Monkeying around with pre-save and post-save events. If you can't simply do it in save, you should probably rethink what you're trying to do. After all, it's just a relational database under the hood. If what you're doing gets too complex, you'll have ORM mapping issues. Trying to write uber-generic -- one view does it all -- functionality. View functions are functions for a reason. They can use modules, packages, objects, other functions, etc. They can be short and similar without it being a code smell. If you need to use 10 lines of code to construct the uber-generic-do-it-all object and it would have been a 12-line view function without the uber-generic-do-it-all object, then the uber-object isn't helping. Imposing too much super-sophisticated object class design on the ORM model classes. If it requires abstract base classes or metaclasses, it won't do well in the ORM layer. Failing to make use of tests.py and the test client to create complete unit tests of whatever it's claimed that the application does.
6
23
0
What are the worst mistakes made using Django framework, that you have noticed? Have you seen some real misuses, that maybe should go as warnings to the Django docs?
Worst practices in Django you have ever seen
0.099668
0
0
2,848
2,058,532
2010-01-13T16:50:00.000
5
0
0
0
python,django
3,496,620
10
false
1
0
Not using raw_id fields for a key to 10000+ objects, then wondering why visiting the Admin brings a server to its knees
6
23
0
What are the worst mistakes made using Django framework, that you have noticed? Have you seen some real misuses, that maybe should go as warnings to the Django docs?
Worst practices in Django you have ever seen
0.099668
0
0
2,848
2,058,532
2010-01-13T16:50:00.000
9
0
0
0
python,django
2,058,929
10
false
1
0
I think the biggest problem is that people try to code as if this were Java/C: They try to create overly generic applications that need never be changed when future requirements change (which is necessary for Java/C because those apps aren't so easy to change/redesign). What results is a hideously complicated application, which is inflexible and impossible to maintain. It's just not necessary in Django: just write for today's requirements, build reusable apps with defined, specific tasks and make changes when needed. More and more often I find myself trying to write things as simply as possible, avoiding overly complicated designs at all costs.
6
23
0
What are the worst mistakes made using Django framework, that you have noticed? Have you seen some real misuses, that maybe should go as warnings to the Django docs?
Worst practices in Django you have ever seen
1
0
0
2,848
2,058,532
2010-01-13T16:50:00.000
12
0
0
0
python,django
2,058,590
10
false
1
0
Not splitting stuff up into multiple applications. It's not so much about reusability as it is about having a dozen models, and over 100 views in one app, it's damned unreadable. Plus I like to be able to scan my urls.py file easily to see where a URL points, when I have 100 URLs that gets harder.
6
23
0
What are the worst mistakes made using Django framework, that you have noticed? Have you seen some real misuses, that maybe should go as warnings to the Django docs?
Worst practices in Django you have ever seen
1
0
0
2,848
2,058,532
2010-01-13T16:50:00.000
27
0
0
0
python,django
2,060,303
10
false
1
0
Too much logic in views. I used to write views that would struggle to fit in 40 lines. Now I consider more than 2-3 indentation levels, 10 or so LOC or a handful of inline comments in a view to be code smells. The temptation is to write minimal models, figure out your url routing, then do everything else in the view. In reality, you should be using model methods, managers, template tags, context processors, class-based views with abstract base views... anything to keep the view code simple and readable. Logic around saving forms should go in Form.save(). Logic repeated at the start or end of multiple views should go in decorators. Reused display logic should go in included templates, template tags, and filters. Long views are hard to read, understand, and debug. Learn to use the other tools in you toolkit any you'll save yourself and your team a lot of pain.
6
23
0
What are the worst mistakes made using Django framework, that you have noticed? Have you seen some real misuses, that maybe should go as warnings to the Django docs?
Worst practices in Django you have ever seen
1
0
0
2,848
2,059,337
2010-01-13T18:52:00.000
3
1
0
1
python,ruby,linux,scripting,release
2,059,364
4
true
1
0
I would create a branch in SVN for every release of web application and when the release is ready there, I would check it out on the server and set to be run or move it into the place of the old version.
3
1
0
I am purely a windows programmer and spend all my time hacking VC++. Recently I have been heading several web based applications and myself built applications with python (/pylons framework) and doing projects on rails. All the web projects are hosted on ubuntu linux. The RELEASE procedures and check list we followed for building and releasing VC++ windows application are merely no more useful when it comes to script based language. So we don't built any binaries now. I copied asp/php files into IIS folder through ftp server when using open source cms applications. So FTP is the one of the way to host the files to the web server. Now we feel lazy or not so passionate to copy files via ftp instead we use the SVN checkout and we simply do svn update to get the latest copy. Is SVN checkout and svn update are the right methods to update the latest build files into the server? Are there any downside in using svn update? Any better method to release the script/web based scripts into the production server? PS: I have used ssh server at some extension on linux platform.
Practices while releasing the python/ruby/script based web applications on production
1.2
0
0
242