Ich versuche run() oder success() zu verwenden, um ein Python-Skript von Julia auszuführen.Julia: Befehl kann nicht mit Argumenten über die String-Variable
Ich kann es gut laufen, wenn ich den Befehl von Hand angeben:
julia> run(`python sample.py`)
woo! sample
Allerdings, wenn ich es über ein String-Argument zu laufen versuchen, es funktioniert plötzlich nicht mehr.
julia> str = "python sample.py"
"python sample.py"
julia> run(`$str`)
ERROR: could not spawn `'python sample.py'`: no such file or directory (ENOENT)
in _jl_spawn at process.jl:217
in spawn at process.jl:348
in spawn at process.jl:389
in run at process.jl:478
Die Angabe des vollständigen Pfads für sample.py führt zum gleichen Ergebnis. Seltsamer, nur läuft Python als String funktioniert:
julia> str = "python"
"python"
julia> run(`$str`)
Python 2.7.3 (default, Feb 27 2014, 19:58:35)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Bin ich etwas falsch gemacht?
Danke
Vermutlich gibt es ein genaues Parallelproblem bei der Verwendung von Python (daher 'subprocess.call ([" python "," sample.py "])'). – DSM