jdf / Processing.py-Bugs

A home for all bugs and feature requests about Python Mode for the Processing Development Environment.
41 stars 8 forks source link

Non-ASCII character in sketch path causes crash. #202

Closed juansegarra closed 6 years ago

juansegarra commented 6 years ago

Hi all, I'm not able to work with Processing 3.x and Python mode. Java mode works fine. But when I change to Python mode it doesn't matter what I write: when pushing run I always get this error:

processing.app.SketchException: UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 13-15: invalid data at jycessing.mode.run.SketchRunner.convertPythonSketchError(SketchRunner.java:248) at jycessing.mode.run.SketchRunner.lambda$2(SketchRunner.java:122) at java.lang.Thread.run(Thread.java:748)

This happens just trying a simple print("hello")

I am running Processing in a Lenovo laptop, windows 10. No problem running processing in other PC.

Can anyone give me an idea on what is happening?

Many thanks in advance. Juan.

juansegarra commented 6 years ago

Hi, do not loose your time! The problem was a "é" character in the username and path in my kid's windows laptop. Do not know why, but java mode does not have problems, but python mode does. Thanks for reading... Juan.

jdf commented 6 years ago

Juan, it's no waste of time, and I'm very grateful for your report. You'd do me a great service if you could report back

  1. the path where Python mode is installed (i.e., the modes folder in the processing sketchbook)
  2. the system locale on the laptop in question

This is a known problem, and a serious one, and I hope I can pin it down with your help. Thank you!

jdf commented 6 years ago

Ping... Could I trouble you for any of that information? It would be very helpful.

juansegarra commented 6 years ago

Hi, I am abroad. This weekend I'll post the info. Do not hesitate to remind me if I do not write back. Juan.

El 15 nov. 2017 4:01, "Jonathan Feinberg" notifications@github.com escribió:

Ping... Could I trouble you for any of that information? It would be very helpful.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jdf/Processing.py-Bugs/issues/202#issuecomment-344471353, or mute the thread https://github.com/notifications/unsubscribe-auth/AgBmVVRK6DQKP0COUmmA5ZVrBHow8U0fks5s2lP6gaJpZM4QamOp .

brendanhowell commented 6 years ago

I can reproduce this. (and it cost my poor student 3 days of hair tearing). Make a folder somewhere on your filesystem called "börk" or "fôléfafa" or whatever. Then save your sketch in a sub-folder of this new directory with non-ascii characters. You will bomb out with a "UnicodeDecodeError". Tested on Linux and Windows.

brendanhowell commented 6 years ago

More info: locale on linux is "en/US", on windows "de/DE".

jdf commented 6 years ago

THANK YOU THANK YOU THANK YOU

Thank you for the simple steps to reproduce. I have found and fixed the bug, which is ultimately because Jython incorrectly decodes Java strings (which are UTF-16, or rather UCS-2) as UTF-8. I'll be rolling out the fix shortly.

This has been the worst and longest-lived bug in Python Mode. I deeply appreciate your help.

jdf commented 6 years ago

Pushed to version 3038