lmbringas / packtpub-downloader

Script to download all your books from PacktPub inspired by https://github.com/ozzieperez/packtpub-library-downloader
265 stars 83 forks source link

line 41 invalid syntax, what did I miss ? #21

Open teddymills opened 4 years ago

teddymills commented 4 years ago

root@ubu1904:/root/packtpub/packtpub-downloader# python main.py -e username@gmail.com -p somepassword -d /root/packtpub/books/ -b pdf

File "main.py", line 41 print(f 'You have {str(r.json()["count"])} books')

SyntaxError: invalid syntax

BurnhamG commented 4 years ago

Hi there, is there a space between the "f" and the single quote in your file? If so, that is likely the issue.

teddymills commented 4 years ago

There was no space from the original git clone of course.

I am not a programmer but I put a space there because I thought it was a syntax or typo. Same error.

Teddy

On 10/21/19 9:05 PM, BurnhamG wrote:

Hi there, is there a space between the "f" and the single quote in your file? If so, that is likely the issue.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lmbringas/packtpub-downloader/issues/21?email_source=notifications&email_token=ABRACKTV5FOFM3RPGG74ETLQPZGW5A5CNFSM4JCXCN6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEB4IJPI#issuecomment-544769213, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRACKTYILAW4W2YYCJMQMDQPZGW5ANCNFSM4JCXCN6A.

BurnhamG commented 4 years ago

Ah, okay. What character is the ^ under the print statement pointing at?

BurnhamG commented 4 years ago

I'm sorry, I also realized that you may have the wrong version of python. What is the output if you type python --version on the command line?

teddymills commented 4 years ago

Sorry about that.

It was on a server that was offline.

It is Python 2.7.16

On 10/23/19 9:21 AM, BurnhamG wrote:

I'm sorry, I also realized that you may have the wrong version of python. What is the output if you type |python --version| on the command line?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lmbringas/packtpub-downloader/issues/21?email_source=notifications&email_token=ABRACKWKS5TVKKHJIO5CJ2DQQBFV5A5CNFSM4JCXCN6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECBMGJI#issuecomment-545440549, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRACKQELM66FOIEBHASGNLQQBFV5ANCNFSM4JCXCN6A.

BurnhamG commented 4 years ago

Not a problem. The script was written for Python 3.6 and later, so that's why you're seeing the SyntaxError. I'd try typing python3 --version on the server to see if Python 3 is available. If so, and the version is 3.6 or later, you can just use python3 instead of python to run the script.