问题描述
我已尝试按照 this node: 上的说明进行操作
但是,如果文件使用 exec
命令,我得到的只是:
/project/cntrl_des_scripts/lior/temp/<string>
<string>
/project/cntrl_des_scripts/lior/temp/<string>
运行的主要脚本代码是:
#!/bin/python3.6m
exec( open( "foo/bar.py" ).read() )
foo/bar.py
中的代码是:
import inspect
from inspect import getsourcefile
from os.path import abspath
print( abspath(getsourcefile(lambda:0)) + "\n" )
print( inspect.getframeinfo(inspect.currentframe()).filename + "\n" )
print( abspath(getsourcefile(lambda:_)) + "\n" )
我期望的输出是:
/project/cntrl_des_scripts/lior/temp/foo/bar.py
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)