I try to run a systemd service that is executing a python script.
For some reason I get this error:
line 39: syntax error near unexpected token `('
line 39: `with open(ad_description_path, 'r') as file:'
Here’s the code that matters in the error message:
systemd.services."obei-automation" = {
wantedBy = [ "default.target" ];
partOf = [ "default.target" ];
script = ''
#!/run/current-system/sw/bin/python
# coding: utf-8
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from time import sleep
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
import os
...
ad_description_path = '/home/usr/Documents/ad_description.txt'
...
with open(ad_description_path, 'r') as file:
data = file.read()
data = data.split('##')
Would be very much appreciated to here some suggestions!