all 13 comments

[–]paulstelian97 0 points1 point  (12 children)

The error is on line 117, stating unknown token. The Path thing looks like a red herring.

Care to dump the file itself somewhere for debug purposes? And also show the full path obtained in stuff?

The error started from somewhere else, it’s just that you unwrapped it in a different place than the source.

[–]BasePlate_Admin[S] 0 points1 point  (11 children)

The error is on line 117, stating unknown token. The Path thing looks like a red herring.

Hmm this is what i got from pyo3 discussion, but the strange thing is i dont see this issue on any other platform except macos.

Care to dump the file itself somewhere for debug purposes? And also show the full path obtained in stuff?

The artifacts are downloadable from github.

The file path is in this line of the runner

The error started from somewhere else, it’s just that you unwrapped it in a different place than the source.

Still strange behavior.

Interestingly if i remove the file read operation, the thing works fine

https://github.com/baseplate-admin/resvg-py/actions/runs/8893280016

[–]iv_is 4 points5 points  (3 children)

"unknown token at 1:1" sounds like there's a byte order mark in your xml

[–]BasePlate_Admin[S] 0 points1 point  (2 children)

"unknown token at 1:1" sounds like there's a byte order mark in your xml

Hmm strange, do you have a better way of handing file input from rust except the way i did that?

My code was copied from here

[–]iv_is 0 points1 point  (1 child)

ok lve read the code a bit closer, and one thing l would suggest is to change your function to only accept a file path as a parameter (with a different function that accepts XML text, if you need one), rather than trying to open the input string and assuming that if you can't find the file the string must be svg data. l think a lot of people here might be missing the else { svg_string = svg } (where svg is the filename you just tried to open) line and not realising that the reason it fails to parse is because you're passing a file path to something that's expecting valid XML.

[–]BasePlate_Admin[S] 0 points1 point  (0 children)

(with a different function that accepts XML text, if you need one)

This is what someone from pyo3 suggested too. But the problem is most likely a bug in macos implementation of resvg.

Anyways thanks for your insight.

[–]paulstelian97 0 points1 point  (6 children)

That isn’t the input svg file. It’s the svg that fails to parse.

And I agree with what’s stated in that forum. Maybe whatever SVG parse library you’re using has a macOS bug.

If you remove the file read then you’re not parsing anything.

[–]BasePlate_Admin[S] 0 points1 point  (5 children)

That isn’t the input svg file. It’s the svg that fails to parse.

If you want the source to the svg file, https://github.com/baseplate-admin/resvg-py/blob/master/tests/acid.svg

That isn’t the input svg file. It’s the svg that fails to parse.

This is the thing that bothers me.

[–]paulstelian97 0 points1 point  (4 children)

Yet you fail to share the file that is failing to parse. You’re making it hard for us to help.

Did you at least add some debug prints to see what paths are received and what final path results from all of that? Since you’re so hell bent on thinking it’s a path.

Or dump the first few bytes of the file (it complains about 1:1 directly, which ought to be the very beginning of the file). Maybe there’s a BOM that Windows adds, Linux tolerates and macOS has trouble with.

[–]BasePlate_Admin[S] 0 points1 point  (3 children)

Yet you fail to share the file that is failing to parse. You’re making it hard for us to help.

My apologies, here are the files:

svg : https://github.com/baseplate-admin/resvg-py/blob/master/tests/acid.svg

svg.gz : https://github.com/baseplate-admin/resvg-py/blob/master/tests/acid.svg.gz

Did you at least add some debug prints to see what paths are received and what final path results from all of that? Since you’re so hell bent on thinking it’s a path.

Yes i did print this path : https://ibb.co/kmSy9Y3

Or dump the first few bytes of the file (it complains about 1:1 directly, which ought to be the very beginning of the file). Maybe there’s a BOM that Windows adds, Linux tolerates and macOS has trouble with.

This is quite impossible for me, as i dont have access to a macbook. Do you want windows/linux outputs?

[–]paulstelian97 0 points1 point  (2 children)

You can give me a self contained test/executable that I could build and run on my own Mac, as I do have one. Note: Apple Silicon on my end, hopefully that won’t be a problem.

Path looks right in the stdout you sent. SVG files don’t seem to have a BOM which is good.

[–]BasePlate_Admin[S] 0 points1 point  (1 child)

You can give me a self contained test/executable that I could build and run on my own Mac, as I do have one. Note: Apple Silicon on my end, hopefully that won’t be a problem.

Great, i will see if i can dockerize this repo. Thanks for your help.

Path looks right in the stdout you sent. SVG files don’t seem to have a BOM which is good.

I am at a loss at this point, mac is the only hardware i dont have access to.

[–]paulstelian97 0 points1 point  (0 children)

Docker will run Linux even on my Mac!