researchgpt icon indicating copy to clipboard operation
researchgpt copied to clipboard

Syntax error when self-hosting

Open TobiasFutureLabs opened this issue 2 years ago • 2 comments

I get the following error when trying to run the .py script after copying the repo on my server:

:~/researchgpt$ python main-local.py
  File "main-local.py", line 20
    print(f"Total number of pages: {number_of_pages}")


SyntaxError: invalid syntax

TobiasFutureLabs avatar Feb 16 '23 11:02 TobiasFutureLabs

The error message indicates a SyntaxError on line 20 of the main-local.py file, specifically in the print statement. The use of an f-string is causing the error.

If you are using a version of Python earlier than 3.6, f-strings are not supported. In this case, you can use the format() method instead.

For example, replace line 20 with:

print("Total number of pages: {}".format(number_of_pages))

If you are using Python 3.6 or later, you can use the f-string by making sure that the code is being executed with the correct version of Python.

You can verify the version of Python being used by running the command:

python --version

Make sure it is version 3.6 or later. If not, you may need to install a newer version of Python or update your environment to use the correct version.

If you are sure that the correct version of Python is being used, make sure that the syntax of the f-string is correct. In this case, you can replace line 20 with:

print(f"Total number of pages: {number_of_pages}")

MusaAqeel avatar Feb 16 '23 14:02 MusaAqeel

@TobiasFutureLabs Hi, sorry this issue should have been fixed in a commit a couple of weeks ago. You can run git pull to update your repo with the latest changes.

@MusaAqeel's solution should have worked too. Let me know if you have anymore issues :)

mukulpatnaik avatar Mar 07 '23 02:03 mukulpatnaik