Skip to content

Commit 9bcf2c1

Browse files
committed
Fix usrset file check during install.
1 parent 62741c8 commit 9bcf2c1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

setup.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,15 @@ def get_version(rel_path):
2626
# Temp fix for CoppeliaSim 4.1
2727
if 'COPPELIASIM_ROOT' not in os.environ:
2828
raise RuntimeError('COPPELIASIM_ROOT not defined.')
29-
with open(os.path.join(os.environ['COPPELIASIM_ROOT'], 'system', 'usrset.txt'), 'r') as f:
30-
usrset = f.read()
29+
30+
usrset_file = os.path.join(os.environ['COPPELIASIM_ROOT'], 'system', 'usrset.txt')
31+
usrset = ''
32+
if os.path.isfile(usrset_file):
33+
with open(usrset_file, 'r') as f:
34+
usrset = f.read()
3135

3236
if 'allowOldEduRelease' not in usrset:
33-
with open(os.path.join(os.environ['COPPELIASIM_ROOT'], 'system', 'usrset.txt'), 'a') as f:
37+
with open(usrset_file, 'a+') as f:
3438
f.write('\nallowOldEduRelease=7501\n')
3539

3640

0 commit comments

Comments
 (0)