Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using PyCall not working in Julia 0.4 master #119

Closed
waterswims opened this issue Mar 8, 2015 · 2 comments · Fixed by #121
Closed

using PyCall not working in Julia 0.4 master #119

waterswims opened this issue Mar 8, 2015 · 2 comments · Fixed by #121

Comments

@waterswims
Copy link

Hey just installed a fresh lubuntu distro and was installing my things and checking they are working, installed julia 0.4 and tried it and got this error

julia> using PyCall
ERROR: LoadError: LoadError: MethodError: convert has no method matching convert(::Type{Ptr{UInt8}}, ::ASCIIString)
This may have arisen from a call to the constructor Ptr{UInt8}(...),
since type constructors fall back to convert methods.
Closest candidates are:
convert{T}(::Type{Ptr{T}}, ::UInt64)
convert{T}(::Type{Ptr{T}}, ::Int64)
convert{T}(::Type{Ptr{T}}, ::Ptr{T})
...

in call at /home/jmw2g14/.julia/v0.4/PyCall/src/pytype.jl:92
in include at ./boot.jl:250
in include_from_node1 at ./loading.jl:128
in include at ./boot.jl:250
in include_from_node1 at ./loading.jl:128
in reload_path at ./loading.jl:152
in _require at ./loading.jl:67
in require at ./loading.jl:51

My julia version is 0.4.0-dev+3718

@stevengj
Copy link
Member

stevengj commented Mar 8, 2015

Yes, they just merged a patch in "0.4" (i.e. git master) that broke everything (JuliaLang/julia#9986?).... you really should use Julia 0.3 unless you are hacking on Julia itself, or are keen to be on the bleeding edge. If you want to work from git, checkout the release-0.3 branch rather than master.

cc: @vtjnash, shouldn't we have deprecated these convert methods rather than removing them? I'm confused: how are you supposed to pass ByteString arguments to C in Julia 0.4 if not as Ptr{UInt8}?

@stevengj stevengj changed the title using PyCall not working using PyCall not working in Julia 0.4 master Mar 8, 2015
@vtjnash
Copy link
Contributor

vtjnash commented Mar 8, 2015

we can probably add back a deprecation warning for them. all methods that convert to Ptr were moved to unsafe_convert as a warning that the user must not let the argument become inaccessible to the julia runtime. inside ccall, you can just pass the ByteString and let convert get called for you.

looking through that code, it would be cleaner/faster to just have gstring_ptr push the string to a global const array, rather than gensym'ing and eval'ing a constant variable to remember it. also, it looks like pyjlwrap_members is creating a compile-time pointer to the pyjlwrap_membername string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants