skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.43k stars 213 forks source link

import Loader fails with permission denied (win7) #283

Closed gisi90 closed 5 years ago

gisi90 commented 5 years ago

(envpy3) C:\>python Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Ana conda, Inc. on win32 Type "help", "copyright", "credits" or "license" for more information.

from skyfield.api import Loader

Traceback (most recent call last): File "", line 1, in File "D:\Programme\miniconda\envs\envpy3\lib\site-packages\skyfield\api.py", l ine 21, in load = Loader('.') File "D:\Programme\miniconda\envs\envpy3\lib\site-packages\skyfield\iokit.py", line 98, in init os.makedirs(self.directory) File "D:\Programme\miniconda\envs\envpy3\lib\os.py", line 221, in makedirs mkdir(name, mode) PermissionError: [WinError 5] Zugriff verweigert: '.'`


(envpy3) C:\>conda list

packages in environment at D:\Programme\miniconda\envs\envpy3: Name Version Build Channel ca-certificates 2019.5.15 1 certifi 2019.6.16 py37_1 jplephem 2.9 pypi_0 pypi numpy 1.17.1 pypi_0 pypi openssl 1.1.1c he774522_1 pip 19.2.2 py37_0 python 3.7.4 h5263a28_0 setuptools 41.0.1 py37_0 sgp4 1.4 pypi_0 pypi skyfield 1.11 pypi_0 pypi sqlite 3.29.0 he774522_0 vc 14.1 h0510ff6_4 vs2015_runtime 14.15.26706 h3a45250_4 wheel 0.33.4 py37_0 wincertstore 0.2 py37_0

(envpy3) C:\>conda info

active environment : envpy3 active env location : D:\Programme\miniconda\envs\envpy3 shell level : 2 user config file : C:\Users\usr.condarc populated config files : C:\Users\usr.condarc conda version : 4.7.10 conda-build version : not installed python version : 3.7.3.final.0 virtual packages : base environment : D:\Programme\miniconda (writable) channel URLs : https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/win-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/msys2/win-64 https://repo.anaconda.com/pkgs/msys2/noarch https://conda.anaconda.org/conda-forge/win-64 https://conda.anaconda.org/conda-forge/noarch https://conda.anaconda.org/default/win-64 https://conda.anaconda.org/default/noarch package cache : D:\Programme\miniconda\pkgs C:\Users\usr.conda\pkgs C:\Users\usr\AppData\Local\conda\conda\pkgs envs directories : D:\Programme\miniconda\envs C:\Users\usr.conda\envs C:\Users\usr\AppData\Local\conda\conda\envs platform : win-64 user-agent : conda/4.7.10 requests/2.22.0 CPython/3.7.3 Windows/7 W indows/6.1.7601 administrator : False netrc file : None offline mode : False

brandon-rhodes commented 5 years ago

That is an interesting error! I looks like makedirs(), which should not do anything if the directory already exists, is getting confused and trying to mkdir() the current directory ..

I have just committed a possible fix. If you'll try this:

pip install https://github.com/skyfielders/python-skyfield/archive/master.zip

then you might be able to get past the error. Let me know what happens!

gisi90 commented 5 years ago

Thank you. I tried and now get a NameError:

from skyfield.api import Loader

Traceback (most recent call last): File "D:\Programme\miniconda\envs\envpy3\lib\site-packages\skyfield\iokit.py", line 98, in init os.makedirs(self.directory) File "D:\Programme\miniconda\envs\envpy3\lib\os.py", line 221, in makedirs mkdir(name, mode) PermissionError: [WinError 5] Zugriff verweigert: '.'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "D:\Programme\miniconda\envs\envpy3\lib\site-packages\skyfield\api.py", l ine 21, in load = Loader('.') File "D:\Programme\miniconda\envs\envpy3\lib\site-packages\skyfield\iokit.py", line 100, in init if e.errno != errno.EEXIST and not os.path.isdir(name): NameError: name 'name' is not defined

brandon-rhodes commented 5 years ago

Drat, I cut-and-pasted that code from the modern Standard Library without changing "name" to the actual variable that holds the directory name in this case.

I've updated the code, please try again!

ReimarBauer commented 5 years ago

Hi @brandon-rhodes we do use your library in our mission support system and @gisi90 tracked it down. https://bitbucket.org/wxmetvis/mss/issues/446/mss-python-crashes-when-started-in-conda

Do you plan a minor bug fix release with this improvement?

gisi90 commented 5 years ago

I've updated the code, please try again!

@brandon-rhodes Great, now it works!

brandon-rhodes commented 5 years ago

@ReimarBauer Yes, I've just released a new version that includes the fix. Enjoy!

ReimarBauer commented 5 years ago

@ReimarBauer Yes, I've just released a new version that includes the fix. Enjoy!

Many Thanks, just pushed a new build for our application.