pdf documentation for libraries

  • learnetk

    learnetk - 2016-11-25

    Hallo Everyone

    I have been trying to script my documentation and get a pdf output for the same.
    using Sphix and rst2pdf. The try the command

    sphinx-build -b pdf C:\Project\SysFile\Source C:\Project\SysFile\Build

    and i get errors

    libraries [ERROR] pdfbuilder.py:130 too many values to unpack
    ValueError: too many values to unpack
    build succeeded.

    has anyone been successful using this..!!

    I am using Codesys V3.6.
    Thanks and warm regards

  • mkeller

    mkeller - 2016-11-25

    Hi learnetk.

    From the subject I think you want to generate documentation for a library but from the text I get the impression you want to generate documentation for your scripts. Which is the correct one?

    If you want to generate documentation for a library did you use CODESYS Libdoc? See "Library Development Summary" and "Script your Documentation" in the online help.


  • learnetk

    learnetk - 2016-11-28

    Hi Martin,

    I am using Codesys V3.5 SP6 Patch 3

    Firstly, i installed Python 2.7.12 along with the packages Sphinx and rst2pdf.

    Then started with the Libdoc scripts (as in Script your Documentation) and followed the steps as under :

    Step 1 : Libdoc export c:\project\lib\sysfile.library c:\project\lib\sysfile.json
    Step 2 : Libdoc generate c:\project\lib\sysfile.json c:\project\lib\Frame
    Step 3 : Libdoc merge c:\project\lib\sysfile.json c:\project\lib\Frame c:\project\lib\Source

    Step 4 : copy the files 'conf.py' to the Source folder, remove the html part and reference to libdoc_builder
    Step 5 : Add in Conf.py the following changes
    extensions = ['sphinx.ext.todo', 'rst2pdf.pdfbuilder']
    pdf_documents = [('index', u'rst2pdf', u'SysFileDoc', u'Test'),]

    Step 6 : sphinx-build -b pdf c:\project\lib\source c:\project\lib\build

    sphinx-build -b pdf c:\project\lib\source c:\project\lib\build
    Running Sphinx v1.4.9
    loading pickled environment... failed: source directory has changed
    building [mo]: targets for 0 po files that are out of date
    building [pdf]: targets for 27 source files that are out of date
    updating environment: 27 added, 0 changed, 0 removed
    reading sources... [100%] libraries
    looking for now-outdated files... none found
    pickling environment... done
    checking consistency... done
    processing rst2pdf... index ACCESS_MODE SYS_FILETIME SYS_FILE_STATUS SysFileClose SysFileCopy SysFileDelete SysFileDeleteByHandle SysFileEOF SysFileFlush SysFileGetName SysFileGetName2 SysFileGetPath
    SysFileGetPos SysFileGetSize SysFileGetSizeByHandle SysFileGetStatus SysFileGetStatus2 SysFileGetTime SysFileOpen SysFileRead SysFileRename SysFileSetPos SysFileTruncate SysFileWrite info libraries [E
    pdfbuilder.py:130 too many values to unpack
    Traceback (most recent call last):
    File "c:\python27\lib\site-packages\rst2pdf\pdfbuilder.py", line 122, in write
    appendices=opts.get('pdf_appendices', self.config.pdf_appendices) or [])
    File "c:\python27\lib\site-packages\rst2pdf\pdfbuilder.py", line 209, in assemble_doctree
    File "c:\python27\lib\site-packages\rst2pdf\pdfbuilder.py", line 385, in genindex_nodes
    for entryname, (links, subitems) in entries:
    ValueError: too many values to unpack
    build succeeded.

    Thanks and warm regards

  • mkeller

    mkeller - 2016-11-28

    Hi learnetk.

    Why didn't you use our tool to generate the PDF? For that you have to transform the source to LaTeX which can be converted to PDF. See "PDF Output Format" in the online help.

    Maybe you should use a newer version of CODESYS to create your documentation because there were some bugs in the early versions of the tool.


  • learnetk

    learnetk - 2016-11-28

    Hi Martin,
    Thank you ..!!
    That works, as described in the section "PDF Output Format". But how could i add multiple .tex files to make a single document.

    Thanks and warm regards.

  • esskaey

    esskaey - 2019-03-11

    Hello Martin,

    I have gotten to the step where, the source and frame are merged and the libdoc installed in a virtualenv. When I try to run the sphinx command to generate a pdf, I get the error

    "Could not import extension sphinx.ext.codesys ( no module named codesys)"

    What am I missing here. Also if I try to run pdflatex on the lib.tex, I get a missing cmap.sty error and I am not able to proceed further.

    Thanks in advance

    Best Regards


  • phongpham

    phongpham - 2019-09-04

    I'm running into the same error
    Could not import extension sphinx.ext.codesys (exception: No module named codesys)
    could anyone give us a hint?

    Thank you!


Log in to post a comment.