Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix relative paths in python script #45

Merged
merged 7 commits into from
Apr 30, 2024

Conversation

ericwu17
Copy link
Contributor

This pull request fixes the relative path in the fix-chars.py python script, which should allow the python script to be ran by the following command

python3 data-raw/fix-chars.py

@wjakethompson
Copy link
Owner

Thanks! I'm able to run the script now, but I'm getting another error in the process of running:

python3 data-raw/fix-chars.py
Traceback (most recent call last):
  File "/Users/jakethompson/Documents/GIT/packages/taylor/data-raw/fix-chars.py", line 38, in <module>
    replaceChars(path)
  File "/Users/jakethompson/Documents/GIT/packages/taylor/data-raw/fix-chars.py", line 8, in replaceChars
    lyrics = f.read()
             ^^^^^^^^
  File "<frozen codecs>", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 3131: invalid start byte

The script is partially working, as I can see that a couple of the lyrics txt files have been changed. But I don't think all of them, as "The Black Dog" has not been changed, and that was the original example in #44. Any thoughts on what is causing the script to fail?

@ericwu17
Copy link
Contributor Author

Hmmm, do you have any binary files in the folders that contain the text files for the lyrics?

The python script will start in the data-raw/lyrics directory, and then it will go through each folder assuming that the folder contains text files of an album. If there is a folder that contains an additional binary file(s), or additional folders other than the folders with album data, then I would expect to see the error.

I made a new commit that changes the python script to only act on .txt files. Hopefully if you run the script now it should ignore binary files and only operate on the .txt files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't notice when committing, but it looks like I also converted some indentation from spaces to tabs.

Copy link

codecov bot commented Apr 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (c18765b) to head (871d7bb).
Report is 47 commits behind head on main.

❗ Current head 871d7bb differs from pull request most recent head 968c42f. Consider uploading reports for the commit 968c42f to get more accurate results

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #45   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines          237       240    +3     
=========================================
+ Hits           237       240    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wjakethompson
Copy link
Owner

That worked! I was able to run the script and update all of the lyrics. I also added a step to my process when adding a new album to run the script so that hopefully this issue doesn't pop up again in the future. Thanks!

Closes #44.

@wjakethompson wjakethompson linked an issue Apr 30, 2024 that may be closed by this pull request
@wjakethompson wjakethompson merged commit c8a2f6a into wjakethompson:main Apr 30, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Strange characters lyrics
2 participants