easycharts icon indicating copy to clipboard operation
easycharts copied to clipboard

real world example fails to launch

Open MarkChisholm-dev opened this issue 3 years ago • 0 comments

Hi I tried running the real world example you have but I'm getting the following error:

`PS C:\Code\fastapiBench> uvicorn --host 0.0.0.0 --port 6969 charts:server INFO: Started server process [19284] 08-19 00:39:41 uvicorn.error INFO Started server process [19284] INFO: Waiting for application startup. 08-19 00:39:41 uvicorn.error INFO Waiting for application startup. 08-19 00:39:41 aiopyql-db-charts_database.db ERROR error during create_table - KeyError(1660865981.261195) Traceback (most recent call last): File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\data.py", line 565, in create_table result = await new_table.create_schema() File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\table.py", line 63, in create_schema return await self.database.run(await self.get_schema()) File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\data.py", line 447, in run self.cache_check(query) File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\data.py", line 294, in cache_check for cache, _ in self.cache: File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\cache.py", line 37, in cache_generator yield cache_key, self.timestamp_to_cache[timestamp][0] KeyError: 1660865981.261195 08-19 00:39:41 aiopyql-db-charts_database.db ERROR error during create_table - KeyError(1660865981.261195) Traceback (most recent call last): File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\data.py", line 565, in create_table result = await new_table.create_schema() File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\table.py", line 63, in create_schema return await self.database.run(await self.get_schema()) File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\data.py", line 447, in run self.cache_check(query) File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\data.py", line 294, in cache_check for cache, _ in self.cache: File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\cache.py", line 37, in cache_generator yield cache_key, self.timestamp_to_cache[timestamp][0] KeyError: 1660865981.261195 08-19 00:39:41 aiopyql-db-charts_database.db ERROR exception inserting into test Traceback (most recent call last): File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\table.py", line 445, in insert result = await self.database.run(query) File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\data.py", line 447, in run self.cache_check(query) File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\data.py", line 294, in cache_check for cache, _ in self.cache: File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\cache.py", line 37, in cache_generator yield cache_key, self.timestamp_to_cache[timestamp][0] KeyError: 1660865981.261195 ERROR: Traceback (most recent call last): File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\starlette\routing.py", line 635, in lifespan async with self.lifespan_context(app): File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\starlette\routing.py", line 530, in aenter await self._router.startup() File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\starlette\routing.py", line 612, in startup await handler() File "C:\Code\fastapiBench.\charts.py", line 21, in setup await server.charts.create_dataset( File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\easycharts\charts.py", line 185, in create_dataset await self.db.tables[name].insert( File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\table.py", line 452, in insert raise e File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\table.py", line 445, in insert result = await self.database.run(query) File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\data.py", line 447, in run self.cache_check(query) File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\data.py", line 294, in cache_check for cache, _ in self.cache: File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\cache.py", line 37, in cache_generator yield cache_key, self.timestamp_to_cache[timestamp][0] KeyError: 1660865981.261195

08-19 00:39:41 uvicorn.error ERROR Traceback (most recent call last): File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\starlette\routing.py", line 635, in lifespan async with self.lifespan_context(app): File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\starlette\routing.py", line 530, in aenter File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\starlette\routing.py", line 612, in startup await handler() File "C:\Code\fastapiBench.\charts.py", line 21, in setup File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\easycharts\charts.py", line 185, in create_dataset await self.db.tables[name].insert( File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\table.py", line 452, in insert File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\table.py", line 445, in insert result = await self.database.run(query) File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\data.py", line 447, in run self.cache_check(query) File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\data.py", line 294, in cache_check for cache, _ in self.cache: File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\aiopyql\cache.py", line 37, in cache_generator yield cache_key, self.timestamp_to_cache[timestamp][0] KeyError: 1660865981.261195

ERROR: Application startup failed. Exiting. 08-19 00:39:41 uvicorn.error ERROR Application startup failed. Exiting. PS C:\Code\fastapiBench> & C:/Users/mac/AppData/Local/Programs/Python/Python310/python.exe c:/Code/fastapiBench/charts.py File "c:\Code\fastapiBench\charts.py", line 21 await server.charts.create_dataset( IndentationError: unexpected indent PS C:\Code\fastapiBench> & C:/Users/mac/AppData/Local/Programs/Python/Python310/python.exe c:/Code/fastapiBench/charts.py File "c:\Code\fastapiBench\charts.py", line 21 await server.charts.create_dataset( IndentationError: unexpected indent PS C:\Code\fastapiBench> uvicorn --host 0.0.0.0 --port 6969 charts:server Traceback (most recent call last): File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in run_code exec(code, run_globals) File "C:\Users\mac\AppData\Local\Programs\Python\Python310\Scripts\uvicorn.exe_main.py", line 7, in File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1130, in call return self.main(*args, **kwargs) File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1055, in main rv = self.invoke(ctx) File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 760, in invoke return _callback(*args, **kwargs) File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\uvicorn\main.py", line 407, in main run( File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\uvicorn\main.py", line 575, in run server.run() File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\uvicorn\server.py", line 60, in run return asyncio.run(self.serve(sockets=sockets)) File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) return future.result() File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\uvicorn\server.py", line 67, in serve config.load() File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\uvicorn\config.py", line 479, in load self.loaded_app = import_from_string(self.app) File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\uvicorn\importer.py", line 21, in import_from_string module = importlib.import_module(module_str) File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\importlib_init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 879, in exec_module File "", line 1017, in get_code File "", line 947, in source_to_code File "", line 241, in _call_with_frames_removed File "C:\Code\fastapiBench.\charts.py", line 21 await server.charts.create_dataset( IndentationError: unexpected indent PS C:\Code\fastapiBench> uvicorn --host 0.0.0.0 --port 6969 charts:server INFO: Started server process [2640] 08-19 00:40:32 uvicorn.error INFO Started server process [2640] INFO: Waiting for application startup. 08-19 00:40:32 uvicorn.error INFO Waiting for application startup. ERROR: Traceback (most recent call last): File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\starlette\routing.py", line 635, in lifespan async with self.lifespan_context(app): File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\starlette\routing.py", line 530, in aenter await self._router.startup() File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\starlette\routing.py", line 612, in startup await handler() File "C:\Code\fastapiBench.\charts.py", line 15, in setup await server.charts.create_dataset( AttributeError: 'FastAPI' object has no attribute 'charts'

08-19 00:40:32 uvicorn.error ERROR Traceback (most recent call last): File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\starlette\routing.py", line 635, in lifespan async with self.lifespan_context(app): File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\starlette\routing.py", line 530, in aenter await self._router.startup() File "C:\Users\mac\AppData\Local\Programs\Python\Python310\lib\site-packages\starlette\routing.py", line 612, in startup await handler() File "C:\Code\fastapiBench.\charts.py", line 15, in setup await server.charts.create_dataset( AttributeError: 'FastAPI' object has no attribute 'charts'

ERROR: Application startup failed. Exiting. 08-19 00:40:32 uvicorn.error ERROR Application startup failed. Exiting.`

Using:

uvicorn --host 0.0.0.0 --port 6969 charts:server

As the command to run it as well.

MarkChisholm-dev avatar Aug 18 '22 23:08 MarkChisholm-dev