Python icon indicating copy to clipboard operation
Python copied to clipboard

Exception occurs when tring to eval Python code

Open hckr opened this issue 8 years ago • 5 comments

OS: Manjaro Linux Default Python version: 3.5.2 LT installed from AUR (package lighttable-git)

I created a file test.py with the following code:

print(2+2);

And then tried to eval it with Ctrl+Shift+Enter, which resulted in the exception below:

Traceback (most recent call last): File "/usr/lib/lighttable/resources/app/plugins/Python/py-src/ltmain.py", line 193, in handleEval code= compile(ensureUtf(code), ensureUtf(data[2]["name"]), 'eval') File "/usr/lib/lighttable/resources/app/plugins/Python/py-src/ltmain.py", line 50, in ensureUtf if type(s) == unicode: NameError: name 'unicode' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/lighttable/resources/app/plugins/Python/py-src/ltmain.py", line 197, in handleEval code= compile(ensureUtf(code), ensureUtf(data[2]["name"]), 'exec') File "/usr/lib/lighttable/resources/app/plugins/Python/py-src/ltmain.py", line 50, in ensureUtf if type(s) == unicode: NameError: name 'unicode' is not defined

screenshot_20170110_220927

hckr avatar Jan 10 '17 21:01 hckr

PR #39 should solve the problem. Why don't you merge it?

hckr avatar Jan 10 '17 21:01 hckr

Unfortunately, the Python plugin is lacking an active maintainer, let alone people to review pull requests.

Since none of the current Light Table maintainers use Python this plugin has not had much love. We need people from the community to either become maintainers of the plugin, or verify pull requests are acceptable by testing them out. Otherwise the open pull requests will continue to languish.

If anyone is interested, please feel free to get in touch with a member of the Light Table team.

sbauer322 avatar Jan 11 '17 02:01 sbauer322

had same issue with Windows 10

Almenon avatar Jul 11 '17 03:07 Almenon

had same issue with Windows 10 too.. at first time when I run code it's work but after that there are same problem image

VasilGrdzelishvili avatar Sep 06 '21 19:09 VasilGrdzelishvili

That NameError looks like the code base was written for an older version of Python (2.x) and doesn't work on Python 3.5.

Converting the whole code base to be compatible with Python 3.x may be easy or a large and difficult task. Hard to know without looking inside. There are libraries and tools to ease the process.

akaihola avatar Sep 07 '21 05:09 akaihola