31ank
31ank

Reputation: 31

Script doesn't work on Linux

I made a small discord bot in python. On windows it works perfectly fine, but when I try to run it on raspbain, it says invalid syntax (with the command "python3 Bot.py") Here's the code:

import feedparser
from yaml import load, dump
from json import dumps as jdump
from requests import post
import xml.etree.ElementTree as ET
BASE_URL = "https://discordapp.com/api"


def get_from_summary(summary):
    root = ET.fromstring(f"<element>{summary}</element>")
    d = f"{root[1].text}\n\n{root[2].text}"
    i = root[0].attrib["src"]
    return (d, i)

The syntax is at root = ET.fromstring(f"<element>{summary}</element>") with the "

Upvotes: 1

Views: 69

Answers (1)

jwodder
jwodder

Reputation: 57470

The code uses formatted string literals (the f"<element>{summary}</element>"), which were only introduced in Python 3.6, so you need to use at least that version of Python.

Upvotes: 4

Related Questions