hii, does anybody now how to declare "from datetim...
# ask-community
l
hii, does anybody now how to declare "from datetime import datetime" as python dependency in docker storage?
Copy code
flow.storage = Docker(registry_url="<http://gcr.io/keller-steering-enabling/flows|gcr.io/keller-steering-enabling/flows>", image_name="billwerk-contracts",
                      python_dependencies=["pandas", "oauthlib ", "requests", "requests_oauthlib", "datetime", "oauth2client", "snowflake", "datetime"], secrets=["GCP_CREDENTIALS"])
above doesn't properly work thanks!
1
s
datetime
is inbuilt, you dont need to declare them in your dependencies because they are part of the language itself. Same with
requests
, remove them from the dependencies completely
l
thanks for your answer! i like to but how to solve that error?:
Copy code
Unexpected error: AttributeError("module 'datetime' has no attribute 'today'")
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/prefect/engine/runner.py", line 48, in inner
    new_state = method(self, state, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/prefect/engine/task_runner.py", line 863, in get_task_run_state
    value = prefect.utilities.executors.run_task_with_timeout(
  File "/usr/local/lib/python3.8/site-packages/prefect/utilities/executors.py", line 298, in run_task_with_timeout
    return task.run(*args, **kwargs)  # type: ignore
  File "<input>", line 136, in modifying_columns
AttributeError: module 'datetime' has no attribute 'today'
1
s
I suspect you are confusing the package datetime with the module datetime. Either of these would work:
Copy code
import datetime
now = datetime.datetime.today()
Or
Copy code
from datetime import datetime
now = datetime.today()
l
mmmh but in a docker storage?
s
It would work the same - the issue here isnt to do with docker storage, the code either has incorrect imports or you have shadowed the datetime name in some way. Perhaps a good way is to change the code so that you dont use the word datetime outside of the imports
Copy code
from datetime import datetime as dt
now = dt.today()
a
requests
is not a built-in library
👍 1
s
Ah yes, my apologies, I was thinking of urllib.request, I need my morning coffee
l
thanks that helped! 🙂
🙏 1