labscript-suite-temp-2 / lyse

lyse is an analysis framework. It coordinates the running of python analysis scripts on experiment data as it becomes availiable, updating plots in real time.
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Lyse doesn't handle unicode well #28

Closed philipstarkey closed 6 years ago

philipstarkey commented 7 years ago

Original report (archived issue) by Jan Werkmann (Bitbucket: PhyNerd, GitHub: PhyNerd).


If you import scripts into lyse that include non ascii characters in their name (such as german Umlauts) the script will not run.

If you modify analysis_subprocess.py in line 288 in the following way scripts will run:

#!python

execfile(self.filepath.encode('utf-8'), sandbox, sandbox)

However if that script then crashed lyse will crash along with it and give you this traceback:

#!

Traceback (most recent call last):
  File "/Users/janwerkmann/anaconda/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "analysis_subprocess.py", line 257, in mainloop
    success = self.do_analysis(path)
  File "/Users/janwerkmann/anaconda/lib/python2.7/site-packages/qtutils/invoke_in_main.py", line 114, in f
    return inmain(fn, *args, **kwargs)
  File "/Users/janwerkmann/anaconda/lib/python2.7/site-packages/qtutils/invoke_in_main.py", line 74, in inmain
    return get_inmain_result(in_main_later(fn,False,*args,**kwargs))
  File "/Users/janwerkmann/anaconda/lib/python2.7/site-packages/qtutils/invoke_in_main.py", line 94, in get_inmain_result
    exec('raise type, value, traceback')
  File "/Users/janwerkmann/anaconda/lib/python2.7/site-packages/qtutils/invoke_in_main.py", line 53, in event
    result = event.fn(*event.args, **event.kwargs)
  File "analysis_subprocess.py", line 297, in do_analysis
    print('%s' % message)
  File "/Users/janwerkmann/anaconda/lib/python2.7/site-packages/zprocess/__init__.py", line 455, in write
    self.local.sock.send_multipart([self.streamname.encode('utf8'), s.encode('utf8')])
UnicodeDecodeError: 'ascii' codec can't decode byte 0xcc in position 91: ordinal not in range(128)
philipstarkey commented 7 years ago

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


Doing .encode('utf8') on the filepath makes sense, and the other problem I would say is a zprocess bug, which I've fixed in zprocess 2.1.1 (released on PyPI so pip install --upgrade zprocess will get it).

philipstarkey commented 7 years ago

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


Fix issue #28, handle unicode in analysis routine filenames

→ \<\<cset a4135b74151d9b8bdb82a74ebf197cadc1d16ce4>>

philipstarkey commented 7 years ago

Original comment by Philip Starkey (Bitbucket: pstarkey, GitHub: philipstarkey).


This is not actually fixed as the changeset in the pullrequest was backed-out before merging

philipstarkey commented 6 years ago

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


Resolved by pull request #22