Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

Trouble launching under windows - import errors #414

Open
PySimpleGUI opened this issue Dec 6, 2019 · 8 comments
Open

Trouble launching under windows - import errors #414

PySimpleGUI opened this issue Dec 6, 2019 · 8 comments

Comments

@PySimpleGUI
Copy link

Environment details

  • kcauto version "v8.0.0-rc1"

  • Operating system - Windows 10

Issue variability

Every time

Issue

Having trouble running both on the command line and launching via PyCharm.

I'm sure I've not done something right with the setup. Do I need to modify my paths?

Log

C:\Python\PycharmProjects\GooeyGUI\User Submitted Programs\kcauto-390-2019-fall-event\kcauto>python kcauto.py
Traceback (most recent call last):
  File "kcauto.py", line 1, in <module>
    import combat.combat_core as com
  File "C:\Python\PycharmProjects\GooeyGUI\User Submitted Programs\kcauto-390-2019-fall-event\kcauto\combat\combat_core.py", line 4, in <module>
    import api.api_core as api
  File "C:\Python\PycharmProjects\GooeyGUI\User Submitted Programs\kcauto-390-2019-fall-event\kcauto\api\api_core.py", line 5, in <module>
    import combat.combat_core as com
AttributeError: module 'combat' has no attribute 'combat_core'
@perryhuynh
Copy link
Owner

perryhuynh commented Dec 6, 2019

You're in the wrong directory, you should be one directory up in the root level of the project at
C:\Python\PycharmProjects\GooeyGUI\User Submitted Programs\kcauto-390-2019-fall-event

and launching with the just the command python kcauto

@PySimpleGUI
Copy link
Author

I tried going up and level and also tried it in another folder / drive to be sure nothing in that tree was in the way.

 Directory of E:\DownloadsE\kcauto-390-2019-fall-event

12/05/2019  03:42 AM    <DIR>          .
12/05/2019  03:42 AM    <DIR>          ..
12/05/2019  03:42 AM    <DIR>          .github
12/05/2019  03:42 AM               535 .gitignore
12/05/2019  03:42 AM    <DIR>          assets
12/05/2019  03:42 AM            19,130 CHANGELOG.md
12/05/2019  03:42 AM    <DIR>          configs
12/05/2019  03:42 AM               852 CONTRIBUTING.md
12/05/2019  03:42 AM    <DIR>          data
12/06/2019  12:00 PM    <DIR>          kcauto
12/05/2019  03:42 AM            35,149 LICENSE
12/05/2019  03:42 AM               296 Pipfile
12/05/2019  03:42 AM            19,794 Pipfile.lock
12/05/2019  03:42 AM             4,919 README.md
12/05/2019  03:42 AM               128 requirements.txt
               8 File(s)         80,803 bytes
               7 Dir(s)   8,584,327,168 bytes free

E:\DownloadsE\kcauto-390-2019-fall-event>python kcauto
Traceback (most recent call last):
  File "C:\Python\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Python\Anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "kcauto\__main__.py", line 1, in <module>
    import args.args_core as arg
ModuleNotFoundError: No module named 'args.args_core'; 'args' is not a package

E:\DownloadsE\kcauto-390-2019-fall-event>

@mrmin123
Copy link
Collaborator

mrmin123 commented Dec 6, 2019

@PySimpleGUI I don't use Anaconda but a quick search leads me to this, which seems to imply that you need to add the directory to PYTHONPATH. On the other hand, I also found this, which says to not modify PYTHONPATH and instead install the package in the Anaconda directory. Could you give either of these a try and give it another go?

@PySimpleGUI
Copy link
Author

I added the project's folder as well as the next level down to PYTHONPATH and I still get errors due to imports.

It's OK. I'm not a user so it's not important. I just wanted to see what your GUI looked like.

This is the first Python program I've run into with these kind of import problems. I would think executing from the project's home folder would be enough as that's what I normally do for imports that are local files.

I'm not actively using Conda or any virtual environment. It's straight python best I can tell.

You can close this one as it seems to work for everyone else.

@mrmin123
Copy link
Collaborator

mrmin123 commented Dec 6, 2019

I think your python command is pointing to an Anaconda3 install of python, judging by your stacktrace:

Traceback (most recent call last):
  File "C:\Python\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Python\Anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)

I'd try again with a non-Anaconda version of python 3.7, if you have one handy.

@mrmin123
Copy link
Collaborator

mrmin123 commented Dec 6, 2019

Thanks for pySimpleGui, btw. I definitely have some feedback/feature requests which I'll probably post on the subreddit or github.

@PySimpleGUI
Copy link
Author

Glad you like using PySimpleGUI.

Please submit new feature requests only on the GitHub.

@PySimpleGUI
Copy link
Author

Got it working with 3.7.5. Fresh install + install of matplotlib got it up and running.

I went to the project's folder and ran python kcauto

You'll definitely be interested in the last couple of PySimpleGUI releases as the ttk styles are finally working correctly. You can also change the ttk theme for the window now and the elements all style themselves correctly. This is particularly good for your app due to the number of combo boxes you have as well as tabs.

How would I go about launching the program from PyCharm? I've got 3.7 configured correctly, but trying to run any of the .py files in the home folder exit with a return code and no other info. Maybe it's not possible with the way I've got things setup. I don't use a virtual environment within PyCharm.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants