Skip to content

Support of InlineStrings and others #608

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

Open
pfarndt opened this issue May 2, 2025 · 0 comments
Open

Support of InlineStrings and others #608

pfarndt opened this issue May 2, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@pfarndt
Copy link

pfarndt commented May 2, 2025

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.

@pfarndt pfarndt added the bug Something isn't working label May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant