Sphinx python自动生成的文档失败

问题描述 投票:1回答:1

我想为名为Ulyxes PyAPI的API编写文档。我已经开始了,但是自动生成过程无法正常工作。当我单击index.html页面中的“自动生成的文档”链接时,将被引为空白页面,其中没有有关我的课程和课程功能的信息实际上,我的API中有一个10多个python文件,每个文件都包含一个用于对测量传感器(机器人全站仪,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`

code.rst:

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

.. autoclass:: leicameasureunit
    :members:

project.srt:

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

tutorial.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:'

`

python python-sphinx autodoc
1个回答
1
投票

在code.rst中,它说

.. autoclass:: leicameasureunit

它不起作用,因为没有该名称的class。为了记录leicameasureunit module,请使用

.. automodule:: leicameasureunit

该模块包含一个名为LeicaMeasureUnit的类,因此您可以使用

.. autoclass:: leicameasureunit.LeicaMeasureUnit

仅记录该类。

© www.soinside.com 2019 - 2024. All rights reserved.