Skip to content
This repository was archived by the owner on Oct 21, 2022. It is now read-only.
This repository was archived by the owner on Oct 21, 2022. It is now read-only.

"TypeError: embedded NUL character" evaluating Python file with a path containing spaces on Windows #45

@kenny-evitt

Description

@kenny-evitt

Copied from both comments in LightTable/LightTable#1691; first comment:

[This was copied mostly as-is from a comment I made on issue #1640.]

I downloaded Python 3.4.1 and ran the following code in a Python file in Light Table:

print("Hello world!")

I can see 1640 [stdout]: Hello world! in the Light Table console (where 1640 is the folder in which the Python file is located).

I do however get exceptions:

Traceback (most recent call last):
  File "C:\Users\kevitt\Documents\LightTable\plugins\python\py-src\ltmain.py", line 187, in > handleEval
    code= compile(code, data[2]["name"], 'eval')
TypeError: embedded NUL character

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\kevitt\Documents\LightTable\plugins\python\py-src\ltmain.py", line 191, in handleEval
    code= compile(code, data[2]["name"], 'exec')
TypeError: embedded NUL character

Base on a cursory review of Google search results for TypeError: embedded NUL character I'm guessing that some file path needs to be escaped.

The full path of my python file is C:\Users\kevitt\Documents@cases, open\1195\1640\hello-world.py.

If I evaluate the code in a copy of the Python file with the path C:@test\case1195\1640\hello-world.py there are no exceptions reported.

second comment:

Thanks for the thorough report Kenny. For anyone interested in digging into this, this would be a good place to start considering escaping spaces.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions