Archive
Anaconda3, Windows, command-line arguments
Problem
I installed Anaconda3 on Windows 7, but when I wanted to pass a command-line argument to a script, the script didn’t receive the parameter(s). The command-line arguments were simply ignored.
Solution
I found the solution here. This is a blog post from 2010. This issue is still unresolved…
In short: open the registry editor (regedit), find the key HKEY_CLASSES_ROOT\py_auto_file\shell\open\command , and append the string “%*” (without quotes) to the end of the entry. It should look similar to this:
"C:\Anaconda3\python.exe" "%1" %*
Installing a Flask webapp on a Digital Ocean (or Linode, etc.) Ubuntu box
How to install a Flask webapp on a Digital Ocean VPS that has Ubuntu Linux on it: https://github.com/jabbalaci/DigitalOceanFlask.
This writing of mine appeared in Import Python Weekly Newsletter No. 65.
Getting started with Django on a DigitalOcean VPS
“Django is a high-level Python framework for developing web applications rapidly. DigitalOcean’s Django One-Click app quickly deploys a preconfigured development environment to your VPS employing Django, Nginx, Gunicorn, and Postgres.”
More info here.
Qt development under Windows with Python using PySide
Install PySide here: http://qt-project.org/wiki/PySideDownloads. Follow the link “Microsoft Windows” and download the installer.
install gevent
sudo apt-get install libevent-dev python-all-dev sudo pip install gevent
Nice tutorial on gevent: here.
Install NumPy and SciPy on Ubuntu
On Ubuntu 11.10, here is what I had to do:
sudo pip install numpy sudo apt-get install libatlas-base-dev gfortran sudo pip install scipy sudo pip install matplotlib # recommended
Line 2 was necessary for SciPy, otherwise it was complaining that BLAS and a Fortran compiler were missing. Note that gfortran replaces the package g77.
Extra packages in PyPI
“The Python Package Index (PyPI) is a repository of software for the Python programming language. There are currently 13,756 packages here…
…to use a package from this index either “pip install package” or download, unpack and “python setup.py install” it.” (source)
The easiest way is to use the pip installer:
sudo pip install <package_name>
Install the Eric Python IDE
“Eric is a full featured Python and Ruby editor and IDE, written in Python. It is based on the cross platform Qt GUI toolkit, integrating the highly flexible Scintilla editor control. It is designed to be usable as everdays’ quick and dirty editor as well as being usable as a professional project management tool integrating many advanced features Python offers the professional coder. Eric4 includes a plugin system, which allows easy extension of the IDE functionality with plugins downloadable from the net. Current stable versions are eric4 based on Qt4 and Python 2 and eric5 based on Python 3 and Qt4.” (source)
As I’m still using Python 2, I will show you how to install eric4. Unfortunately, there is a very old version in the official Ubuntu repositories. Let’s see how to install an up-to-date version.
First, install it via apt-get. The advantage here is that all the dependencies will be installed.
sudo apt-get install eric
Apt-get will suggest some additional packages, it’s a good idea to install them too. Then, download the latest stable version of eric4. Remove the old version that we installed via apt-get:
sudo apt-get remove eric
Remember, the dependencies remain, so we can install the latest version without any problem. Uncompress the downloaded archive and execute install.py as root:
sudo ./install.py
Now you can start the editor with “eric4“.
I find it a very nice IDE for Python. It has tons of cool features still it’s lightweight. If I want to edit a simple script, I won’t start Eclipse (with the Python plug-in), it’s too slow… But if I want more than pure vim :), eric4 is a good choice.
Troubleshooting
In my case, the installer didn’t work perfectly: it didn’t set the rights correctly, thus I couldn’t execute eric4 as a normal user. I asked some people, they said they didn’t have this problem… Anyway, here is what I had to do:
- Copy
setjog_here.sh(see below) to/usr/lib/python2.6/dist-packages/eric4and execute it as root. It will correct the rights. - Repeat the step above with the directory
/usr/lib/python2.6/dist-packages/eric4pluginstoo.
setjog_here.sh:
#!/bin/bash find . -type d -print0 | xargs -0 chmod 755 find . -type f -print0 | xargs -0 chmod 644 chmod 755 . chmod u+x $0
There is one more step to do: copy eric4config.py (from the uncompressed install directory) to /usr/lib/python2.6/dist-packages/eric4. Don’t forget to set its rights (chmod 644 eric4config.py).
Now, you should be able to start the IDE with “eric4“.
Update (20110401)
I have this problem with the wrong permissions with other packages too that I install with “pip”, so this is not an eric-specific issue. But with the bash script above I can correct it easily.
