Archive for June, 2009

Making py2exe Work with Paramiko

Friday, June 26th, 2009

When running py2exe with a script importing Paramiko I noticed this in the output:

The following modules appear to be missing ... paramiko ...

And then in the log file created when I run the exe I saw this:

Traceback (most recent call last):
 ...
ImportError: No module named paramiko

This has to do with py2exe not being able to handle egg files. So what I did is pulled out the paramiko directory from the egg, and placed that in my site-packages directory, and then deleted the egg. It works now though the setup function still tells me this:

The following modules appear to be missing
['Crypto.PublicKey._fastmath', 'Crypto.Util.winrandom', '_ssl', 'r_hmac']

Luckily as far as I can tell, I don’t use those modules anywhere.

This guy had the same problem and
made some sort of programmatic solution
but it didn’t work for me. Since when I ran the setup function, it didn’t throw an ImportError.

Mini Searches with Answers

Saturday, June 20th, 2009

These are links associated with recent searches I’ve done. They’re not difficult enough to warrant to their own posts but still super useful.

Arduino Tutorial – Lesson 3 – Breadboards and LEDs
How to work with a breadboard from your Arduino

GPSBabel: convert, upload, download data from GPS and Map programs
Maybe a way to finally read *.lcm files. It claims it will convert them to Google Earth KML format.

Python – Get Function Arguments from Inside Function
args, _, _, values = inspect.getargvalues(inspect.currentframe())

Tags: , , , , , , , , , , , , , , ,

Tips for Using the Paramiko SFTP Client

Friday, June 19th, 2009

The Paramiko library seems to be the best way to do an SFTP client in Python.

Here is a good example of set up and usage.

However in connecting to a WS FTP server, I was still hitting some problems.

When I tried to do:

sftp.get(remotepath='setup.py',localpath='setup.py')

I got:

*** IOError: Folder not found: setup.py

and when I tried:

sftp.sftp.get(remotepath='./setup.py',localpath='setup.py')

I got:

*** IOError: [Errno 13] Permission Denied!

It turns out the trick for working with WS FTP Server, you need to reference your files as current_directory/filename. (no idea why!)

So the correct command is:

sftp.sftp.get(remotepath='greg/setup.py',localpath='setup.py')

where greg is my current working directory (yes, even though I’m already in that directory!)

PyCrypto – Fixing Setup script exited with error: The .NET Framework SDK needs to be instal led before building extensions for Python

Thursday, June 18th, 2009

So here’s this horrible thing that happening to me when trying to install Paramiko on Windows XP:

C:\Documents and Settings\gpinero>easy_install paramiko
Searching for paramiko
Best match: paramiko 1.7.4
Processing paramiko-1.7.4-py2.4.egg
paramiko 1.7.4 is already the active version in easy-install.pth

Using c:\python24\lib\site-packages\paramiko-1.7.4-py2.4.egg
Processing dependencies for paramiko
Searching for pycrypto>=1.9
Reading http://pypi.python.org/simple/pycrypto/
Reading http://pycrypto.sourceforge.net
Reading http://www.amk.ca/python/code/crypto
Best match: pycrypto 2.0.1
Downloading http://www.amk.ca/files/python/crypto/pycrypto-2.0.1.tar.gz
Processing pycrypto-2.0.1.tar.gz
Running pycrypto-2.0.1\setup.py -q bdist_egg --dist-dir c:\docume~1\gpinero\loca
ls~1\temp\easy_install-gpdsc5\pycrypto-2.0.1\egg-dist-tmp-8dcze9
error: Setup script exited with error: The .NET Framework SDK needs to be instal
led before building extensions for Python.

I heard it’s a bear to install the .NET framework SDK, and supposedly the install still won’t work. So what you do instead is download this prebuilt pycrypto binary from here, and install it.

Hide Furniture Scratches – An Inexpensive Method

Sunday, June 14th, 2009

I got these furniture touch up markers as a gift, but I couldn’t imagine something that looked like a magic marker could fix scratches in furniture, but I thought I’d test it out and post the results here.

Before:

Hiding wooden furniture scratches with markers

After:

Hiding wooden furniture scratches with markers

So do furniture touch up markers really work? As you can see, they worked pretty well. It looks even better from farther away. One tip I learned is to start with the lightest color marker even if you furniture is dark, and move up to the darker markers as needed. On my first “repair” I ended up using too dark of a marker. It still doesn’t look terrible though, and certainly looks better than the scratch did.

Here’s the brand I did the above test with: