vmware-archive / pop

Plugin Oriented Programming
https://pop.readthedocs.io
Apache License 2.0
42 stars 18 forks source link

relative import paths don't work #35

Closed smokeytheblair closed 5 years ago

smokeytheblair commented 5 years ago

Expected from .deck_of_cards import DeckOfCards should import from deck_of_cards.py in the same path

Actual has to use from poppy.poker.deck_of_cards import DeckOfCards for import to work

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pop/loader.py", line 122, in python
    return sfl.load_module()
  File "<frozen importlib._bootstrap_external>", line 407, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 907, in load_module
  File "<frozen importlib._bootstrap_external>", line 732, in load_module
  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 696, in _load
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/jblair/code/pop-poker/poppy/poker/init.py", line 2, in <module>
    from .poker_dealer import PokerDealer
ModuleNotFoundError: No module named "['poppy" 
smokeytheblair commented 5 years ago

pop-poker.tar.gz

dhiltonp commented 5 years ago

To replicate from that tarball, change poppy/poker/init.py to use relative imports, then python3 run.py.

dhiltonp commented 5 years ago

This should work in 99% of cases now.