Skip to content

Instantly share code, notes, and snippets.

@crazybyte
Created December 1, 2012 11:42
Show Gist options
  • Save crazybyte/4181719 to your computer and use it in GitHub Desktop.
Save crazybyte/4181719 to your computer and use it in GitHub Desktop.
Using Paramiko in Sublime Text 2 plugins

Using Paramiko in Sublime Text 2 plugins (as a guide to using Python libraries in Sublime Text 2 plugins)

  1. use 'easy_install paramiko' to install paramiko and crypto. Now your system python should be able to import paramiko
  2. Install paramiko for your ST2 plugin
    a. Get paramiko from here http://www.lag.net/paramiko/ (or alternatively the most recent version from GitHub).
    b. Place the folder with the 'init.py' file in [ST Packages]/[MY PACKAGE]/paramiko
  3. Install Crypto for your ST2 plugin
    a. Check where your python libraries are using python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
    b. Go to that folder (in my case /Library/Python/2.7/site-packages) and copy the file 'pycrypto-2.6-py2.7-macosx-10.8-intel.egg' somewhere
    c. Unpack it (just rename it to .zip)
    d. copy the Crypto folder with the _init_ file from the unpacked folder to [ST Packages]/[MY PACKAGE]/Crypto
  4. Change line 28 in the file '../Crypto/Random/init.py' from 'Crypto.Random import OSRNG' to 'import OSRNG'

Note: I think you have to go through the installed Crypto package and not just the downloaded one because that includes some compiled c libraries. So I guess you can also compile them yourself

Source: http://www.sublimetext.com/forum/viewtopic.php?f=6&t=10133&p=40221&hilit=python#p40260

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment