arrow-py / arrow

🏹 Better dates & times for Python
https://arrow.readthedocs.io
Apache License 2.0
8.71k stars 673 forks source link

Module "arrow.arrow" has no attribute 'get' #896

Closed MisterL2 closed 3 years ago

MisterL2 commented 3 years ago

Issue Description

I enter the two first lines from the tutorial:

import arrow arrow.get('2013-05-11T21:23:58.970460+07:00')

I get: AttributeError: module 'arrow.arrow' has no attribute 'get'

System Info

jadchaar commented 3 years ago

Hi @MisterL2, is this after creating a new virtual environment and running pip install arrow? I just created a fresh virtual env, installed Arrow, and ran the tutorial without any issue.

MisterL2 commented 3 years ago

No, I installed it about a week ago. I uninstalled an old conda installation and reinstalled the package twice using pip, but no changes. The file used by the IDE links to the correct path and I can see the arrow.py, as well as the init file linking to the api file which contains the function. It sounds like a strange issue that should be on my end, but this is the only package which is causing these issues. I tested several IDEs as well.

jadchaar commented 3 years ago

Are you running WSL or just a regular Windows command prompt? Are you only using Anaconda or are you also using a stock Python install?

MisterL2 commented 3 years ago

Standard CMD, Stock Python install. I removed my Miniconda installation completely in case it was causing interference

jadchaar commented 3 years ago

Peculiar, I cannot seem to reproduce this on my end. @krisfremen @systemcatch any ideas?

krisfremen commented 3 years ago

hmm, peculiar indeed.

>>> import arrow
>>> arrow.get()
<Arrow [2020-12-14T17:32:36.184903+00:00]>
>>> arrow.arrow.get()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'arrow.arrow' has no attribute 'get'

It seems like somehow you're calling arrow.arrow.get() instead of just arrow.get()? maybe some imports are wrong somewhere or you have arrow.py somewhere else in your PATH?

Since this:

>>> from arrow import arrow
>>> arrow.get
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'arrow.arrow' has no attribute 'get'

results in the same error as what you have.

MisterL2 commented 3 years ago

Ahh yes that was the issue... One of my dependencies uses "from arrow import *" in its source code, so as a result it used that instead of my import statement :D Thanks guys ❤️❤️❤️