- Home
- Download
- Documentation
- Upcoming development plans
- Objectmaker® Visualization
- Installation
- Running from source
- GUI Operation
- Command Line Operation
- XBRL Database
- Background
- Architecture, Overview
- Architecture, Model
- Architecture, View
- Architecture, Controller
- API, Python
- API, Web Services
- Plug-in manager
- Package Manager
- Edgar Renderer Installation
- ESMA ESEF Installation
- Participate
- Blog
- Upcoming development plans
- Objectmaker® Visualization
- Installation
- Running from source
- GUI Operation
- Command Line Operation
- XBRL Database
- Background
- Architecture, Overview
- Architecture, Model
- Architecture, View
- Architecture, Controller
- API, Python
- API, Web Services
- Plug-in manager
- Package Manager
- Edgar Renderer Installation
- ESMA ESEF Installation
Hi, I’m new to python.
Try to write code as instructed in the “API” section, created a controller, but then ran into the “_” problem: global name ‘_’ is not defined
import gettext, time, datetime
import xml.dom.minidom, xml.parsers.expat, os
from arelle import (Cntlr, FileSource, ModelManager, ModelXbrl, ModelDocument, XmlUtil, Version)
from arelle import (XbrlConst, XmlUtil, UrlUtil, ModelObject, ValidateFilingText, XmlValidate)
from arelle.ModelValue import (qname)
def main():
ArelleCntlrSample().run()
class ArelleCntlrSample(Cntlr.Cntlr):
def __init__(self):
super().__init__()
def run(self):
self.messages = []
modelManager = ModelManager.initialize(self)
filesource = FileSource.FileSource(“L:\\home\\research\\xbrl\\us-gaap\\samples\\Marriott_20110617\\mar-20110617.xml”)
modelManager.load(filesource, _(“views loading”)) ### not working need to expand
def addToLog(self, message):
if self.messages is not None:
self.messages.append(message + ‘\n’)
else:
print(message) # allows printing on standard out
def showStatus(self, message, clearAfter=None):
pass
if __name__ == “__main__”:
main()
I thnk maybe you also need this line as in CntlrCmdLine.py and CntlrWinMain.py:
gettext.install(“arelle”)
Thanks! It works!
The API Documentation page at http://arelle.readthedocs.org/en/latest/index.html (redirected from http://arelle.rtfd.org) contains only a listing of the modules in the Arelle package. There are no links from any of the items in the module listing to the corresponding module contents.
Configuration or build problem, perhaps?
something broke in the build process, thanks for pointing this out, will get it fixed…
How to get ModelDocument object
I want to get ModelDocument object, so I write the code below. But it returns Error1.
What’s wrong with me?
def __init__(self):
super().__init__()
def run(self):
URL = "http://www.sec.gov/Archives/edgar/data/106040/000010604014000015/wdc-20140627.xml"
filesource = FileSource.FileSource(URL)
modelXbrl = self.modelManager.load(filesource)
K1 = ModelDocument.load(modelXbrl, filesource)
print(K1)
[Error1]
AttributeError: ‘FileSource’ object has no attribute ‘startswith’
[URL]
This URL is XBRL Instance Document of Western Digital 10-K report of June 27, 2014 in SEC filings.
Could it be that the API doc is again only listing module names? Would it be possible to fix that again?
Cheers,
Peter
Yes, we want to add more markup descriptions to the source for the API doc. However the plate of tasks to do is always overflowing.
Is running under IronPython supported?
Not yet, Arelle depends on lxml, which as far as I know isn’t yet ported to iron python nor is there any close equivalent. There are other modules also needed for specific other features but their absence wouldn’t affect core product operation (e.g., formula requires pyparsing, EdgarRenderer requires a large number of libraries not on iron python, etc).
Hi,
I am unable to pip install the arelle package and thus unable to import it. Where do I get the arelle package from to use the Python API.
Please help.
Thanks.
a contributor is re-architecting the install part of arelle to make it pip compatible
I have been trying to use Arelle’s Python API to work on the SEC XBRL files. I can’t exactly understand how to use Python API. Can anyone help me out with this?