Qirky / FoxDot

Python driven environment for Live Coding
http://foxdot.org
Other
1.04k stars 135 forks source link

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte #32

Open slink opened 7 years ago

slink commented 7 years ago

In the FoxDot gui I try something as simple as evaluating print(2+2) and the gui instance crashes with the following error:

$ python -m FoxDot
Traceback (most recent call last):
  File "/Users/username/anaconda3/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/username/anaconda3/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/username/anaconda3/lib/python3.6/site-packages/FoxDot/__main__.py", line 23, in <module>
    FoxDot = workspace(FoxDotCode).run()
  File "/Users/username/anaconda3/lib/python3.6/site-packages/FoxDot/lib/Workspace/Editor.py", line 251, in run
    self.root.mainloop()
  File "/Users/username/anaconda3/lib/python3.6/tkinter/__init__.py", line 1277, in mainloop
    self.tk.mainloop(n)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

my python / FoxDot environment is as follows

$ pip list | grep FoxDot
FoxDot (0.4.7)
$ python --version
Python 3.6.1 :: Anaconda 4.4.0 (x86_64)

I'm pretty stumped by this error message. Suggestions on workarounds or how to best debug this issue?

Qirky commented 7 years ago

My initial guess would be it has something to do with Anaconda - does the error come up in the console before or after you evaluate a line of code? Could be that anaconda is trying to convert a string somewhere to utf-8 when it isn't meant to. Will have an investigate and get back to you.

slink commented 7 years ago

The error message appears in the terminal window used to launch the FoxDot gui. The gui then quits. Not sure why / how anaconda would be inserting itself, but it might be the issues.

Chovin commented 7 years ago

I am also getting this on when pip installing FoxDot with Python3.6 (without Anaconda) Not on Python2.7 though

$ python --version
Python 3.6.2
Qirky commented 7 years ago

What O/S are you on?

slink commented 7 years ago

@Qirky I'm running the latest macOS -- 10.12.6 (16G29)

Chovin commented 7 years ago

macOS 10.12.6 as well

Qirky commented 7 years ago

So I've added what seems like a bit of a hacky attempt to fix to Editor.py. If you could either install from this repo or replace the contents of your version of lib/Workspace/Editor.py with the new one and let me know how you get on that'd be great.

slink commented 7 years ago

@Qirky this may be a partial fix. Thanks! I replaced my Editor.py with the one you updated.

It appears to work most of the time, but the output to the bottom half of the FoxDot window does not appear to always update consistently. I am trying to most basic of commands print(2+2) and will try executing commands with cntl+return or command+return and will even try executing the command from the menu bar.

I then click away to the terminal window from which I have executed python -m FoxDot and will see the following error (which I am not sure is related, as it doesn't appear to crash the FoxDot instance).

$ python -m FoxDot 2017-09-09 18:32:12.964 python[57120:7346113] IMKInputSession presentFunctionRowItemTextInputViewWithEndpoint:completionHandler: : [self textInputContext]=0x0 *NO* NSRemoteViewController to client, NSError=Error Domain=NSCocoaErrorDomain Code=4099 "The connection from pid 0 was invalidated from this process." UserInfo={NSDebugDescription=The connection from pid 0 was invalidated from this process.}, com.apple.inputmethod.EmojiFunctionRowItem

Then, when I click back the output portion of the FoxDot window will have updated. with multiple outputs of the print command.

Hope this helps!

Qirky commented 6 years ago

If you evaluate code such p1 >> play("x ") do you hear the kick drum or do you have to go to the terminal and back again before it actually runs?