-
Notifications
You must be signed in to change notification settings - Fork 126
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
Importing error #28
Comments
The imports are not setup correctly in this project. It tends poor usage in Python to use relative imports unless you're adding them to the Please Reference: PEP 8 - Imports In the example @BOXEL-REBOUND provides of Line 5 it's the incorrect way to import: The imports from other project files should look like this (following PEP 8 style conventions):
Another thing to note is there are other imports in this project that break PEP 8 style conventions.
Following PEP 8 style conventions (correct):
The rule is one import per line, and the only exception is multiple imports from a package or sub-package, as seen above:
One more PEP 8 violation I saw a lot of in this project follows up on the last example: Please Reference: PEP 8 - Naming Conventions |
I guess you can take the player module and put it into the main.py file MANUALLY. That's what I did. |
You can, but that isn't the better way of solving the issue. You have to follow the new Python update by removing all the .'s, they indicate relativity but only in "modules". |
I mean, this game was literally made at a game jam, with 2 days time, so it makes sense to not strictly follow import guidelines lol. During coding jams/thons whatever you're usually aiming to write working code, not maintainable code. |
Aight, can we do a pull request? |
When I run it, the terminal says Import Error.
Here's the total error:
Traceback (most recent call last):
File "c:\Users\dacpu\OneDrive\Desktop\Flappuccino\main.py", line 5, in
from .player import Player
ImportError: attempted relative import with no known parent package
I have every file, and it is not just this import, it is all of them.
The text was updated successfully, but these errors were encountered: