jcouto / wfield

Tools to process widefield data
GNU General Public License v3.0
13 stars 14 forks source link

FileNotFoundError on import #7

Closed k1o0 closed 2 years ago

k1o0 commented 2 years ago

I get the following error when importing from wfield.io from within PyCharm:

Traceback (most recent call last):
  File "C:\Users\User\Anaconda3\envs\iblenv\lib\site-packages\IPython\core\interactiveshell.py", line 3441, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-38-beee8d657014>", line 1, in <module>
    from wfield.io import _parse_binary_fname
  File "C:\Program Files\JetBrains\PyCharm 2021.2.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "C:\Users\User\Anaconda3\envs\iblenv\lib\site-packages\wfield\__init__.py", line 17, in <module>
    from .utils import *
  File "C:\Program Files\JetBrains\PyCharm 2021.2.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "C:\Users\User\Anaconda3\envs\iblenv\lib\site-packages\wfield\utils.py", line 46, in <module>
    reference_files = [pjoin(refpath,r) for r in os.listdir(refpath)]
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\User\\Anaconda3\\envs\\iblenv\\share\\wfield\\references'

I installed wfield via pip from within an Anaconda env (Python 3.9.5).

jcouto commented 2 years ago

Hi, sorry for the latency.

It seems that, for some reason, the pip installer did not copy the reference files to the share folder. I'll look into it, thanks for reporting!

In the meantime could you copy the files in wfield/references to C:\Users\User\.wfield ? These should have been copied by pip but that did not work. The files are used by the Allen reference.

Thanks again!

mayofaulkner commented 2 years ago

Hello, I was wondering if there was any update on a fix for this issue?

Thanks a lot!

jcouto commented 2 years ago

Hi, thanks for the issue. I made that it gets the reference files from github when these are not found.

I updated both the dev and main branches as well as pip (version 0.2.3).

Please let me know if this works! Thanks!

mayofaulkner commented 2 years ago

That works now! Thanks a lot