MethodError: no method matching!

Hello to everyone,
I am quite new to julia language and could you please help me to figure it out, why I get this error ?

#Packages 
begin
	using Pkg
    PkgList = ["CSV", "DataFrames", "Ipopt", "JuMP", "Plots", "PlutoUI"]
    for p in PkgList
        if Base.find_package(p) == nothing
            Pkg.add(p)
        end
	end
	using JuMP, Ipopt, CSV, DataFrames, Plots, PlutoUI
end




#I read data from the file readData.jl
begin
	include("readData.jl")
    Sbase = 100e3 # VA
    Vbase = 11e3 # V
	BranchData, NodeData = readData("Branch_data_file.csv","Node_data_file.csv")
end

#If you want to see what is going on in the readData.jl, it would be as follows;

using CSV, DataFrames
function readData(BranchFile, NodesFile)
# Only one line of the code
        BranchData = CSV.read("E:/..../Branch_data_file.csv",DataFrame)
 
end

I almost checked everything, updated the packages(Jump), atom, and also checked the similar topics but still getting the error:

MethodError: no method matching readData(::String, ::String)
Closest candidates are:
readData(::Any, ::Any, !Matched::Any, !Matched::Any) at E:\Msc-Skoltech\Thesis\My code\readData.jl:3
top-level scope at DA_dispatch.jl:24
eval at boot.jl:373 [inlined]

I hope I did not make a trivial mistake somewhere, but your help would be appreciated!

You are defining a function readData which takes four arguments and are calling it with two arguments?

3 Likes

You are right. Yes, readData is a function with four arguments and two return values, and I did not notice that. Now the code is running well. Thank you.

1 Like