Not finding user-installed module despite PYTHONPATH!

Albert Hofkamp hat at se-46.wpa.wtb.tue.nl
Mon Dec 2 04:58:35 EST 2002


First of all, tnx for the responses.

I didn't know about the .ssh/environment (I tried reading the man-page, but
there is so much blabla about crypto, that I lost track).

The response below also looks interesting.

On Fri, 29 Nov 2002 19:08:42 GMT, Robin Munn <rmunn at pobox.com> wrote:
> Albert Hofkamp <hat at se-46.wpa.wtb.tue.nl> wrote:
>> 
>> I want to run an interactive Python module through ssh. The basic solution is
>> something like
>> 
>> ssh -x remote_machine 'python -c "import mymodule ; mymodule.run()"'
> 
> [snip attempts to get PYTHONPATH set]
> 
> Does something like this work?
> 
> ssh -x remote_machine 'PYTHONPATH=/path/to/module python -c "import mymodule ; mymodule.run()"'
> 
> (If that line wraps, it should be all on one line).

(it didn't)
At first sight, there seems to be a ; missing before 'python'. Also,
some shells may need something like 'export' or 'setenv' at the beginning.
(I will try this option, but near the end of the week or later).

> It seems to me that this might be a better solution than trying to set

I am a bit afraid what assumptions you make above w.r.t. the used shell
(e.g. must I use export or setenv?).

The overall idea was
a) make as little assumptions about the remote system as possible
b) make it easy to maintain.
c) make it easy to explain to non-unix experts.

I think I cannot comply to all these conditions with either
".ssh/enivronment" or with "PYTHONPATH="

What worries me most is c). The entire problem is in my view a Unix problem
which should be dealt with by configuring shells, etc. It is not part of
the module functionality, yet it looks like I will need to spend at least
half a page of text to this problem :-(

> .ssh/environment -- do you want *all* ssh sessions to get this
> PYTHONPATH, or just this particular command?

I want to make as few assumptions about the remote machine as possible. It
should be possible to have my module installed at different places at
different machines.
That would mean that I would be specifying the place of 'module' in my
program rather than let the system configuration handle it.

> I like to be as specific as possible, and not apply a too-general
> solution that might not make sense in another case.

I have the experience that specific solutions tend to return to your desk,
so I'd like to have a general solution and be rid of it for eternity.
(but that only works if c) is done correctly, otherwise I end up explaining
it to seperate individuals over and over again).

Tnx for both suggestions, I will try both solutions, and see what I like
most.

Albert
-- 
Unlike popular belief, the .doc format is not an open publically available format.



More information about the Python-list mailing list