I've started on a project graphing tomcat logs using gnuplot-py, specifically correlating particular requests with memory allocation and garbage collection. What is the
collective wisdom on gnuplot-py vs matplotlib for python graphing. Are there better graphing libraries out there I haven't heard of?
My general considerations are:
Wh...
I want to write a script to rename downloaded papers with their titles automatically, I'm wondering if there is any library or tricks i can make use of? The PDFs are all generated by TeX and should have some 'formal' structures.
...
How do I detect if the system is idle in windows using python. i.e. no keyboard or mouse activity.
This has already been asked before. And there seems to be no GetLastInputInfo in pywin32 module.
...
I need to write a function which will detect if the input contains at least one value which is non-numeric. If a non-numeric value is found I will raise an error (because the calculation should only return a numeric value). The number of dimensions of the input array is not known in advance - the function should give the correct value re...
It seems as thought getattribute has only 2 parameters (self, name).
However, in the actual code, the method I am intercepting actual takes arguments.
Is there anyway to access those arguments?
Thanks,
Charlie
...
Modifying Abstract Syntax Trees
I would like to be able to build and modify an ast and then optionally write it out as python byte code for execution later without overhead.
I have been hacking around with the ast docs for python3.0 and python2.6, but I can't seem to find any good sources on best practices for this type of code.
Quest...
While it is fairly trivial in Python to import a "child" module into another module and list its attributes, it becomes slightly more difficult when you want to import all child modules.
I'm building a library of tools for an existing 3D application. Each tool has its own menu item and sub menus. I'd like the tool to be responsible for...
When defining class attributes through "calculated" names, as in:
class C(object):
for name in (....):
exec("%s = ..." % (name,...))
is there a different way of handling the numerous attribute definitions than by using an exec? getattr(C, name) does not work because C is not defined, during class construction...
...
I do scientific programming, and often want to show users prompts and variable pairs, let them edit the variables, and then do the calulations with the new variables. I do this so often, that I wrote a wxPython class to move this code out of the main program. You set up a list for each variable with the type of the variable (string, fl...
Is there a simple way to run a Python script on Windows/Linux/OS X?
On the latter two, subprocess.Popen("/the/script.py") works, but on Windows I get the following error:
Traceback (most recent call last):
File "test_functional.py", line 91, in test_functional
log = tvnamerifiy(tmp)
File "test_functional.py", line 49, in tvname...
I'm trying to implement something like Rails dynamic-finders in Python (for
webapp/GAE). The dynamic finders work like this:
Your Person has some fields: name, age and email.
Suppose you want to find all the users whose name is "Robot".
The Person class has a method called "find_by_name" that receives the name
and returns the result...
How would I do this? The reason being I wanted to try some pygame out, but I have python 3 installed currently and have been learning with that. I'm also interested in trying out wxpython or something like that, but I haven't looked at their compatibilities yet.
EDIT:: im on a windows vista 64-bit
...
Has anybody succeeded with mod_wsgi 2.5 on Ubuntu 9.04 with default Python installation (2.6.2)?
I got compilation errors:
mod_wsgi.c:119:2: error: #error Sorry, mod_wsgi requires at least Python 2.3.0.
mod_wsgi.c:123:2: error: #error Sorry, mod_wsgi requires that Python supporting thread.
which Python gives /usr/bin/python and /usr/...
I'm using swig to wrap a class from a C++ library with python. It works overall, but there is an exception that is thrown from within the library and I can't seem to catch it in the swig interface, so it just crashes the python application!
The class PyMonitor.cc describes the swig interface to the desired class, Monitor.
Monitor's cons...
When attempting to tokenize a string in python3.0, why do I get a leading 'utf-8' before the tokens start?
From the python3 docs, tokenize should now be used as follows:
g = tokenize(BytesIO(s.encode('utf-8')).readline)
However, when attempting this at the terminal, the following happens:
>>> from tokenize import tokenize
>>> from i...
I'm using Django forms in my website and would like to control the order of the fields.
Here's how I define my forms:
class edit_form(forms.Form):
summary = forms.CharField()
description = forms.CharField(widget=forms.TextArea)
class create_form(edit_form):
name = forms.CharField()
The name is immutable and should only ...
I'm learning Django by building a simple recipes app. I have a 1 table model using the 'choices' field option for recipe categories rather than using a 2nd 'categories' table and a foreign key relationship. So i created db table via syncdb and then loaded table with test data. When i go to admin and click on the 'Recipes' link in an atte...
in a production environment running nginx reversing back to apache mpm-prefork/mod_wsgi, im seeing 90 apache child processes, when i would expect that 40 would be the maximum, as configured below. the configuration/setup is nothing exciting:
nginx is reverse proxying to apache via proxy_pass, and serving static media
apache only serves...
How does one debug a FastCGI application? I've got an app that's dying but I can't figure out why, even though it's likely throwing a stack trace on stderr. Running it from the commandline results in an error saying:
RuntimeError: No FastCGI Environment: 88 - Socket operation on non-socket
How do I set up a 'FastCGI Environtment' f...
I've run into the bug described at http://bugs.python.org/issue1327971 while trying to poll a file-like object returned by urllib2.urlopen().
Unfortunately, being relatively new to Python, I can't actually determine from the responses how to get around the issue as they seem mostly geared towards fixing the bug, rather than hacking the...