I’m trying to follow the directions on developing MC web app on this page.
https://www.genieframework.com/docs/genie/tutorials/Developing-MVC-Web-Apps.html
I’m stuck at the step on “Interacting with the movies data”.
If I type “using Movies”, it wants me to add the package. When I add the package, I get the error below
please advise.
julia>using Pkg
julia>Pkg.add(“Movies”)
ERROR: The following package names cold not be resolved:
*Movies (not found in project, manifest, or registry)
1 Like
There doesn’t seem to be any Julia package called Movies.
Does that mean the instruction provided by the website is not accurate? Is there a work around or what needs to be done to get it working?
Did you follow the instructions before that? It looks like the Movie package is quite example that you generate as part of the tutorial.
All the steps before were successful including “Creating the Movie model”.
My issue is with Interacting with the movies data.
Installing is not necessary. It should load the module defined in app/resources/movies/Movies.jl
immediately beforehand.
Please have a look at the output of LOAD_PATH
. It should look something like
julia> LOAD_PATH
12-element Vector{String}:
"@"
"@v#.#"
"@stdlib"
"C:\\Users\\stephan\\Watchtonight"
"src"
"app\\helpers"
"app\\resources"
".\\app\\resources\\movies"
"app\\resources"
"app\\resources\\movies"
"app\\resources"
"app\\resources\\movies\\views"
The entries starting with app
make the module Movies
discoverable and are added when loading the app with bin/repl
as per the instruction.
Great, after issuing “bin/repl”, I’m able to issue “using Movies” without adding the package.
My issue is when I tried to seed
julia>seed()
Error: MethodError: cannot ‘convert’ an object of type PosLenString to an object of type Int64
Can you provide the full stacktrace? And please quote code and outputs in ``` for proper formatting and readability.
julia> seed()
ERROR: MethodError: Cannot `convert` an object of type PosLenString to an object of type Int64
Closest candidates are:
convert(::Type{T}, ::Base.TwicePrecision) where T<:Number at /opt/julia-1.7.3/share/julia/base/twiceprecision.jl:262
convert(::Type{T}, ::AbstractChar) where T<:Number at /opt/julia-1.7.3/share/julia/base/char.jl:185
convert(::Type{T}, ::CartesianIndex{1}) where T<:Number at /opt/julia-1.7.3/share/julia/base/multidimensional.jl:136
...
Stacktrace:
[1] setproperty!(x::Movie, f::Symbol, v::PosLenString)
@ Base ./Base.jl:43
[2] seed()
@ Main ~/Desktop/web02/Watchtonight/db/seeds/seed_movies.jl:17
[3] top-level scope
@ REPL[11]:1
Strange. For me line 17 reads
m.year = parse(Int, row.release_year)
Could it be you missed the parse
?
yes, that worked. thank you