Skip to content
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

The example code could not work when applying deep_sea_treasure_v0_render #9

Open
penggao00 opened this issue Jun 14, 2023 · 0 comments

Comments

@penggao00
Copy link

My code is just the example code, thank you for the help in advance.

#dst: DeepSeaTreasureV0
kk = DeepSeaTreasureV0.new(
max_steps=1000,
render_treasure_values=True
)
type(kk)
#dst.render()
kk.render()

Debug Info:


Using DST 2.0.2 (8739bdc)

AssertionError Traceback (most recent call last)
Input In [10], in <cell line: 18>()
16 type(kk)
17 #dst.render()
---> 18 kk.render()

File ~/.local/lib/python3.10/site-packages/deep_sea_treasure/deep_sea_treasure_v0.py:357, in DeepSeaTreasureV0.render(self, mode, debug_dict)
354 contract("human" == mode, "Currently, only "human" rendering mode is supported, got mode "{0}"!", mode)
356 if self.renderer is None:
--> 357 self.renderer = DeepSeaTreasureV0Renderer(self.theme, 48, 48, self.seabed.shape[0], int(np.max(self.seabed) + 1)) # type: ignore[no-untyped-call]
359 contract(self.renderer is not None, "Failed to create {0}.", DeepSeaTreasureV0Renderer.class.name)
361 self.renderer.render(
362 submarines=[(int(self.sub_pos[0]), int(self.sub_pos[1]))],
363 treasure_values=self.treasures,
(...)
367 render_treasure_values=self.render_treasure_values
368 )

File ~/.local/lib/python3.10/site-packages/deep_sea_treasure/deep_sea_treasure_v0_renderer.py:53, in DeepSeaTreasureV0Renderer.init(self, theme, tile_width, tile_height, x_tiles, y_tiles)
49 self.theme = theme
51 success, failed = pygame.init()
---> 53 contract(0 == failed, "Failed to initialize {0} pygame modules ({1})! ({2} modules were initialized successfully)", failed, ', '.join(['pygame.' + mod for mod in self.__list_failed_modules()]), success)
55 self.display = pygame.display.set_mode(size=(tile_width * x_tiles, tile_height * (y_tiles + 2)))
56 pygame.display.set_caption(self.theme.title)

File ~/.local/lib/python3.10/site-packages/deep_sea_treasure/contract.py:50, in contract(condition, format_string, *format_args)
46 formatted_stack_trace: str = ''.join(traceback.format_stack(limit=50)[:-1])
48 error_msg: str = f"Process {os.getpid()} panicked at "{formatted_msg}", {filename}:{line}\n\n{concatenated_source_lines}\n{formatted_stack_trace}"
---> 50 raise AssertionError(error_msg)

AssertionError: Process 4932 panicked at "Failed to initialize 1 pygame modules ()! (4 modules were initialized successfully)", /ufs/peng/.local/lib/python3.10/site-packages/deep_sea_treasure/deep_sea_treasure_v0_renderer.py:53

File "/usr/lib64/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib64/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.10/site-packages/ipykernel_launcher.py", line 16, in
app.launch_new_instance()
File "/ufs/peng/.local/lib/python3.10/site-packages/traitlets/config/application.py", line 1041, in launch_instance
app.start()
File "/usr/lib/python3.10/site-packages/ipykernel/kernelapp.py", line 677, in start
self.io_loop.start()
File "/ufs/peng/.local/lib/python3.10/site-packages/tornado/platform/asyncio.py", line 215, in start
self.asyncio_loop.run_forever()
File "/usr/lib64/python3.10/asyncio/base_events.py", line 600, in run_forever
self._run_once()
File "/usr/lib64/python3.10/asyncio/base_events.py", line 1896, in _run_once
handle._run()
File "/usr/lib64/python3.10/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/usr/lib/python3.10/site-packages/ipykernel/kernelbase.py", line 457, in dispatch_queue
await self.process_one()
File "/usr/lib/python3.10/site-packages/ipykernel/kernelbase.py", line 446, in process_one
await dispatch(*args)
File "/usr/lib/python3.10/site-packages/ipykernel/kernelbase.py", line 353, in dispatch_shell
await result
File "/usr/lib/python3.10/site-packages/ipykernel/kernelbase.py", line 648, in execute_request
reply_content = await reply_content
File "/usr/lib/python3.10/site-packages/ipykernel/ipkernel.py", line 353, in do_execute
res = shell.run_cell(code, store_history=store_history, silent=silent)
File "/usr/lib/python3.10/site-packages/ipykernel/zmqshell.py", line 532, in run_cell
return super().run_cell(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 2880, in run_cell
result = self._run_cell(
File "/usr/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 2935, in _run_cell
return runner(coro)
File "/usr/lib/python3.10/site-packages/IPython/core/async_helpers.py", line 129, in pseudo_sync_runner
coro.send(None)
File "/usr/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3134, in run_cell_async
has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
File "/usr/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3337, in run_ast_nodes
if await self.run_code(code, result, async
=asy):
File "/usr/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3397, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "/tmp/ipykernel_4932/2415795734.py", line 18, in <cell line: 18>
kk.render()
File "/ufs/peng/.local/lib/python3.10/site-packages/deep_sea_treasure/deep_sea_treasure_v0.py", line 357, in render
self.renderer = DeepSeaTreasureV0Renderer(self.theme, 48, 48, self.seabed.shape[0], int(np.max(self.seabed) + 1)) # type: ignore[no-untyped-call]
File "/ufs/peng/.local/lib/python3.10/site-packages/deep_sea_treasure/deep_sea_treasure_v0_renderer.py", line 53, in init
contract(0 == failed, "Failed to initialize {0} pygame modules ({1})! ({2} modules were initialized successfully)", failed, ', '.join(['pygame.' + mod for mod in self.__list_failed_modules()]), success)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant