简体   繁体   中英

Need help with KeyError when building epydoc files for project

I have a pylons project with an extensive set of functional tests that I want my manual QA's to be able to read from time to time, so I'm using epydoc to build out the html pydocs on the functional test modules.

It seems to be working fine. It generates the docs, and I can navigate through them without any apparent problems.

However, I'm getting a strange error when I run the epydoc build, and I'm not sure how to fix it:

+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| In project.tests.functional.resource:
| Import failed (but source code parsing was successful).
|     Error: KeyError: '__file__' (line 28)
|
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | In /Eclipse/product/project/server/src/project/tests/functional/resource/ftest_module1.py: | Import failed (but source code parsing was successful). | Error: KeyError: '__file__' (line 28) |
+------------------------------------------------------------------------------------------

There are a total of 2 packages and 8 modules on which this is happening. I thought at first, it might be the absence of docstrings at the head of the modules, or in the __init__ of the packages, but adding them did not fix it.

Here is a copy of the epydoc config file written specifically for the function tests:

[epydoc]
modules: project.tests.functional.resource,project.tests.functional.views
output: html
sourcecode: yes
#graph: none
target: ../pydoc/ftests
name: PROJECT
# exclude: test
private: no
imports: no
verbosity: 0
include-log: yes

And here is a copy of the shell script used to execute it:

#!/usr/bin/env bash
basedir=${0%/*}
cd "$basedir/../src"

etc="../etc"
pydoc="../pydoc"
pydoc_ftests="../pydoc/ftests"

mkdir -p $pydoc
mkdir -p $pydoc_ftests

epydoc -v --config $etc/epydoc.config
epydoc -v --config $etc/epydoc.ftests.config

Any suggestions?

What I ended up doing, finally, was just including --parse-only on the epydoc command, to force it not to import anything (thus working around the problem of unlocatable imports, but not really answering why it was happening at all). Not a perfect solution, but it satisfied the requirements...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM