Skip to content

Using auto-py-to-exe does not work with wetterdienst #843

@Philly-V

Description

@Philly-V

Hello,

I am trying to create an .exe with auto-py-to-exe out of my Python script which uses wetterdienst to access wind and air pressure data from DWD stations around germany. To make it portable without using a virtual environment I tried to convert the script to an .exe. Executing the .exe throws the following error:

  File "main.py", line 10, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "wetterdienst\__init__.py", line 18, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "wetterdienst\api.py", line 8, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "wetterdienst\provider\dwd\mosmix\__init__.py", line 4, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "wetterdienst\provider\dwd\mosmix\api.py", line 15, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "wetterdienst\core\scalar\request.py", line 38, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "wetterdienst\settings.py", line 14, in <module>
  File "wetterdienst\settings.py", line 18, in Settings
  File "environs\__init__.py", line 415, in read_env
  File "dotenv\main.py", line 253, in _walk_to_root
OSError: Starting path not found

Note that line 10 in main.py is:

from wetterdienst.provider.dwd.observation import DwdObservationRequest, DwdObservationDataset, DwdObservationPeriod, \
    DwdObservationResolution, DwdObservationParameter

It seems the error comes from wetterdienst using dotenv to access a path which is nonexistent (probably because the script was converted to an executable). Since I don't have much knowledge about the how dotenv works and ran most of my Python scripts inside the IDE I work with I am not sure if this is a wetterdienst-related problem, or rather a problem with auto-py-to exe or my limited knowledge about it, but maybe you can tell me if it is possible to convert the script to an .exe or if I rather should use a virtual environment to make it portable.

The script is working when executed inside an IDE and on another computer when all required packages are installed with pip (which is what I try to avoid).

**Desktop

  • OS: Windows 10
  • Python-Version 3.10
  • IDE: PyCharm Pro / Community Edition

Thanks in advance
Phillip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions