'Circular import error only after turning .py into .exe

I am working on building a GUI interface that can be ran as an executable. After using auto-py-to-exe to turn the file into an exe, I try to run it and I receive an error.

Traceback (most recent call last):
File "CarrieGUI.py", line 3, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "requests.py", line 8, in <module>
AttributeError: partially initialized module 'requests' has no attribute 'get' (most likely due to a circular import)

I have seen other posts suggesting that the file name is what causes this error but I do not receive this error when running it from vscode. Plus the file name is CarrieGUI.py which should not be something referred to in the requests library. Any ideas on why I am only running into this error after converting the file to an exe?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source