Skip to content

Support of InlineStrings and others #608

Open
@pfarndt

Description

@pfarndt

The package does not allow to use a more general string type (such as InlineSring, which are often used by CSV.jl )

using InlineStrings
using PythonCall


re = pyimport("re")

# s is a String and all is fine:
s = "abc123def456ghi789"
re.findall("[a-z]", s)


# s is an InlineString 
s = InlineString("abc123def456ghi789")
re.findall("[a-z]", s)

The last line errors with:

ERROR: Python: TypeError: expected string or bytes-like object

A simple

Py(s::AbstractString) = Py(String(s))

should do the trick.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions