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