Skip to content

Commit 7e67b5b

Browse files
authored
Update model scripts to Python 3 (#248)
* Update shebang to python3 * Update code to python3
1 parent 87948e6 commit 7e67b5b

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

get_local_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python3
22
from __future__ import print_function
33

44
import sys

webify_models_v2.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python3
22

33
# A script to update gazebo models to be web-friendly.
44
# It converts all textures to png format and make sure they are
@@ -56,14 +56,14 @@
5656

5757
if texture_dir != dest_dir:
5858
cmd = ['mv', dest_path, texture_dir]
59-
print cmd
59+
print(cmd)
6060
subprocess.check_call(cmd)
6161

6262
# update texture path in dae files
6363
if format.lower() in ['dae']:
6464
sed_cmd = ["sed", "-i", "-e",
6565
's/\(\.tga\|\.tiff\|\.tif\|\.jpg\|\.jpeg\|\.gif\)/\.png/g', file]
66-
print sed_cmd
66+
print(sed_cmd)
6767
subprocess.check_call(sed_cmd)
6868

6969
# find relatvie path to texture dir
@@ -79,21 +79,21 @@
7979
# replace dae file png references to texture path
8080
sed_cmd = ["sed", "-i","-e",
8181
's/\(>\)\(.*\/\)\(.*\.png\)/\\1'+ relative_path + 'materials\/textures\/\\3/g', file]
82-
print sed_cmd
82+
print(sed_cmd)
8383
subprocess.check_call(sed_cmd)
8484

8585
sed_cmd = ["sed", "-i","-e",
8686
'/[a-zA-Z0-9_\.\/\-]\+materials\/textures/!s/\([a-zA-Z0-9_\-]\+\)\(\.png\W\)/'+ relative_path + 'materials\/textures\/\\1\\2/g', file]
8787

88-
print sed_cmd
88+
print(sed_cmd)
8989
subprocess.check_call(sed_cmd)
9090

9191
if format.lower() in ['material', 'txt', 'sdf']:
9292
sed_cmd = ["sed", "-i", "-e",
9393
's/\(\.tga\|\.tiff\|\.tif\|\.jpg\|\.jpeg\|\.gif\)/\.png/g', file]
94-
print sed_cmd
94+
print(sed_cmd)
9595
subprocess.check_call(sed_cmd)
9696

97-
except Exception, e:
98-
print "error %s" % e
97+
except Exception as e:
98+
print("error %s" % e)
9999
raise

0 commit comments

Comments
 (0)