For my standalone scripts (run from the command line) I use the following:
- Code: Select all
import inspect
module_d = os.path.split(inspect.stack()[0][1])[0]
In the above example I get a path to the currently running python script.
But when I run this same code inside of Clarisse, I get nothing.
For example, from the command line:
- Code: Select all
print inspect.stack()
gives me:
- Code: Select all
[(<frame object at 0x7eff97c67050>, '/dev/item/modules/item/librarian/librarian.py', 55, '__init__', [' print inspect.stack()\n'], 0), (<frame object at 0x564b3f746570>, '/dev/item/bin/item-publish', 175, '<module>', [' librarian = librarian.Librarian(opts.language)\n'], 0)]
but running in Clarisse I get:
- Code: Select all
[(<frame object at 0x7fe3c574c050>, '<string>', 23, '<module>', None, None)]
Is there any way I can access the current directory of the python shelf script running?
Thanks.