Skip to content

Commit e9efd7a

Browse files
committed
Fix issue with setting python argv from julia ARGS
1 parent 3437b64 commit e9efd7a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/RobotOS.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ include("callbacks.jl")
1818
function __init__()
1919
#Put julia's ARGS into python's so remappings will work
2020
copy!(_py_sys, pyimport("sys"))
21-
_py_sys."argv" = ARGS
21+
if length(ARGS) > 0
22+
_py_sys.argv = ARGS
23+
end
2224

2325
#Fill in empty PyObjects
2426
if ! (dirname(@__FILE__) in _py_sys."path")

test/rospy.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import PyCall
2+
13
#Test basic rospy interactions
24
init_node("jltest", anonymous=true)
35

@@ -32,3 +34,9 @@ RobotOS.get_node_uri()
3234
RobotOS.get_caller_id()
3335
RobotOS.get_published_topics()
3436
RobotOS.get_ros_root()
37+
38+
#Issue 73 - Corruption of Python sys.argv
39+
PyCall.py"""
40+
import argparse
41+
argparse.ArgumentParser()
42+
"""

0 commit comments

Comments
 (0)