I am looking for an easily implemented html generator for python. I found this one
http://www.decalage.info/python/html
but there is no way to add css elements (id, class) for table.
thx
I've got some tests that need to count the number of warnings raised by a function. In Python 2.6 this is simple, using
with warnings.catch_warnings(record=True) as warn:
...
self.assertEquals(len(warn), 2)
Unfortunately, with is not available in Python 2.4, so what else could I use? I can't simply check if there's been a single warning (using warning filter with action='error' and try/catch), because the number of warnings is significant.
/Users/smcho/Desktop/bracket/[10,20] directory has "abc.txt", but when I run this python code
import glob
import os.path
path1 = "/Users/smcho/Desktop/bracket/\[10,20\]"
pathName = os.path.join(path1, "*.txt")
print glob.glob(pathName)
It returns empty list.
Can't python's glob doesn't handle the bracket letters or others?
Is there any way to solve this problem?
I want to convert PPT to png, or other image formats using Python.
This question has been asked on SO, but essentially recommends running OpenOffice in headless X server, which was an absolute pain last time I used it. (Mostly due to hard to replicate bugs due to OO crashing.)
Is there any other way, (Hopefully using Linux CLI utilities only, and pure Python above them?)
I'm currently working on sprite sheet tool in python that exports the organization into an xml document but I've run into some problems trying to animate a preview. I'm not quite sure how to time the frame rate with python. For example, assuming I have all of my appropriate frame data and drawing functions, how would I go about coding the timing to display it at 30 frames per second (or any other arbitrary rate).
Hello all,
I am working on writing a simple python application for linux (maemo). However I am getting SyntaxError: invalid syntax on line 23: with open(file,'w') as fileh:
The code can be seen here: http://pastebin.com/MPxfrsAp
I can not figure out what is wrong with my code, I am new to python and the "with" statement. So, what is causing this code to error, and how can I fix it? Is it something wrong with the "with" statement?
Thanks!
One of our page templates is made up of a bunch of macros. These items are a bunch of html tables.
Now, I want a couple of these tables in a Python script to create a PDF. Is there a way call a macro from a Python script and get back the HTML that is produced?
If so, can you explain?
Thanks
Eric
I am trying to use str.encode() but I get
>>> "hello".encode(hex)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: must be string, not builtin_function_or_method
I have tried a bunch of variations and they seem to all work in Python 2.5.2, so what do I need to do to get them to work in Python3.1?
I'd like to be able to raise another application's Window using Python.
I did see this, which I suppose I could try:
http://stackoverflow.com/questions/1028972/x11-raise-an-existing-window-via-command-line
However, I'd prefer to do it in Python if at all possible.
I am looking for a library to generate svg diagrams in python (I fetch data from a sql database). I have found python-gd, but it has not much documentation and last update was in 2005 so I wonder if there are any other libraries that are good for this purpose.
I am mostly thinking about simple line graphs, something like this:
I've got 30 unopened Lego Mindstorms kits that I'd love to use in my intro programming class to do some simple robotics stuff at the end of the year. We're using Python in the class, so I'd prefer there to be a way for the kids to write the programs in Python. Unfortunately, these are old kits with RCX bricks - not the newer NXT ones, so most of the projects like NXT_Python can't help me. Is there any way to make that happen?
Hello everyone,
I am trying to read my emails using a Python script (Python 2.5 and PyPy)
Some of my results are not in ASCII and i get strings like this:
=?ISO-8859-7?B?0OXm7/Dv8d/hIPP07+0gyuno4enx/u3h?='
Is there any way to decode it and convert to utf-8 so that i can process it?
I tried .decode('ISO-8859-7') but i got the same string
what is the best module /package in python to use des /3des for encryption /decryption.
could someone provide example to encrypt data with des/3des on python.
Hello
I'm coding a demo in python and I need to read a MIDI file in python (no real-time stuff is needed).
In particular, I'm looking for a library which preserves channel information.
The most promising libraries I found are:
http://code.google.com/p/midiutil/
http://www.mxm.dk/products/public/pythonmidi
Any experience with those?
Thanks a lot
Nicola Montecchio
Say I have a function foo that I want to call n times. In Ruby, I would write:
n.times { foo }
In Python, I could write:
for _ in xrange(n): foo()
But that seems like a hacky way of doing things.
My question: Is there an idiomatic way of doing this in Python?
My project uses buildout to do primarily two things: automatically fetch dependencies and create scripts; and setup cron jobs (on deployment machines) using the usercrontab buildout recipe.
But buildout is not yet available for Python3.
So I would like to consider alternatives for buildout. I know that both virtualenv and pip work on Python3 - but what is the preferred tool to automate the build toolchain (of creating virtualenv, and automatically installing/upgrading deps)? There is fabric, paver, and so on. What is your preferred tool of choice in this case? It must work seamlessly on both Windows and *nix.
i have a python script which keeps crashing on:
subprocess.call(["pdftotext", pdf_filename])
the error being:
OSError: [Errno 2] No such file or directory
the absolute path to the filename (which i am storing in a log file as i debug) is fine; on the command line, if i type pdftotext <pdf_filename_goes_here> it works for any of the alledgedly bad file names. but when called using subprocess in python i keep getting that error.
what is going on???
Is there a cross-platform way to list the processes running on one's computer through a python script? For Unix based system "ps -ef" works, but I am new to Python and don't know a way to write something that would work across any platform.
Thanks!
I have seen various articles about good Python editors/IDEs, like this. However, none of them points out whether the editors support automatic code completion. I tried notepad++, PyScript and Komodo Edit, but all of these requires a hotkey to invoke the code completion dialog.
Do you know any Python editors with automatic code completion?
Is there such a thing as a "translator" (for lack of a better word in my mind now) that translates Python code directly to JVM / Dalvik bytecode?
Would be great for writing Android applications in Python!
NOTE: I know about the scripting capabilities of the Android platform but I am looking for something that would generate a '.apk' without having to install the 'scripting' package... annoying for end-users.
I'm debugging Python code with pdb.
The code need input from stdin, like:
python -m pdb foo.py < bar.in
Then the pdb will accept the bar.in as commands.
How to tell pdb that the input is for foo.py and not for pdb?
Is there an official documentation on python website somewhere, on how to install and run multiple versions of python on the same machine? On linux?
I can find gazillions of blog posts and answers - but I want to know if there is a "standard" official way of doing this?
Or is this all dependent on OS?
I tried to implement XOR sort in python.
x,y= 10,20
x,y,x = x^y,x^y,x^y
print('%s , %s'%(x,y))
OUTPUT:
30 , 30
I am not new to python but I am unable to explain this output. It should have been 20,10.
What is going on under the hood?