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

Curly brackets #24

Open
marqroldan opened this issue Oct 18, 2018 · 5 comments
Open

Curly brackets #24

marqroldan opened this issue Oct 18, 2018 · 5 comments

Comments

@marqroldan
Copy link

marqroldan commented Oct 18, 2018

Hi! I'm not a pro at using Python but there seems to be a parsing error for arguments with Bython
I'm trying to pass JSON string as an argument, which works if you use python but breaks when using Bython, the whitespaces and/or the double-quotes in the argument breaks.

sample JSON argument that breaks:
'{"1": [1,2]}'

when the output is printed from sys.argv, it becomes {1:[1,2]} thereby breaks the load function of the JSON

EDIT:

The argument above should have backslashes before the double quotes for it to work properly :)

Thanks!

@mathialo
Copy link
Owner

Can you please post a code snippet that exhibits this behavior? 🙂 I can look into it, but I need an example that breaks as I am not too familiar with loading JSON in Python.

@Aareon
Copy link

Aareon commented Oct 31, 2018

Looks like a non-issue following the edit @hyvraine

@mathialo
Copy link
Owner

mathialo commented Nov 1, 2018

Yeah, I was a bit confused on whether it still has an issue or not. I will close the issue if no further details is provided in a couple of days.

@marqroldan
Copy link
Author

Apologies for the confusion. I'll close this issue within the day, but is it possible to have Bython accept arguments enclosed with double quotes ignore the double quotes inside it? So there wouldn't be a need to escape the argument. Please let me know how I can help, I'm still new to Python but if you could point me to the right direction (or file) I'll gladly make my own modification and do a PR if everything is working as expected.

P.S. Thank you for creating this wonderful program! Saved me the frustration.

@mathialo
Copy link
Owner

mathialo commented Nov 2, 2018

Oh, I think I see the problem now. If the arguments are interpreted differently by bython and python, I would consider it a bug, and escaping characters are simply a workaround.

The parts responsible for executing python files (which is where the arguments are handled) are lines 137 through 158 in scripts/bython. Feel free to look into it yourself, I might do it at some point if I have the time.

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

No branches or pull requests

3 participants