inline scripts: provide __file__

This commit is contained in:
Maximilian Hils 2015-09-10 10:30:57 +02:00
parent cf2b2e0cc7
commit c573d8c292

View File

@ -95,8 +95,8 @@ class Script:
"""
if self.ns is not None:
self.unload()
ns = {}
script_dir = os.path.dirname(os.path.abspath(self.args[0]))
ns = {'__file__': os.path.abspath(self.args[0])}
sys.path.append(script_dir)
try:
execfile(self.args[0], ns, ns)