Skip to content

Confusing error string on typo'd module import #5631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
leogott opened this issue Mar 27, 2025 · 0 comments
Open

Confusing error string on typo'd module import #5631

leogott opened this issue Mar 27, 2025 · 0 comments
Labels
C-bug Something isn't working

Comments

@leogott
Copy link

leogott commented Mar 27, 2025

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
@leogott leogott added the C-bug Something isn't working label Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy