I am using Apache 2.2.14 and Python 2.6 for CGI on Windows XP. Files sent through CGI get corrupted. A CR gets inserted before every LF. Firefox, IE, and Curl clients give the same result. The file is the correct size, but CR's are inserted throughout, and the data is shifted down and truncated. I can look at the file on the server, ...
Hi,
I realize that there is a griddata for numpy via matplotlib, but is there a griddata3 (same has griddata, but for higher dimensions).
In other words, I have (x,y,z,d(x,y,z)) where (x,y,z) form an irregular grid and d(x,y,z) is a scalar function of three variables. I need to generate d(xi,yi,zi) for a new set of (xi,yi,zi) points u...
I am using the Python ElementTree module to manipulate HTML.
I want to emphasize certain words, and my current solution is:
for e in tree.getiterator():
for attr in 'text', 'tail':
words = (getattr(e, attr) or '').split()
change = False
for i, word in enumerate(words):
word = clean_word.sub('', wo...
Given the code:
a=['a','b','c','d']
b=a[::-1]
print b
c=zip(a,b)
print c
c.sort(key=lambda x:x[1])#
print c
It prints:
['d', 'c', 'b', 'a']
[('a', 'd'), ('b', 'c'), ('c', 'b'), ('d', 'a')]
[('d', 'a'), ('c', 'b'), ('b', 'c'), ('a', 'd')]
Why does [('a', 'd'), ('b', 'c'), ('c', 'b'), ('d', 'a')] change to [('d', 'a'), ('c', 'b'), (...
Consider this code:
if __name__ == '__main__':
import pdb
pdb.run("interact()\n")
What does the following line mean?
if(__name__=='__main__')
I fainted.
...
I have an issue with my google app engine whereby I am using wmd to input text and save text. In preview mode, I can see the wmd formatted correctly as html, but when I switch to output, I just see unformatted wmd.
I have python-wmd installed, but am assuming that there is some sort of issue whereby python-wmd is being bypassed and ign...
Hi, I am learning how to code through this book called "Headfirst Programming", which I am really enjoying so far.
One of the projects in the book uses the following code:
def save_transaction(price, credit_card, description):
file = open("transactions.txt", "a")
file.write("%s%07d%s\n" % (credit_card, price * 100, description))
file....
What I need pyCairo to do is :
generate an image of size 100x100 containing some text and an image from filesystem as background
the text should be within a box which has text wrapping of size 20x20 with bottom left corner at (40,40).
save this image
...
f = open('transaction.log','r')
ClerkHash = dict()
arr = [0,0]
for line in f:
Tdate = line[0:12]
AccountKey = line[12:50]
TransType = line[22:2]
ClerkKey = line[24:10]
CurrencyCode = line[34:2]
Amount = line[36:45]
print line
print '\n'
print AccountKey
print '\n'
pri...
Hi:) I have got a small problem with template double extends system. I have got a scheme:
base.html ---> index.html ---> something.html
When I log in to the site I have got access to all invisible blocks (invisible blocks for anonymous users) like:
{% if user.is_superuser %}
blabla
{% endif %}
So "blabla" is visible for me, beca...
I'm looking for an alternative to the sched module which would allow me to cancel all events at any time. sched only allows to cancel single events by id (which is returned from the scheduler when an event is scheduled).
Any pointers to Python alternatives to sched would be appreciated.
Thanks
Toni p
...
The configuration below works fine on my remote host (same dir structure, same django), all admin media are served properly
settings
MEDIA_ROOT = '%s/static/' % FS_ROOT
STATIC_DOC_ROOT = '%s/static/' % FS_ROOT
MEDIA_URL = '/static/'
ADMIN_MEDIA_PREFIX = '%smedia/' % MEDIA_URL
urls
(r'^admin/', include(admin.site.urls)),
(r'^static/(...
I want to have different behavior in a python script, depending on the type of file. I cannot use the filename extension as it may not be present or misleading. I could call the file utility and parse the output, but I would rather use a python builtin for portability.
So is there anything in python that uses heuristics to deduce the ty...
I'm trying to distribute this app that I wrote in python. The application consists of 2 python scripts. 2 .glade files and 1 .png file.
Here is my dir structure on this project
vasm/
vasmcc.py
src/
vasm.py
gui/
vasm.glade
vasmset.glade
logo.png
vasmcc is just the python script for the gui... th...
Hi
i'm developing a small prototype of a desktop application using Qt and Python because i would like to distribute it in a multiplatform way.
A friend of mine is annoying me on messenger because he claims that there are not known cool mainstream desktop apps developed with Qt and python technologies so, what i am doing, is just an exerc...
I need magic tool, that helps me to understand where one my problem variable is changed in the code.
I know about perfect tool:
pdb.set_trace()
and I need something similar format, but about only one variable changing history.
For example, my current problem is strange value of context['request'] variable inside Django's tag templa...
I want to try Flash-Selenium with the python driver, however I have some concerns regarding the available python extension, it seems aged and there is no example on how to use it... Is there anybody who is using it? Any example on how to use it ?
...
This is relating to the following: (In Python Code)
for i in object:
doSomething(i)
versus
map(doSomething, object)
Both are easy to understand, and short, but is there any speed difference? Now, if doSomething had a return value we needed to check it would be returned as a list from map, and in the for loop we could either ...
I'm looking for a library to help me parse and transform DTDs using Python. The only thing I have found so far is xmlproc, but that seems ancient and doesn't seem to support serialization of DTDs. There's this for Java but I'd prefer a Python solution.
Edit: by "serialization" of DTDs I mean that ideally I'd like to be able to parse the...
Hi,
I'm using a custom MM/YY field and widget based on this example. I want to iterate over the individual month and year options defined in the widget class in order to apply "selected='selected'" to the MM/YY value that corresponds with the MM/YY value stored in the database. This seems like such a messy way of doing this, so if you...