ryanvilbrandt / comic_git

A statically-hosted web comic server core intended to be hosted on github.io. For help getting started, click the Wiki link above!
23 stars 7 forks source link

Error when running delete_autogenerated_files.py #54

Closed shirgoldbird closed 3 years ago

shirgoldbird commented 3 years ago

I get an error when running python src/scripts/delete_autogenerated_files.py:

Traceback (most recent call last):
  File "/Users/shirgoldberg/Documents/lastresortbeta/src/scripts/delete_autogenerated_files.py", line 1, in <module>
    from src.scripts.build_site import delete_output_file_space
ModuleNotFoundError: No module named 'src'

I believe this is because the src folder isn't added to my Python path. I fixed the problem by adding this to the top of delete_autogenerated_files.py:

import sys
sys.path.insert(0, './src')

Not sure if there's a more elegant way!

ryanvilbrandt commented 3 years ago

The working directory for the build_site.py and delete_autogenerated_files.py is assumed to be the root of the repository, since that's where the workflow's PWD starts at.

It'd probably be more elegant to just change everything so that scripts can be run from the scripts directory. This will need a change to the main.yaml file to cd into that directory first.