SyntaxError: invalid character in identifier — despite there being almost certainly no unallowed character

我的未来我决定 提交于 2020-05-31 04:36:09

问题


I'm getting the message:

>>> import some_module
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/david/.local/lib/python3.6/site-packages/some_module.py", line 1
    ​def​ some_func():
        ^
SyntaxError: invalid character in identifier

When I am trying to import a local module from a package I installed with pip.

The structure of the package is as follows:

modules_and_packages
├── modules_and_packages
│   ├── __init__.py
│   └── some_module.py
├── setup.py
└── bin
    └── cli_script

The code for some_module.py is as follows:

def some_func():
    return 'hello'

Other relevant(?) files:

setup.py

setup(
    name='some_module',
    packages=['modules_and_packages'],
    scripts=['bin/cli_script']
)

bin/cli_script

#!/usr/bin/env python3

import modules_and_packages
print('hello')

来源:https://stackoverflow.com/questions/61171637/syntaxerror-invalid-character-in-identifier-despite-there-being-almost-certa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!