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

Update liberbatch.py #9

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions liberbatch.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import os, meichecker, liberupdatev5
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you using a code linter? This is not PEP8 compliant (https://peps.python.org/pep-0008/#imports)

PATH = "your path here"
Copy link
Contributor

Choose a reason for hiding this comment

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

If you want the user to go in and change the path, that should be documented. I think a command line argument would be generally preferable.


directory = os.fsencode("C:\\Users\\cole_\\Downloads\\liberUsualis - Copy\\liber")
directory = os.fsencode(PATH)
err=""

i = 0 #for debugging
for mefile in os.listdir(directory):
filename = os.fsdecode(mefile)
if filename.endswith("corr.mei"):
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like a requirement (that the files end with corr.mei)! This should be documented somwhere.

liberupdate.main(filename)
liberupdatev5.main(filename)
print(filename +" has been updated")
err= err+ (meichecker.main(filename[:-4]+"NEW2.mei")+"\n")
Copy link
Contributor

Choose a reason for hiding this comment

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

For something like this, a linter will generally prefer an f-string.

Suggested change
err= err+ (meichecker.main(filename[:-4]+"NEW2.mei")+"\n")
err += f"{meichecker.main(filename[:-4]}NEW2.mei)\n")

# print(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this?

print(filename +" has been checked")
# i+=1

#if i>=100:
# break
print(err)