浏览代码

simplifications on launching from absolute path,

bug fix : closing the environment when the file_name was wrong.
/tag-0.2.0
vincentpierre 7 年前
当前提交
22bfd276
共有 1 个文件被更改,包括 3 次插入8 次删除
  1. 11
      python/unityagents/environment.py

11
python/unityagents/environment.py


"or use a different worker number.".format(str(worker_id)))
cwd = os.getcwd()
file_name = file_name.strip()
true_filename = (os.path.basename(os.path.normpath(file_name))
file_name = (file_name.strip()
true_filename = os.path.basename(os.path.normpath(file_name))
launch_string = None
if platform == "linux" or platform == "linux2":
candidates = glob.glob(os.path.join(cwd, file_name) + '.x86_64')

candidates = glob.glob(file_name + '.x86_64')
if len(candidates) == 0:
candidates = glob.glob(file_name + '.x86')
if len(candidates) == 0:
candidates = glob.glob(file_name)
if len(candidates) > 0:
launch_string = candidates[0]

candidates = glob.glob(os.path.join(file_name + '.app', 'Contents', 'MacOS', true_filename))
if len(candidates) == 0:
candidates = glob.glob(os.path.join(file_name, 'Contents', 'MacOS', true_filename))
if len(candidates) > 0:
launch_string = candidates[0]
elif platform == 'win32':

if len(candidates) == 0:
candidates = glob.glob(file_name)
self.close()
raise UnityEnvironmentException("Couldn't launch the {0} environment. "
"Provided filename does not match any environments."
.format(true_filename))

正在加载...
取消
保存