I am trying to build a python package which has a setup.py file , I created an entry point but I run through it then it gives import error otherwise if run normally in vs code it does not gives import error ,
C:.
│ setup.py
│
├───build
│ ├───bdist.win-amd64
│ └───lib
│ └───treasure_hunt
│ death.py
│ energy.py
│ map.py
│ path_scenes.py
│ scenes.py
│ setup.py
│ treasurehunt.py
│ __init__.py
│
├───treasure_hunt
│ │ death.py
│ │ energy.py
│ │ map.py
│ │ path_scenes.py
│ │ scenes.py
│ │ setup.py
│ │ treasurehunt.py
│ │ __init__.py
│ │
│ ├───treasure_hunt.egg-info
│ │ dependency_links.txt
│ │ entry_points.txt
│ │ PKG-INFO
│ │ SOURCES.txt
│ │ top_level.txt
│ │
│ └───__pycache__
│ death.cpython-310.pyc
│ energy.cpython-310.pyc
│ energy.cpython-312.pyc
│ map.cpython-310.pyc
│ path_scenes.cpython-310.pyc
│ scenes.cpython-310.pyc
│ treasurehunt.cpython-312.pyc
│ __init__.cpython-312.pyc
│
└───treasure_hunt.egg-info
dependency_links.txt
entry_points.txt
PKG-INFO
SOURCES.txt
top_level.txt
this is my setup.py file- try : from setuptools import setup except: from distutils.tools import setup
config = {
"packages":["treasure_hunt"],
"entry_points":{
"console_scripts":"play=treasurehunt:main"
}
}
setup(**config)
this is the treasurehunt.py file which contains the main() function-
def main():
from .energy import Energy
from .scenes import *
from .path_scenes import *
scene_map = {
"scene1":scenes.Scene1(),
"scene2":scenes.Scene2(),
"scene3":scenes.Scene3(),
"scene4":scenes.Scene4(),
"scene5":scenes.Scene5(),
"scene6":scenes.Scene6(),
}
path_scene_map = {
"scene1":path_scenes.Pathscene4(),
"scene3":path_scenes.Pathscene1(),
"scene2":path_scenes.Pathscene5(),
"scene5":path_scenes.Pathscene3(),
"scene4":path_scenes.Pathscene6(),
"scene6":path_scenes.Pathscene2(),
}
name = "scene1"
x = Energy()
while True:
energylevel = x.show()
x.warning()
path_scene_map[name].path()
energylevel = energylevel-1
name = scene_map[name].enter()
energylevel = energylevel-1
when i run the play command it shows module not found error
play=treasurehunt:mainyou have no module namedtreasurehuntshould beplay=treasure_hunt:mainplay=treasure_hunt.treaserhunt:main?