I'm developing/testing a package in my local directory. I want to import it in the interpreter (v2.5), but sys.path does not include the current directory. Right now I type in "sys.path.insert(0,'.')". Is there a better way?
Also, "from . import mypackage" fails with this error: "ValueError: Attempted relative import in non-package"
...
I'm using Carrot for a message queue in a Django project and followed the tutorial, and it works fine. But the example runs in the console, and I'm wondering how I apply this in Django. The publisher class I'm calling from one of my models in models.py, so that's OK. But I have no idea where to put the consumer class.
Since it just sit...
Are there any security exploits that could occur in this scenario:
eval(repr(unsanitized_user_input), {"__builtins__": None}, {"True":True, "False":False})
where unsanitized_user_input is a str object. The string is user-generated and could be nasty. Assuming our web framework hasn't failed us, it's a real honest-to-god str instance f...
Hi Guys,
I am trying to get a post-commit.bat script running on a Windows Vista Ultimate machine for Trac.
I have installed Trac and its working fine - but when I run this script I get the error:
"The Python Win32 extensions for NT (service, event, logging) appear not to be Available."
Anyone know why this would occur ?
...
I'm trying to programatically get a list of installed fonts in C or Python. I need to be able to do this on OS X, does anyone know how?
...
App Engine allows you 30 seconds to load your application
My application takes around 30 seconds - sometimes more, sometimes less. I don't know how to fix this.
If the app is idle (does not receive a request for a while), it needs to be re-loaded.
So, to avoid the app needing to be reloaded, I want to simulate user activity by pingin...
Hi, I'm looking for a pure Python library which works like Tidy. Please kindly advise. Thank you.
...
What is the best way to match two songs? IE. Have a song stored in the database in whatever format is best and then play another song and match the two together?
In Python ideally please.
Thanks!
...
I have a small Python program, which uses a Google Maps API secret key. I'm getting ready to check-in my code, and I don't want to include the secret key in SVN.
In the canonical PHP app you put secret keys, database passwords, and other app specific config in LocalSettings.php. Is there a similar file/location which Python programm...
There is a lot of discussions of Python vs Ruby, and I all find them completely unhelpful, because they all turn around why feature X sucks in language Y, or that claim language Y doesn't have X, although in fact it does. I also know exactly why I prefer Python, but that's also subjective, and wouldn't help anybody choosing, as they migh...
Hello All ...
I have been looking into different systems for creating a fast cache in a web-farm running Python/mod_wsgi. Memcache and others are options ... But I was wondering:
Because I don't need to share data across machines, wanting each machine to maintain a local cache ...
Does Python or WSGI provide a mechanism for Python nat...
I am using pdb to examine a script having called run -d in an ipython session.
It would be useful to be able to plot some of the variables but I need them in the main ipython environment in order to do that.
So what I am looking for is some way to make a variable available back in the main interactive session after I quit pdb. If you ...
I have a process id in Python. I know I can kill it with os.kill(), but how do I check if it is alive ? Is there a built-in function or do I have to go to the shell?
...
I have very simple window where I have 2 buttons - one for cancel, one for apply. How to set the button for apply as default one? (When I press enter, "apply" button is pressed)
However, I want to set focus to the first input widget (I can't use grab_focus() on the button)
Any suggestions?
Edit:
After wuub's answer it works visually g...
In this sample code the URL of the app seems to be determined by this line within the app:
application = webapp.WSGIApplication([('/mailjob', MailJob)], debug=True)
but also by this line within the app handler of app.yaml:
- url: /.*
script: main.py
However, the URL of the cron task is set by this line:
url: /tasks/summary
So ...
How I can make a Makefile, because it's the best way when you distribute a program by source code. Remember that this is for a C++ program and I'm starting in the C development world. But is it possible to make a Makefile for my Python programs?
...
I'm currently attempting to migrate a legacy VBA/Microsoft Access application to Python and PyQt. I've had no problems migrating any of the logic, and most of the forms have been a snap, as well. However, I've hit a problem on the most important part of the application--the main data-entry form.
The form is basically a row of text boxes...
Basically, I have a model where I've created a superclass that many other classes share, and then each of those classes has some unique features that differ from each other. Let's say class A is the superclass, and class B, C, and D are children of that class.
Both class B and class C can have multiples of class D, however I've seen tha...
OK, so I know that from-import is "exactly" the same as import, except that it's obviously not because namespaces are populated differently.
My question is primarily motivated because I have a utils module which has one or two functions that are used by every other module in my app, and I'm working on incorporating the standard library ...
Example:
regular_string = "%s %s" % ("foo", "bar")
result = {}
result["somekey"] = regular_string,
print result["somekey"]
# ('foo bar',)
Why result["somekey"] tuple now not string?
...