Error: find not defined

Trying to use Julia 1.0.1 now, and i got this error.

ERROR: LoadError: UndefVarError: find not defined

My code has the find() function, and it used to work on 0.6.3.

I’ve found somewhere, that if we had any problem using a function like that, we should type it in the 0.7 version, and see if any warning appears on how to fix it, then i tried, but i got nothing.

julia> find
find (generic function with 6 methods)

You have to actually call the find function, or in other words, run your code on 0.7.

1 Like

Oh, right. Sorry for that.

julia> find()
┌ Warning: `find` is deprecated, use `findall` instead.
│   caller = top-level scope at none:0
└ @ Core none:0
ERROR: MethodError: no method matching findall()
Closest candidates are:
  findall(::Bool) at array.jl:2053
  findall(::String, ::LibGit2.GitIndex) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v0.7\LibGit2\src\index.jl:192
  findall(::getfield(Base, Symbol("##54#55")){typeof(iszero)}, ::BitArray) at bitarray.jl:1546
  ...
Stacktrace:
 [1] find() at .\deprecated.jl:31
 [2] top-level scope at none:0

I replaced all find() for findall() in my code, but i got this error now:

ERROR: LoadError: MethodError: no method matching setindex_shape_check(::Int64, ::Int64)
Closest candidates are:
  setindex_shape_check(::AbstractArray{#s57,1} where #s57, ::Integer) at indices.jl:218
  setindex_shape_check(::AbstractArray{#s57,1} where #s57, ::Integer, ::Integer) at indices.jl:221
  setindex_shape_check(::AbstractArray{#s57,2} where #s57, ::Integer, ::Integer) at indices.jl:225
  ...
Stacktrace:
 [1] macro expansion at .\multidimensional.jl:641 [inlined]
 [2] _unsafe_setindex!(::IndexLinear, ::Array{Float64,2}, ::Int64, ::Array{Int64,1}) at .\multidimen
sional.jl:636
 [3] _setindex! at .\multidimensional.jl:631 [inlined]
 [4] setindex!(::Array{Float64,2}, ::Int64, ::Array{Int64,1}) at .\abstractarray.jl:998
 [5] MSP(::Int64, ::Int64, ::Float64, ::Float64, ::Int64, ::Array{Any,1}, ::Array{Any,1}, ::Array{An
y,1}, ::Array{Any,1}, ::Array{Any,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::
Array{Float64,1}, ::Array{Float64,1}, ::Int64) at C:\Users\Muril\Desktop\Murilo\UFPE\Dissertação\Jul
ia\Arquivos Feitos\MSP.jl:34
 [6] top-level scope at none:0
 [7] include_string(::Module, ::String, ::String) at .\loading.jl:1005
 [8] (::getfield(Atom, Symbol("##128#133")){String,String,Module})() at C:\Users\Muril\.julia\packag
es\Atom\Fha1N\src\eval.jl:120
 [9] withpath(::getfield(Atom, Symbol("##128#133")){String,String,Module}, ::String) at C:\Users\Mur
il\.julia\packages\CodeTools\hB4Hy\src\utils.jl:30
 [10] withpath at C:\Users\Muril\.julia\packages\Atom\Fha1N\src\eval.jl:46 [inlined]
 [11] #127 at C:\Users\Muril\.julia\packages\Atom\Fha1N\src\eval.jl:117 [inlined]
 [12] hideprompt(::getfield(Atom, Symbol("##127#132")){String,String,Module}) at C:\Users\Muril\.jul
ia\packages\Atom\Fha1N\src\repl.jl:84
 [13] macro expansion at C:\Users\Muril\.julia\packages\Atom\Fha1N\src\eval.jl:116 [inlined]
 [14] (::getfield(Atom, Symbol("##126#131")){Dict{String,Any}})() at .\task.jl:85
in expression starting at C:\Users\Muril\Desktop\Murilo\UFPE\Dissertação\Julia\Arquivos Feitos\teste
_fluxo_carga.jl:28

Run your code on Julia 0.7 and you would get a warning for that. (Presumably for something like A[inds] = x which now needs to be A[inds] .= x somewhere in your code.)

1 Like

To be explicit:

  • Run code on 0.7
  • Fix all warnings
  • Run code on 1.0.
1 Like

Ok, i got it. Fixed a lot of warnings, but still got this one:

WARNING: Base.readdlm is deprecated: it has been moved to the standard library package `DelimitedFil
es`.
Add `using DelimitedFiles` to your imports.

How can i add that command to the imports? Actually, i don’t know what that means.

simply add using DelimitedFiles to your package.

2 Likes