chris1610 / pbpython

Code, Notebooks and Examples from Practical Business Python
https://pbpython.com
BSD 3-Clause "New" or "Revised" License
1.99k stars 987 forks source link

Syntax error on any command using #20

Closed dnilasor closed 4 years ago

dnilasor commented 4 years ago

I'm getting this error when I try to convert a file, or even view the man page of the md_to_email script. Dependencies installed. Is this code compatible with python3?

*****-MacBook-Pro:md_to_email ******$ python email_gen.py issue2.md File "email_gen.py", line 45 out_file = Path.cwd() / f'{in_doc.stem}_email.html' ^ SyntaxError: invalid syntax

chris1610 commented 4 years ago

Which version of python are you using? I am using f strings in that line so you need at least python 3.6

Otherwise you could change that line to use .format() to name the file name.

Does that help?

kevbot123 commented 4 years ago

Just ran into this issue myself, realized it was because I didn't call up the proper version of python.

If you're on macOS, you'll have to use python3 instead of just python when running the script in terminal. Like this:

python3 email_gen.py sample_doc.md

chris1610 commented 4 years ago

Thanks for confirming. I am going to close this out.