woodenzen / zkdb

Zettelkasten Stats Dashboard
4 stars 2 forks source link

ModuleNotFoundError: No module named 'Foundation' #6

Closed woodenzen closed 3 years ago

woodenzen commented 3 years ago

My embarrassment is in full bloom. The script work great last night. This morning I wake to a pull request and implement it no problem. Then I go and give both zkdashboard.py and standalone archive_path..py a try and lo-and-behold I get the message ModuleNotFoundError: No module named 'Foundation'.

For the life of me, I can't remember anything I might have done. It worked great yesterday and last night.

All the tips on the internet on how to resolve this are just pip install Foundations. I've uninstalled and reinstalled and checked the directory to be sure it is there. I use virtual environments and it too is set up with foundations. I get this same behavior when I run them outside the virtual environment I've been using all along. I checked with pip freeze.

(venv) ➜  zkdb git:(master) ✗ pip freeze
DateTime==4.3
Django==1.10.8
django-classy-tags==0.8.0
django-sekizai==0.10.0
➜ foundation==0.1.0a0.dev1
pathlib==1.0.1
pyperclip==1.8.2
python-dateutil==2.8.2
pytz==2021.3
six==1.16.0
zope.interface==5.4.0
(venv) ➜  zkdb git:(master) ✗ python zkdashboard.py 
Traceback (most recent call last):
  File "/Users/will/Git/zkdb/zkdashboard.py", line 11, in <module>
    from archive_path import TheArchive
  File "/Users/will/Git/zkdb/archive_path.py", line 8, in <module>
    from Foundation import NSData
ModuleNotFoundError: No module named 'Foundation'

Any tips on how I might resolve this? It must have been something stupid this beginner did. Having things working then suddenly not and being frustrated by the help on the internet is doubly frustrating. Having to admit it triples the pain.

woodenzen commented 3 years ago

Resolved with @pryley's suggestion I use a simpler class for the archive_path.py.

pryley commented 3 years ago

Python 2 which comes with macOS includes the Foundation module. If you are using Homebrew to install Python 3, you may have needed to pip install pyobjc (Not the foundation@0.1.0a0.dev1 module).

Anyway, it's no longer needed now.