Skip to content

Commit fd63325

Browse files
committed
More correct use of PyCall global vars
1 parent 78b64b5 commit fd63325

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/RobotOS.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ module RobotOS
22

33
using PyCall
44

5+
#Empty imported modules for valid precompilation
6+
const __sys__ = PyCall.PyNULL()
7+
const __rospy__ = PyCall.PyNULL()
8+
59
function __init__()
610
#Put julia's ARGS into python's so remappings will work
7-
global const __sys__ = pyimport("sys")
11+
copy!(__sys__, pyimport("sys"))
812
__sys__["argv"] = ARGS
913

10-
global const __rospy__ = try
11-
pyimport("rospy")
14+
try
15+
copy!(__rospy__, pyimport("rospy"))
1216
catch ex
1317
if (isa(ex, PyCall.PyError) &&
1418
pycall(pybuiltin("str"), PyAny, ex.val) == "No module named rospy")

0 commit comments

Comments
 (0)