pythonanacondaxbrlarelle

Syntax error when trying to import Cntlr from arelle module


My goal is to use Arelle (open-source platform for XBRL community) to parse XBRL docs from the SEC.

I am following instructions found here.

I successfully git cloned Arelle's code into the Lib directory of Anaconda. However, when I try from arelle import Cntlr I get the following syntax error.

File "arelle\Cntlr.py", line 573 print(logEntry, file=file) ^ SyntaxError: invalid syntax

I am using Python 2.7.12. in Anaconda.

Any feedback is appreciated and I can provide further information upon request.


Solution

  • The instructions you found are rather old (from 2014), and appear to be outdated.

    I was able to install the package with the following steps:

    # This is needed because the 3to2 library can't be installed as an egg; if
    # you don't install it with `pip` first the installation of Arelle will fail.
    $ pip install 3to2
    # Install Arelle directly from GitHub, this will take a while
    $ pip install git+https://github.com/Arelle/Arelle
    

    With 3to2 installed, the installation script setup.py proceeds to translate the Arelle sourcecode back to a Python 2 compatible form. Translation takes several minutes, be patient.