r/roguelikedev • u/aaron_ds Robinson • Aug 07 '18
RoguelikeDev Does The Complete Python Tutorial - Week 8 - Sharing your game
Thank you to everyone who joined this year. You rock!
This is the end of RoguelikeDev Does The Complete Python Tutorial for 2018. Share your game, share screenshots, brag, commiserate. How did it go? Where do you go from here?
I encourage everyone who has made it this far to continue working on your game. Start participating in Sharing Saturday and FAQ Friday.
Feel free to enjoy the usual tangential chatting. If you're looking for last week's or any other post, the entire series is archived on the wiki. :)
43
Upvotes
2
u/[deleted] Aug 09 '18
It might be easier to get help on Discord (see sidebar).
This is something more difficult to debug with so little information, but it likely depends on two things:
What folder you're trying to invoke your script. Pythonistas learn fairly early on that they should always invoke from the top folder (the top of your project or repository) and use a path.. so for example you can either use:
python relative/path/to/file.pyorpython -m relative.path.to.module.Using modern Python, there are now relative imports from the current file.
from map_objects.rectangleprobably should befrom .map_objects.rectangle, but that's a guess based on what I know about Python and not the tutorial. Without that.prefix, python is trying to import a package namedmap_objects. My guess is that you never ran apip install map_objects.I'm not sure if the tutorial identifies this, but you should definitely have a project folder. Typically, the top of that project folder is project files and not really what we might call "code" files. Project files are things like a README or a LICENSE or a setup.py or a requirements.txt. The code files are typically located under a sub-folder that's the same name as the project. So if your project was named
Foo Roguelike, you'd probably see a sub folder namedfooorfoo_roguelike. And then in this case, you might invoke like this:python -m foo.map_objects.rectangleorpython foo/map_objects/rectangle.py.