greppo-io / greppo

Build & deploy geospatial applications quick and easy.
https://greppo.io
Apache License 2.0
386 stars 34 forks source link

AttributeError: module 'ast' has no attribute 'unparse' #16

Closed conor-f closed 2 years ago

conor-f commented 2 years ago

Hey there!

Tried to run the example code from the quickstart locally and got an error thrown:

INFO:     127.0.0.1:42240 - "GET /api HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/conor/.local/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/home/conor/.local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "/home/conor/.local/lib/python3.8/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/conor/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc
  File "/home/conor/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/home/conor/.local/lib/python3.8/site-packages/starlette/middleware/cors.py", line 84, in __call__
    await self.app(scope, receive, send)
  File "/home/conor/.local/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc
  File "/home/conor/.local/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/home/conor/.local/lib/python3.8/site-packages/starlette/routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
  File "/home/conor/.local/lib/python3.8/site-packages/starlette/routing.py", line 259, in handle
    await self.app(scope, receive, send)
  File "/home/conor/.local/lib/python3.8/site-packages/starlette/routing.py", line 61, in app
    response = await func(request)
  File "/home/conor/.local/lib/python3.8/site-packages/greppo/greppo_server.py", line 30, in api_endpoint
    payload, _ = await script_task(script_name=user_script, input_updates=input_updates)
  File "/home/conor/.local/lib/python3.8/site-packages/greppo/user_script_utils.py", line 253, in script_task
    payload = run_script(
  File "/home/conor/.local/lib/python3.8/site-packages/greppo/user_script_utils.py", line 226, in run_script
    logger.debug(ast.unparse(user_code))
AttributeError: module 'ast' has no attribute 'unparse'
ERROR:uvicorn.error:Exception in ASGI application
Traceback (most recent call last):
  File "/home/conor/.local/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/home/conor/.local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "/home/conor/.local/lib/python3.8/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/conor/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc
  File "/home/conor/.local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/home/conor/.local/lib/python3.8/site-packages/starlette/middleware/cors.py", line 84, in __call__
    await self.app(scope, receive, send)
  File "/home/conor/.local/lib/python3.8/site-packages/starlette/exceptions.py", line 82, in __call__
    raise exc
  File "/home/conor/.local/lib/python3.8/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/home/conor/.local/lib/python3.8/site-packages/starlette/routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
  File "/home/conor/.local/lib/python3.8/site-packages/starlette/routing.py", line 259, in handle
    await self.app(scope, receive, send)
  File "/home/conor/.local/lib/python3.8/site-packages/starlette/routing.py", line 61, in app
    response = await func(request)
  File "/home/conor/.local/lib/python3.8/site-packages/greppo/greppo_server.py", line 30, in api_endpoint
    payload, _ = await script_task(script_name=user_script, input_updates=input_updates)
  File "/home/conor/.local/lib/python3.8/site-packages/greppo/user_script_utils.py", line 253, in script_task
    payload = run_script(
  File "/home/conor/.local/lib/python3.8/site-packages/greppo/user_script_utils.py", line 226, in run_script
    logger.debug(ast.unparse(user_code))
AttributeError: module 'ast' has no attribute 'unparse'

Being lazy I didn't install Greppo in a virtualenv or anything, just ran python3 -m pip install greppo.

Environment:

conor-f commented 2 years ago

Fixed by 0.0.24 :)