Ошибка автоматического создания документации Sphinx python

Я хотел бы сделать документацию для API под названием Ulyxes PyAPI. Я уже запустил его, но процесс автогенерации не работает. Когда я нажимаю ссылку «Автоматически сгенерированный документ» на моей странице index.html, меня перенаправляют на пустую страницу, на которой нет информации о моем классе и функциях класса
На самом деле, у меня есть более 10 файлов Python в моем API, каждый файл состоит из класс, который моделирует измерительные датчики (тахеометры роботов, GPS и т. д.). В этом вопросе я пишу только небольшую часть, чтобы моя проблема была понятна.

Я считаю, что либо code.rst, либо leicameasureunit.py неверны...

Файлы *.py и *.srt находятся в том же каталоге, который является моим рабочим каталогом. Я использую операционную систему Windows 7.

Большое спасибо!

...\UlyxesPyApiDoc:

Файлы следующие:

index.srt:

.. Ulyxes PyAPI  documentation master file, created by
   sphinx-quickstart on Mon Oct 21 20:53:48 2013.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to Ulyxes PyAPI 's documentation!
=========================================

 Ulyxes is an open source project to drive robotic total stations (RTS) and other
 sensors and publish observation results on web based maps (GPL 2).

 Requirmenets:

 Contents:

 .. toctree::
     :maxdepth: 2

     project
     tutorial
     code

  Indices and tables
  ==================

  * :ref:`genindex`
  * :ref:`modindex`
  * :ref:`search`

код.первый:

Auto Generated Documentation
============================

.. autoclass:: leicameasureunit
    :members:

проект.срт:

Project Summary
===============

Goals Achieved
--------------

Goal 1 to create a framework to drive robotic total stations from a computer and      publish data on the Internet

Goal 2 we want to create a framework not a ready to use application

Goal 3 the project is based on several other open source projects

учебник.srt:

Tutorial for driving RTSs
=========================

This is a short description about how to drive RTSs via serial port from PC/laptop

leicameasureunit.py:`

"""
Created on 29 July 2012
@author: Dani Moka
"""

from measureunit import *
from angle import *
import re

class LeicaMeasureUnit(MeasureUnit):
"""
This class models Leica robotic totals stations
""" 
def __init__(self, name = 'Leica generic', type = 'TPS'):
    # call super class init
    super(LeicaMeasureUnit, self).__init__(name, type)

def MoveMsg(self, hz, v, units='RAD', atr=0):
    """
    This function make instruments moving.

    :arguments:
      hz
       Direction 1
      units
       uints in default RAD
    """
    hz_rad = Angle(hz, units).GetAngle('RAD')
    v_rad = Angle(v, units).GetAngle('RAD')
    return '%%R1Q,9027:%f,%f,0,%d,0' % (hz_rad, v_rad, atr)

def SetATRMsg(self, atr):
    """
    This function used for setting Automatic Target Recognition

    :arguments:
      atr
       1 - on / 2 - off
      units
       1 - on / 2 - off
    """
    return '%%R1Q,9018:%d' % (atr)

def GetATRMsg(self):
    """
    This function used for getting the  status of Automatic Target Recognition
    """
    return '%R1Q,9019:'

`


person mirind4    schedule 21.10.2013    source источник


Ответы (1)


В code.rst говорится

.. autoclass:: leicameasureunit

Это не работает, так как нет класса с таким именем. Чтобы задокументировать leicameasureunit модуль, используйте

.. automodule:: leicameasureunit

Модуль содержит класс с именем LeicaMeasureUnit, поэтому вы можете использовать

.. autoclass:: leicameasureunit.LeicaMeasureUnit

документировать только этот класс.

person mzjn    schedule 26.10.2013
comment
спасибо вам! теперь я получил следующую ошибку/предупреждение: D:\autodidakta\Monitoring System\New\Tries\UlyxesPyApiDoc\code.rst:4: ПРЕДУПРЕЖДЕНИЕ: utodoc не может импортировать/найти модуль 'leicameasureunit', он сообщил об ошибке: Нет модуля e с именем 'leicameasureunit', проверьте правописание и sys.path ------ leicameasureunit.py находится в том же каталоге, что и файл make... :\ - person mirind4; 26.10.2013
comment
Будет ли работать, если вы добавите import sys и sys.path.insert(1, os.path.abspath('.')) в conf.py? - person mzjn; 26.10.2013