Commit 5b019098 authored by Yuxin Wu's avatar Yuxin Wu

handle error in find_library

parent 00f83c13
...@@ -18,7 +18,7 @@ used a modified version where each batch contains transitions from different sim ...@@ -18,7 +18,7 @@ used a modified version where each batch contains transitions from different sim
## Usage: ## Usage:
### With ALE (paper's setting): ### With ALE (paper's setting):
Install [ALE](https://github.com/mgbellemare/Arcade-Learning-Environment) and gym. Install [ALE](https://github.com/mgbellemare/Arcade-Learning-Environment) and `gym[atari]`.
Download an [atari rom](https://github.com/openai/atari-py/tree/gdb/atari_py/atari_roms), e.g.: Download an [atari rom](https://github.com/openai/atari-py/tree/gdb/atari_py/atari_roms), e.g.:
``` ```
......
...@@ -251,6 +251,7 @@ def find_library_full_path(name): ...@@ -251,6 +251,7 @@ def find_library_full_path(name):
procmap = os.path.join('/proc', str(os.getpid()), 'maps') procmap = os.path.join('/proc', str(os.getpid()), 'maps')
if not os.path.isfile(procmap): if not os.path.isfile(procmap):
return None return None
try:
with open(procmap, 'r') as f: with open(procmap, 'r') as f:
for line in f: for line in f:
line = line.strip().split(' ') line = line.strip().split(' ')
...@@ -260,6 +261,10 @@ def find_library_full_path(name): ...@@ -260,6 +261,10 @@ def find_library_full_path(name):
if 'lib' + name + '.so' in basename: if 'lib' + name + '.so' in basename:
if os.path.isfile(sofile): if os.path.isfile(sofile):
return os.path.realpath(sofile) return os.path.realpath(sofile)
except PermissionError:
# can fail in certain environment (e.g. chroot)
# if the pids are incorrectly mapped
pass
# The following two methods come from https://github.com/python/cpython/blob/master/Lib/ctypes/util.py # The following two methods come from https://github.com/python/cpython/blob/master/Lib/ctypes/util.py
def _use_ld(name): def _use_ld(name):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment