Reputation: 11
I downloaded the kivymd and kivy module and I'm using it in a python application. When I run my code this error appears:
Traceback (most recent call last):
File "c:/Users/SA/Desktop/mhtiq-test/AI_PROCTOR-FYP-/main.py", line 10, in <module>
from kivymd.app import MDApp
File "C:\Users\SA\AppData\Local\Programs\Python\Python35\lib\site-packages\kivymd\__init__.py", line 30
fonts_path = os.path.join(path, f"fonts{os.sep}")
^
SyntaxError: invalid syntax
Can anyone tell how I can fix this?
Upvotes: 0
Views: 146
Reputation: 530853
f-strings were added in Python 3.6; you are using Python 3.5. You need to upgrade your Python installation to use this code.
To make it compatible with Python 3.5, use the format
method:
fonts_path = os.path.join(path, "fonts{}".format(os.sep))
Note that os.path.join
appears to use /
specifically, not os.sep
, so doing this could produce somewhat of a hybrid path. Otherwise, you might also consider
fonts_path = os.path.join(path, "fonts", "")
to let os.path.join
produce the trailing separator itself.
The pathlib
module may also be an option, as it was introduced in Python 3.4.
Upvotes: 1