Skip to content

Commit 8e06b41

Browse files
authored
Merge pull request #74 from jdlangs/fix-73
Only overwrite `sys.argv` if we have ARGS
2 parents 0764a0b + e9efd7a commit 8e06b41

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
language: julia
22
julia:
3-
- 0.7
43
- 1.0
5-
- 1.1
4+
- 1.2
65
- nightly
76
matrix:
87
allow_failures:

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
77

88
[compat]
99
PyCall = "≥ 1.90.0"
10-
julia = "0.7.0"
10+
julia = "1"
1111

1212
[extras]
1313
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

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)