plbrault / youre-the-os

A game where you are a computer's OS and you have to manage processes, memory and I/O events.
https://plbrault.github.io/youre-the-os/
GNU General Public License v3.0
1.79k stars 68 forks source link

API using #168

Open davsla12 opened 1 month ago

davsla12 commented 1 month ago

hello im jung programmer and i try it API to get score and save it but i foung issues wen i import automated_skeleton the run-auto.py file returne this

C:\Users\DavSlav\Documents\PyCharm_project's\youre the os>python run-auto.py skript.py pygame 2.5.2 (SDL 2.28.3, Python 3.12.2) Hello from the pygame community. https://www.pygame.org/contribute.html Traceback (most recent call last): File "C:\Users\DavSlav\Documents\PyCharm_project's\youre the os\src\auto.py", line 137, in asyncio.run(main()) File "C:\Users\DavSlav\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 194, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "C:\Users\DavSlav\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\DavSlav\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 685, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "C:\Users\DavSlav\Documents\PyCharm_project's\youre the os\src\auto.py", line 135, in main await game_manager.play(ignore_events=True) File "C:\Users\DavSlav\Documents\PyCharm_project's\youre the os\src\engine\game_manager.py", line 138, in play self._scene_manager.start_scene(self.startup_scene) File "C:\Users\DavSlav\Documents\PyCharm_project's\youre the os\src\engine\scene_manager.py", line 45, in start_scene self._scenes[scene_id].setup() File "C:\Users\DavSlav\Documents\PyCharm_project's\youre the os\src\scenes\stage.py", line 98, in setup self._prepare_automation_script() File "C:\Users\DavSlav\Documents\PyCharm_project's\youre the os\src\scenes\stage.py", line 213, in _prepare_automation_script exec(self._script, script_globals) File "../skript.py", line 1, in from automated_skeleton import * ModuleNotFoundError: No module named 'automated_skeleton'

skript.py contains from automated_skeleton import *

plbrault commented 1 month ago

Hello,

The automated_skeleton.py file is not meant to be imported. It is a template that you can copy and adapt in order to create your own automation script. Say you copy the content of automated_skeleton.py to myscript.py, you can then run it using the command pipenv run myscript.py. Also make sure that your script is at the root of the repo (same directory as the skeleton).