AineeJames / ChatGPTerminator

GPTerminator provides a convenient way to interact with OpenAI's chat completion and image generation API's using your command line interface.
MIT License
230 stars 16 forks source link

Installing via PyPi does not create and initialise config.ini #8

Closed jamesinc closed 1 year ago

jamesinc commented 1 year ago

I just installed via PyPi (pip install gpterminator) and was met with an exception.

$ gpterm                                                                                    
Traceback (most recent call last):                                                          
  File "/Users/james/.pyenv/versions/3.10.9/bin/gpterm", line 8, in <module>                
    sys.exit(main())                                                                        
  File "/Users/james/.pyenv/versions/3.10.9/lib/python3.10/site-packages/gpterminator/__main__.py", line 5, in main
    app.run()                                                                               
  File "/Users/james/.pyenv/versions/3.10.9/lib/python3.10/site-packages/gpterminator/GPTerminator.py", line 374, in run
    self.loadConfig()                                                                       
  File "/Users/james/.pyenv/versions/3.10.9/lib/python3.10/site-packages/gpterminator/GPTerminator.py", line 62, in loadConfig
    self.config_selected = config["SELECTED_CONFIG"]["ConfigName"]                          
  File "/Users/james/.pyenv/versions/3.10.9/lib/python3.10/configparser.py", line 964, in __getitem__
    raise KeyError(key)                                                                     
KeyError: 'SELECTED_CONFIG'   

Looking at setup.py, I figured out it was needing ~/.config/gpterminator/config.ini and ~/.config/gpterminator/saves and created those files and populated them according to setup.py, which fixed the issue.

Python: 3.10.9 (NB: I'm using pyenv with 3.10 as my global Python)

AineeJames commented 1 year ago

Hmmm, that is odd. Let me look into this. I'm new to packaging Python projects, so I am unsure how to initialize config directories when installing with pypi.

AineeJames commented 1 year ago

I am now realizing that when you install from PyPi, the setup.Py is not called and therefore not creating the necessary directories.

AineeJames commented 1 year ago

I have made a new release to pypi (v0.1.6) that now handles the config file and directory creation from within the script, it should work now without having to manually create the files/dirs!