Hi,
I want to store the images related to a each person's profile in the DB and retrieve them
when requested and save it as .jpg file - and display it to the users.
How could I render the image data stored in the DB as an image and store it locally??
...
I want to put all the requirements of a repoze Zope2 install in a pip requirements file. Most of the repoze packages don't seem to be on PyPi, but there's an alternative PyPi index for them here. But I can't figure out how to tell pip to use that index together with a requirements file. For single packages, it's easy
pip install zopelib...
I have written a epytext to reST markup converter, and now I want to convert all the docstrings in my entire library from epytext to reST format.
Is there a smart way to read the all the docstrings in a module and write back the replacements?
ps: ast module perhaps?
...
Do you know any easy way to find a logging call that throws "not enough argumenst for format string".
On my workstation I've modified logging/__init__.py to print the msg so I can easily find the line in the source.
But do you have any idea what to do on the testing environment where you can't change python standard library nor run pdb...
I'm trying to figure out how to parse a VCard to a Python dictionary using VObject.
vobj=vobject.readOne(string)
print vobj.behavior.knownChildren
This is all I get:
{'CATEGORIES': (0, None, None), 'ADR': (0, None, None), 'UID': (0, None, None), 'PHOTO': (0, None, None), 'LABEL': (0, None, None), 'VERSION': (1, 1, None), 'FN': (1, 1,...
I'm trying to run a webapp/site on my machine, it's running on OSX 10.6.2 and I'm having some problems:
Caught an exeption while rending: The _imagingft C module is not installed
Doing import _imagingft in python gives me this:
>>> import _imagingft
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: ...
I'm trying to better understand the concept of 'autocommit' when working with a Postgres (psycopg) connection. Let's say I have a fresh connection, set its isolation level to ISOLATION_LEVEL_AUTOCOMMIT, then run this SQL directly, without using the cursor begin/rollback methods (as an exercise; not saying I actually want to do this):
I...
I have a very trimmed down example that creates a segfault that I can't seem to get rid of. Python script calls a C function in an extension, which creates a new thread using pthreads. I use PyGILState_Ensure and PyGILState_Release around my python call (PyRun_SimpleString) in the new thread, but perhaps I'm not using them correctly or...
I get the following error when I try to run sample example of Google adwords
[root@some v200909]# python get_related_keywords.py Traceback (most recent call last): File "get_related_keywords.py", line 53, in
page = targeting_idea_service.Get(selector)[0] File "../../aw_api/TargetingIdeaService.py", line 105, in Get
'T...
I have a list of dictionaries. I need to check if all the dictionaries in that list are empty. I am looking for a simple statement that will do it in one line.
Is there a single line way to do the following (not including the print)?
l = [{},{},{}] # this list is generated elsewhere...
all_empty = True
for i in l:
if i:
all_empty...
Hello. Since my pc's fan is very loud, I'd like to make myself a program to "shut it up" when it's not required to be running at full speed. I want to make it with python, so is there any module that can detect the temperature and/or set the fan speed?
...
I'm having trouble using os.utime to correctly set the modification time on the mac (Mac OS X 10.6.2, running Python 2.6.1 from /usr/bin/python). It's not consistent with the touch utility, and it's not consistent with the properties displayed in the Finder's "get info" window.
Consider the following command sequence. The 'created' and ...
Hi,
I am working with a django project, I haven't started. The developed working on the project left. During the knowledge transfer, it was told to me that all the events are logged to the database. I don't find the database interface useful to search for logs and sometimes they don't even log(I might be wrong). I want to know, if there...
Hi folks,
I'm just wondering, I often have really long python files and imports tend to stack quite quickly.
PEP8 says that the imports should always be written at the beginning of the file.
Do all the imported libraries get imported when calling a function coded in the file? Or do only the necessary libraries get called?
Does it m...
Hi,
I need to call a c library from my python code. The c library does a lot of image manipulation, so I am passing it image buffers allocated using create_string_buffer.
The problem is that I also need to manipulate and change these buffers. What is the best way to reach in and twiddle individual values in my buffers? The buffers a...
I am attempting to write a python daemon that will launch at boot. The goal of the script is to receive a job from our gearman load balancing server and complete the job. I am using the python-daemon module from pypi (http://pypi.python.org/pypi/python-daemon/). The nature of the job that it is completing is converting images in the or...
I'm not sure what's the appropriate terminology here, but I'd like to have an application running passively that is ready to accept commands without having to reinitialize the whole thing.
The precise application is a machine learning system written in Python that takes a somewhat long time to train a classifier or to load a cached clas...
I'm trying to compile a very simple wxPython script into an executable by using PyInstaller on Windows Vista.
The Python script is nothing but a Hello World in wxPython. I'm trying to get that up and running as a Windows executable before I add any of the features that the program needs to have. But I'm already stuck.
I've jumped throu...
We have numerous projects in our organization that are mixed Python/C. Currently we're trying to standardize on a directory layout for our projects and are trying to come up with a convenient scheme. One point of contention is where to put C extension modules in the tree.
We're tossing around a couple of options (relative to project roo...
Hi, I'm developing a logger daemon to squid to grab the logs on a mongodb database. But I'm experiencing too much cpu utilization. How can I optimize this code?
from sys import stdin
from pymongo import Connection
connection = Connection()
db = connection.squid
logs = db.logs
buffer = []
a = 'timestamp'
b = 'resp_time'
c = 'src_ip'
d...