Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Diffuse is installed on my workstation and plays well with Mercurial so I often use it for diff'ing. However, I also am using a Python virtualenv to use some different modules in a more controlled setting (easier to ship off to other people). When I try to run Diffuse from within my virtualenv (here named sandbox) it pukes:

(sandbox)nickt@aiguadassi:/home/codes/nickt/Tape-Worms/Code
$ diffuse bread.py # fail...
Traceback (most recent call last):
  File "/usr/bin/diffuse", line 124, in <module>
    import pygtk
ImportError: No module named pygtk

Outside it works just fine...

(sandbox)nickt@aiguadassi:/home/codes/nickt/Tape-Worms/Code
$ deactivate 
nickt@aiguadassi:/home/codes/nickt/Tape-Worms/Code
$ diffuse bread.py # works fine.

I assume Diffuse is a Python app and is relying on finding modules in the environment; is there a way to have it use the 'global' environment (e.g. via an alias)? I'm not sure what the program is doing with respect to the environment...is it searching through PATH for modules, trying to use whatever which python turns up...

share|improve this question
up vote 2 down vote accepted

Another option is to add an alias to your ~/.bashrc file:

alias diffuse='/usr/bin/python /usr/bin/diffuse'

This prevents things breaking when diffuse is updated.

share|improve this answer
    
Probably the best option to avoid modifying it for anyone else. – Nick T Nov 3 '15 at 17:03

If the first line of /usr/bin/diffuse looks like:

#!/usr/bin/env python

it will run in Python inside your virtualenv. Most Python applications should set it to:

#!/usr/bin/python

which will run it with the system Python. If this is wrong, it might be a bug either in Diffuse or in its packaging in Debian/Ubuntu.

share|improve this answer
    
So simple; I kept thinking it was a binary because it was in bin /facepalm. – Nick T May 16 '13 at 21:21
    
Well, that would make sense. But now bin just means executable, including scripts. – Thomas K May 16 '13 at 22:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.