-
Notifications
You must be signed in to change notification settings - Fork 229
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
SyntaxError: invalid syntax #34
Comments
Are you using a python version lower than 3.6? I do not write much python, but I found out these f-strings were introduced in python 3.6 https://docs.python.org/3/whatsnew/3.6.html#pep-498-formatted-string-literals I modified the code using a string interpolation feature with broader support, and it worked diff --git a/gpt_repository_loader.py b/gpt_repository_loader.py
index 68c663d..63db43b 100755
--- a/gpt_repository_loader.py
+++ b/gpt_repository_loader.py
@@ -27,8 +27,8 @@ def process_repository(repo_path, ignore_list, output_file):
with open(file_path, 'r', errors='ignore') as file:
contents = file.read()
output_file.write("-" * 4 + "\n")
- output_file.write(f"{relative_file_path}\n")
- output_file.write(f"{contents}\n")
+ output_file.write("{}\n".format(relative_file_path))
+ output_file.write("{}\n".format(contents))
if __name__ == "__main__":
if len(sys.argv) < 2:
@@ -51,7 +51,7 @@ if __name__ == "__main__":
if preamble_file:
with open(preamble_file, 'r') as pf:
preamble_text = pf.read()
- output_file.write(f"{preamble_text}\n")
+ output_file.write("{}\n".format(preamble_text))
else:
output_file.write("The following text is a Git repository with code. The structure of the text are sections that begin with ----, followed by a single line containing the file path and file name, followed by a variable amount of lines containing the file contents. The text representing the Git repository ends when the symbols --END-- are encounted. Any further text beyond --END-- are meant to be interpreted as instructions using the aforementioned Git repository as context.\n")
process_repository(repo_path, ignore_list, output_file) |
Use python version 3.8 or higher and it will work. If you're copying the file manually make sure it's copied correctly as there are long lines that a basic text editor like nano might not handle well. |
I followed the instruction but getting the above error when trying to run the command on my repository.
The text was updated successfully, but these errors were encountered: