File tree Expand file tree Collapse file tree 2 files changed +17
-15
lines changed Expand file tree Collapse file tree 2 files changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -129,11 +129,22 @@ def path_option(name, default=None):
129
129
os .environ ['JULIA_PYTHONCALL_PROJECT' ] = project
130
130
os .environ ['JULIA_PYTHONCALL_INIT_JL' ] = os .path .join (os .path .dirname (__file__ ), 'init.jl' )
131
131
script = '''
132
- # This uses some internals, but Base._start() gets the state more like Julia
133
- # is if you call the executable directly, in particular it creates workers when
134
- # the --procs argument is given.
135
- push!(Core.ARGS, ENV["JULIA_PYTHONCALL_INIT_JL"])
136
- Base._start()
132
+ try
133
+ import Pkg
134
+ Pkg.activate(ENV["JULIA_PYTHONCALL_PROJECT"], io=devnull)
135
+ import PythonCall
136
+ # This uses some internals, but Base._start() gets the state more like Julia
137
+ # is if you call the executable directly, in particular it creates workers when
138
+ # the --procs argument is given.
139
+ push!(Core.ARGS, ENV["JULIA_PYTHONCALL_INIT_JL"])
140
+ Base._start()
141
+ @eval Base PROGRAM_FILE=""
142
+ catch err
143
+ print(stderr, "ERROR: ")
144
+ showerror(stderr, err, catch_backtrace())
145
+ flush(stderr)
146
+ rethrow()
147
+ end
137
148
'''
138
149
res = lib .jl_eval_string (script .encode ('utf8' ))
139
150
if res is None :
Original file line number Diff line number Diff line change 1
- try
2
- import Pkg
3
- Pkg. activate (ENV [" JULIA_PYTHONCALL_PROJECT" ], io= devnull )
4
- import PythonCall
5
- catch err
6
- print (stderr , " ERROR: " )
7
- showerror (stderr , err, catch_backtrace ())
8
- flush (stderr )
9
- rethrow ()
10
- end
1
+ # Blank script for Base._start() to run instead of starting the REPL.
You can’t perform that action at this time.
0 commit comments