karpathy/ulogme

SyntaxError

gmar5 opened this issue · 4 comments

gmar5 commented

Hi.
First of all, thanks for the amazing project, I love the spirit of data collection and great visualisation!

When I run ulogme.sh, I constantly get the following error:

SyntaxError: invalid syntax
logged key frequency: Wed Jun  1 17:19:36 BST 2016 0 release events detected into logs/keyfreq_.txt
  File "rewind7am.py", line 27
    print rewindTime(int(time.time()))
                   ^
SyntaxError: invalid syntax
[...]

Data is still recorded in the window_txt and keyfreq_.txt logs (In this format, e.g.: 1464797947 ulogme - File Manager -- I don't know if it is correct, with that date format.)

I also get these errors running the UI scripts (and they don't do anything):

$ python export_events.py
  File "export_events.py", line 26
    except Exception, e:
                    ^
SyntaxError: invalid syntax

$ python ulogme_serve.py
  File "ulogme_serve.py", line 72
    print 'Serving ulogme, see it on http://localhost:' + `PORT`
                                                      ^
SyntaxError: Missing parentheses in call to 'print'

I am on Manjaro 16.06 (Xfce) Linux.

Do you know what the problem could be and how (if) it can be solved?

Thanks!

Probably your version of python. Run python --version and it most likely will be 3+.

gmar5 commented

Yes, it is 3.5.1. What would I need instead?

A few options:

(1) modify your local copy to be python3 compatible: wrap print statements in parentheses; switch syntax of exception to, except Exception as e.

(2) [better option] Fork this github project, apply these python 3 changes, and issue a pull request so that others benefit from the change.

(3) Use python 2.x to run the script (either by explicitly calling python27 in ulogme.sh (or wherever) or telling your OS to default to python 2.x instead of 3.x.

gmar5 commented

Thank you. For now, I have opted for (3), to avoid possible further problems until I manage to make it run correctly. If everything works, then I will propose the changes.