Closed
Description
When converting to PyArray
some numpy arrays with string elements, I end up with strings of type PythonCall.Utils.StaticString{UInt32, 44}
.
It seems that this type is not well supported though, and I get the following errors when indexing and computing the length:
julia> s = PythonCall.Utils.StaticString{UInt32, 44}("ababababb")
"ababababb"
julia> s[1]
ERROR: MethodError: no method matching isvalid(::PythonCall.Utils.StaticString{UInt32, 44}, ::Int64)
Closest candidates are:
isvalid(::AbstractString, ::Integer) at strings/basic.jl:143
isvalid(::SubstitutionString, ::Integer) at regex.jl:566
isvalid(::Type{T}, ::Integer) where T<:AbstractChar at strings/unicode.jl:58
...
Stacktrace:
[1] isvalid
@ ./strings/basic.jl:143 [inlined]
[2] getindex(s::PythonCall.Utils.StaticString{UInt32, 44}, i::Int64)
@ Base ./strings/basic.jl:186
[3] top-level scope
@ REPL[5]:1
julia> length(s)
ERROR: MethodError: no method matching isvalid(::PythonCall.Utils.StaticString{UInt32, 44}, ::Int64)
Closest candidates are:
isvalid(::AbstractString, ::Integer) at strings/basic.jl:143
isvalid(::SubstitutionString, ::Integer) at regex.jl:566
isvalid(::Type{T}, ::Integer) where T<:AbstractChar at strings/unicode.jl:58
...
Stacktrace:
[1] isvalid
@ ./strings/basic.jl:143 [inlined]
[2] length
@ ./strings/basic.jl:396 [inlined]
[3] length(s::PythonCall.Utils.StaticString{UInt32, 44})
@ Base ./strings/basic.jl:387
[4] top-level scope
@ REPL[6]:1
julia> s isa AbstractString # in principle the type should implement the whole interface
true
Metadata
Metadata
Assignees
Labels
No labels