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
## Usage:
### 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.:
```
......
......@@ -251,15 +251,20 @@ def find_library_full_path(name):
procmap = os.path.join('/proc', str(os.getpid()), 'maps')
if not os.path.isfile(procmap):
return None
with open(procmap, 'r') as f:
for line in f:
line = line.strip().split(' ')
sofile = line[-1]
basename = os.path.basename(sofile)
if 'lib' + name + '.so' in basename:
if os.path.isfile(sofile):
return os.path.realpath(sofile)
try:
with open(procmap, 'r') as f:
for line in f:
line = line.strip().split(' ')
sofile = line[-1]
basename = os.path.basename(sofile)
if 'lib' + name + '.so' in basename:
if os.path.isfile(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
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