Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

julia UndefVarError: unshift! not defined

Tags:

python

julia

I use julia 1.4, and running the following code:

using PyCall
using JLD
using ArgParse
using Pandas
@pyimport networkx as nx
@pyimport scipy.sparse.csgraph as csg
@pyimport numpy as np

unshift!(PyVector(pyimport("sys")["path"]), "")
# unshift!(PyVector(pyimport("sys")["path"]), "..")
unshift!(PyVector(pyimport("sys")["path"]), "combinatorial")
@pyimport utils.load_graph as lg
@pyimport utils.distortions as dis
@pyimport graph_util as gu
....

when I run this code, I get the following error:

 ERROR: LoadError: UndefVarError: unshift! not defined
Stacktrace:
 [1] top-level scope at /root/hyperbolics/combinatorial/comb.jl:9
 [2] include(::Module, ::String) at ./Base.jl:377
 [3] exec_options(::Base.JLOptions) at ./client.jl:288
 [4] _start() at ./client.jl:484
in expression starting at /root/hyperbolics/combinatorial/comb.jl:9

When I searched documents, unshift! is existing function in julia 1.4, so I don't get why this error occurs. I'm new to julia, please help.

like image 323
Whi Wonseok Avatar asked Jan 25 '23 19:01

Whi Wonseok


1 Answers

unshift! is existing function in julia 1.4

Where did you see this? It was renamed for Julia 1.0 two years ago to pushfirst!:

julia> pushfirst!([1, 2, 3], 4)
4-element Array{Int64,1}:
 4
 1
 2
 3
like image 160
fredrikekre Avatar answered Feb 02 '23 01:02

fredrikekre