"Martin Bless" <m.bless at gmx.de> wrote in message news:3ad04333.273637 at news.muenster.de... [snip] > How can I launch scripts that lie in different subdirs in my import > paths from an arbitrary directory without having to specify the path > of the script and without changing the directory? For example through a simple auxiliary script -- the following should suffice (but it's untested): file locator.py: === import sys, imp file, path, desc = imp.find_module(sys.argv[1]) sys.argv[0] = path del sys.argv[1] try: load_module('__main__', file, path, desc) finally: file.close() === You can use this explicitly, python locator.py themodule its args or play some site.py trickery to have such kind of functionality executed automatically for you. Of course, this will only be necessary on sufficiently-incapable operating systems. On any Unix variant, scripts in your PATH which are marked as executable will be found on your behalf by the shell (and they'll start with #!/usr/bin/python, or whatever, to have the Python interpreter invoked) -- this, I believe, should also work on Windows if you're using some kind of halfway-decent shell (such as bash from CygWin, or a recent-enough version of Microsoft's cmd.exe -- but in the latter case some registry trickery will also be needed). Alex
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4