Forums

class Abstract(metaclass=abc.ABCMeta): Syntax Error

Please help with Syntax Error on https://www.pythonanywhere.com/user/pluralschool/files/ for the following code, although the code executes with the correct output:

import abc

class Plugin(metaclass=abc.ABCMeta): # Syntax Error
    @abc.abstractmethod
    def load(self, obj):
        """Retrieve data from the source and return an object"""
        return

Are you talking about a syntax error being shown in the editor that you get to from the "Files" tab? That's a problem on our side; our editor doesn't know which version of Python you're using, and so it assumes that it's Python 2. That syntax is perfectly valid Python 3, but not Python 2.

If the code executes with the correct output, you can ignore the error. We're looking into ways to make our editor support both versions' syntax.

Fine. Thank you for the reply.