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.
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
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
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.
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 simple python script, 'first.py':
#first.py
def firstFunctionEver() :
print "hello"
firstFunctionEver()
I want to call this script using : python first.py and have it call the firstFunctionEver(). But, the script is ugly -- what function can I put the call to firstFunctionEver() in and have it run when the script is loaded?
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?
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?
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?
Hi,
I have a Python script that takes the directory path of a text file and converts it into an excel file. Currently I have it running as a console application (compiled with py2exe) and prompts the user for the directory path through raw_input().
How do i make it such that I can drag & drop my text file directly into the .exe of the python script?
Thanks,
I have a script that I want to exit early under some condition:
if not "id" in dir():
print "id not set, cannot continue"
# exit here!
# otherwise continue with the rest of the script...
print "alright..."
[ more code ]
I run this script using execfile("foo.py") from the Python interactive prompt and I would like the script to exit going back to the command line. How do I do this? If I use sys.exit(), the Python interpreter exits completely.
I'm trying to find a tool to check for coding style in python.
For php I've seen there is the Code Sniffer, and a small perl script used by Drupal. Is there such a tool for python code?
Thanks
What protocol preferred to use for interaction between Python-code and Erlang-code over Internet? ASN.1 would be ideally for me, but its implementation in Python cannot generate encoder/decoder out from notation.
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 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'm not quite sure how to build a really simple one-file source module. Is there a sample module out there one the web somewhere which can be built as a python .egg?
From the setuptools page it looks pretty simple, you just have your setup.py file and then at least one other .py file somewhere, and I can build an .egg file OK, and even install it using easy_install, but I can't seem to import the file from within python. (note: using 2.6.4)
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 Python 3.
So I would like to consider alternatives for buildout. I know that both virtualenv and pip work on Python 3 - 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.
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?
Emacs uses an older version of python(2.3) i have for the default python mode, is there a way for me to tell emacs to use the newer version that i have in my home directory?
btw I'm using a red hat distro and dont have root privileges.
I am a newcomer to Python and am converting a Perl script. What is the Python equivalent to...
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
Any help is greatly appreciated.
Hi,
I am unable to display images in pages created using Google App Engine(Python).
My app.yaml file has :
- url: /images
static_dir: images
And the python file has:
self.response.out.write("""<img src = '/images/title.gif' />""")
The image still does not display in the page.
Thanks
How to create simple web site with python?
I mean really simple, f.ex, you see text "Hello World", and there are button "submit", which (onClick) will show ajax box "submit successful".
I want to start develop some stuff with Python, and I don't know where to start :)
I've been reading a lot about python-way lately so my question is
How to do dependency injection python-way?
I am talking about usual scenarios when, for example, service A needs access to UserService for authorization checks.