简体   繁体   中英

read-the-docs build fails because of prompt

I am developing a Python package which, on first use, creates a config file for the user. During this setup phase, the user is asked for input during two prompts. Corresponding calls are in the module's __init__.py . Because of this prompt, my builds on readthedocs fail ( log ).

How can I build my documentation nonetheles? Why is readthedocs trying to compile the code anyways?

The problem is you are importing your module in conf.py :

project_root = os.path.dirname(cwd)
sys.path.insert(0, project_root)

import scopus  # <-- imported

# General configuration
needs_sphinx = '1.3'
extensions = [

And your project is not constrcuted well. I don't think just importing your module will cause prompt is a good idea.

import scopus  ->  
from scopus.utils import *  ->  
from scopus.utils.startup import *  ->    
....
if 'Authentication' not in config.sections():
    set_authentication(config, CONFIG_FILE)  # <-- cause prompt
....

Addtionally, even worse:

CONFIG_FILE = os.path.expanduser("~/.scopus/config.ini")
config = configparser.ConfigParser()
config.optionxform = str
config.read(CONFIG_FILE)

Reading file system.

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