-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
C-bugSomething isn't workingSomething isn't working
Description
Summary
When attempting to import a module, and (misremembering or mistyping) the module name to include a dash -
character, rustpython will give a (true but) misleading error message.
This is mostly a problem in the online demo or running a script, as the REPL at least points out the exact location of the error.
Expected
>>> import py-compile
^
SyntaxError: import name contains invalid character `-`
Actual
>>>>> import aa-bb
File "<stdin>", line 1
import aa-bb
^
SyntaxError: simple statements must be separated by newlines or semicolons
Python Documentation
Python 3.13.2 | packaged by conda-forge | (main, Feb 17 2025, 14:10:22) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import aa-bb
File "<python-input-0>", line 1
import aa-bb
^
SyntaxError: invalid syntax
Metadata
Metadata
Assignees
Labels
C-bugSomething isn't workingSomething isn't working