Не могу установить SPHINX - PermissionError: [Errno 13] В доступе отказано: './source' - PullRequest
0 голосов
/ 29 октября 2019

Быстрый запуск Sphinx не позволит мне выйти за рамки того, что мы подтверждаем, что нам нужны документы на английском языке.

У меня есть существующий файл CONDA с ​​именем demo_venv. Я активирую это и выполняю установку в pip, структура каталогов, как показано ниже -

(demo_venv) dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx$ pip install sphinx

дерево каталогов -

pycon-sphinx-tutorial
    ├── crawler
    ├── install.sh
    ├── README.rst
    ├── tutorial

Как видно из дерева - выше иОшибка ниже его PermissionError: [Errno 13].

(demo_venv) dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx/pycon-sphinx-tutorial/crawler/docs$ sphinx-quickstart
Welcome to the Sphinx 2.2.1 quickstart utility.

Please enter values for the following settings (just press Enter to
accept a default value, if one is given in brackets).

Selected root path: .

You have two options for placing the build directory for Sphinx output.
Either, you use a directory "_build" within the root path, or you separate
"source" and "build" directories within the root path.
> Separate source and build directories (y/n) [n]: y

The project name will occur in several places in the built documentation.
> Project name: Crawler
> Author name(s): RohitDhankar
> Project release []: 1.0

If the documents are to be written in a language other than English,
you can select a language here by its language code. Sphinx will then
translate text that it generates into that language.

For a list of supported codes, see
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-language.
> Project language [en]: en

Traceback (most recent call last):
  File "/home/dhankar/anaconda2/envs/demo_venv/bin/sphinx-quickstart", line 10, in <module>
    sys.exit(main())
  File "/home/dhankar/anaconda2/envs/demo_venv/lib/python3.6/site-packages/sphinx/cmd/quickstart.py", line 615, in main
    generate(d, overwrite=False, templatedir=args.templatedir)
  File "/home/dhankar/anaconda2/envs/demo_venv/lib/python3.6/site-packages/sphinx/cmd/quickstart.py", line 371, in generate
    ensuredir(srcdir)
  File "/home/dhankar/anaconda2/envs/demo_venv/lib/python3.6/site-packages/sphinx/util/osutil.py", line 79, in ensuredir
    os.makedirs(path, exist_ok=True)
  File "/home/dhankar/anaconda2/envs/demo_venv/lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: './source'

Я понимаю, что мне нужно изменить мой корневой путь / корневой каталог - на данный момент внутренний модуль / файл SPHINX - sphinx/cmd/quickstart.py не может найти правильный путь, где он имеет правильныйразрешения на создание каталога _build. МОЙ ВОПРОС - Как решить за это?

(demo_venv) dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx/pycon-sphinx-tutorial/crawler/docs$ sphinx-quickstart -c /media/dhankar/Dhankar_1/a5_test_sphinx
usage: sphinx-quickstart [OPTIONS] <PROJECT_DIR>
sphinx-quickstart: error: unrecognized arguments: -c

1 Ответ

0 голосов
/ 29 октября 2019

Не уверен, что это лучший или даже правильный подход. Но сейчас это то, что я сделал -

  1. Отредактировал файл - sphinx/cmd/quickstart.py - как показано ниже, изменил значение для path в словаре DEFAULTS.
DEFAULTS = {
    #'path': '.',
    'path': '/media/dhankar/Dhankar_1/a5_test_sphinx/',
    'sep': False,
    'dot': '_',
    'language': None,
    'suffix': '.rst',
    'master': 'index',
    'makefile': True,
    'batchfile': True,
}

Это теперь дало мне в терминале -

Welcome to the Sphinx 2.2.1 quickstart utility.

Please enter values for the following settings (just press Enter to
accept a default value, if one is given in brackets).

Selected root path: .

You have two options for placing the build directory for Sphinx output.
Either, you use a directory "_build" within the root path, or you separate
"source" and "build" directories within the root path.
> Separate source and build directories (y/n) [n]: n

The project name will occur in several places in the built documentation.
> Project name: Crawler
> Author name(s): RohitDhankar
> Project release []: 1.0

If the documents are to be written in a language other than English,
you can select a language here by its language code. Sphinx will then
translate text that it generates into that language.

For a list of supported codes, see
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-language.
> Project language [en]: en

Creating file ./conf.py.
Creating file ./index.rst.
Creating file ./Makefile.
Creating file ./make.bat.

Finished: An initial directory structure has been created.

You should now populate your master file ./index.rst and create other documentation
source files. Use the Makefile to build the docs, like so:
   make builder
where "builder" is one of the supported builders, e.g. html, latex or linkcheck.

Также ДЕРЕВО в каталоге, как показано ниже -

dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx$ tree
.
└── pycon-sphinx-tutorial
    ├── crawler
    │   ├── _build
    │   ├── conf.py
    │   ├── docs
    │   ├── index.rst
    │   ├── make.bat
    │   ├── Makefile
    │   ├── src
    │   │   ├── crawler
    │   │   │   ├── __init__.py
    │   │   │   ├── main.py
    │   │   │   └── utils.py
    │   │   └── __init__.py
    │   ├── _static
    │   └── _templates
    ├── install.sh
    ├── README.rst
    ├── tutorial
    │   ├── cheatsheet.html
    │   ├── finish.html
    │   ├── genindex.html
    │   ├── glossary.html
    │   ├── _images
    │   │   ├── cheatsheet-back-full.png
    │   │   └── cheatsheet-front-full.png
    │   ├── index.html
    │   ├── objects.inv
    │   ├── py-modindex.html
    │   ├── search.html
    │   ├── searchindex.js
    │   ├── _sources
    │   │   ├── cheatsheet.txt
    │   │   ├── finish.txt
    │   │   ├── glossary.txt
    │   │   ├── index.txt
    │   │   ├── start.txt
    │   │   ├── step-1.txt
    │   │   ├── step-2.txt
    │   │   ├── step-3.txt
    │   │   └── useful-links.txt
    │   ├── start.html
    │   ├── _static
    │   │   ├── ajax-loader.gif
    │   │   ├── basic.css
    │   │   ├── comment-bright.png
    │   │   ├── comment-close.png
    │   │   ├── comment.png
    │   │   ├── css
    │   │   │   ├── badge_only.css
    │   │   │   ├── badge_only.css.map
    │   │   │   ├── theme.css
    │   │   │   └── theme.css.map
    │   │   ├── doctools.js
    │   │   ├── down.png
    │   │   ├── down-pressed.png
    │   │   ├── file.png
    │   │   ├── fonts
    │   │   │   ├── FontAwesome.otf
    │   │   │   ├── fontawesome-webfont.eot
    │   │   │   ├── fontawesome-webfont.svg
    │   │   │   ├── fontawesome-webfont.ttf
    │   │   │   ├── fontawesome-webfont.woff
    │   │   │   ├── Inconsolata-Bold.ttf
    │   │   │   ├── Inconsolata-Regular.ttf
    │   │   │   ├── Inconsolata.ttf
    │   │   │   ├── Lato-Bold.ttf
    │   │   │   ├── Lato-Regular.ttf
    │   │   │   ├── RobotoSlab-Bold.ttf
    │   │   │   └── RobotoSlab-Regular.ttf
    │   │   ├── jquery-1.11.1.js
    │   │   ├── jquery.js
    │   │   ├── js
    │   │   │   ├── modernizr.min.js
    │   │   │   └── theme.js
    │   │   ├── minus.png
    │   │   ├── plus.png
    │   │   ├── pygments.css
    │   │   ├── searchtools.js
    │   │   ├── underscore-1.3.1.js
    │   │   ├── underscore.js
    │   │   ├── up.png
    │   │   ├── up-pressed.png
    │   │   └── websupport.js
    │   ├── step-1.html
    │   ├── step-2.html
    │   ├── step-3.html
    │   └── useful-links.html
    └── tutorial-setup.sh

15 directories, 75 files
dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx$ 

еще не сделаночто-нибудь еще - сообщу, если это работает.

РЕДАКТИРОВАТЬ - 1-

Далее вручную изменили структуру каталогов - теперь дерево выглядит так -

└── pycon-sphinx-tutorial
    ├── crawler
    │   ├── docs
    │   │   ├── _build
    │   │   ├── conf.py
    │   │   ├── index.rst
    │   │   ├── make.bat
    │   │   ├── Makefile
    │   │   ├── _static
    │   │   └── _templates
    │   └── src
    │       ├── crawler
    │       │   ├── __init__.py
    │       │   ├── main.py
    │       │   └── utils.py
    │       └── __init__.py
    ├── install.sh
    ├── README.rst
    ├── tutorial
    │   ├── cheatsheet.html
    │   ├── finish.html
    │   ├── genindex.html
    │   ├── glossary.html
    │   ├── _images
    │   │   ├── cheatsheet-back-full.png
    │   │   └── cheatsheet-front-full.png
    │   ├── index.html
    │   ├── objects.inv
    │   ├── py-modindex.html
    │   ├── search.html
    │   ├── searchindex.js
    │   ├── _sources
    │   │   ├── cheatsheet.txt
    │   │   ├── finish.txt
    │   │   ├── glossary.txt
    │   │   ├── index.txt
    │   │   ├── start.txt
    │   │   ├── step-1.txt
    │   │   ├── step-2.txt
    │   │   ├── step-3.txt
    │   │   └── useful-links.txt
    │   ├── start.html
    │   ├── _static
    │   │   ├── ajax-loader.gif
    │   │   ├── basic.css
    │   │   ├── comment-bright.png
    │   │   ├── comment-close.png
    │   │   ├── comment.png
    │   │   ├── css
    │   │   │   ├── badge_only.css
    │   │   │   ├── badge_only.css.map
    │   │   │   ├── theme.css
    │   │   │   └── theme.css.map
    │   │   ├── doctools.js
    │   │   ├── down.png
    │   │   ├── down-pressed.png
    │   │   ├── file.png
    │   │   ├── fonts
    │   │   │   ├── FontAwesome.otf
    │   │   │   ├── fontawesome-webfont.eot
    │   │   │   ├── fontawesome-webfont.svg
    │   │   │   ├── fontawesome-webfont.ttf
    │   │   │   ├── fontawesome-webfont.woff
    │   │   │   ├── Inconsolata-Bold.ttf
    │   │   │   ├── Inconsolata-Regular.ttf
    │   │   │   ├── Inconsolata.ttf
    │   │   │   ├── Lato-Bold.ttf
    │   │   │   ├── Lato-Regular.ttf
    │   │   │   ├── RobotoSlab-Bold.ttf
    │   │   │   └── RobotoSlab-Regular.ttf
    │   │   ├── jquery-1.11.1.js
    │   │   ├── jquery.js
    │   │   ├── js
    │   │   │   ├── modernizr.min.js
    │   │   │   └── theme.js
    │   │   ├── minus.png
    │   │   ├── plus.png
    │   │   ├── pygments.css
    │   │   ├── searchtools.js
    │   │   ├── underscore-1.3.1.js
    │   │   ├── underscore.js
    │   │   ├── up.png
    │   │   ├── up-pressed.png
    │   │   └── websupport.js
    │   ├── step-1.html
    │   ├── step-2.html
    │   ├── step-3.html
    │   └── useful-links.html
    └── tutorial-setup.sh

15 directories, 75 files

РЕДАКТИРОВАТЬ -2 ---

Теперь все в порядке - мой первоначальный вопрос остается - Как бы я правильно изменил путь --- Selected root path: . вместо пути по умолчанию?

(demo_venv) dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx/pycon-sphinx-tutorial/crawler/docs$ make html
Running Sphinx v2.2.1
making output directory... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index                                                                                                                       
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index                                                                                                                        
generating indices...  genindexdone
writing additional pages...  searchdone
copying static files... ... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded.

The HTML pages are in _build/html.

Может обслуживать основную страницу в http://localhost:8000/

(demo_venv) dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx/pycon-sphinx-tutorial/crawler/docs$ cd _build/
(demo_venv) dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx/pycon-sphinx-tutorial/crawler/docs/_build$ ls
doctrees  html
(demo_venv) dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx/pycon-sphinx-tutorial/crawler/docs/_build$ cd html
(demo_venv) dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx/pycon-sphinx-tutorial/crawler/docs/_build/html$ ls
genindex.html  index.html  objects.inv  search.html  searchindex.js  _sources  _static
(demo_venv) dhankar@dhankar-VPCEB44EN:/media/dhankar/Dhankar_1/a5_test_sphinx/pycon-sphinx-tutorial/crawler/docs/_build/html$ python3 -m http.server
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
127.0.0.1 - - [29/Oct/2019 22:31:41] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2019 22:31:41] "GET /_static/alabaster.css HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2019 22:31:41] "GET /_static/pygments.css HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2019 22:31:41] "GET /_static/documentation_options.js HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2019 22:31:41] "GET /_static/jquery.js HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2019 22:31:41] "GET /_static/underscore.js HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2019 22:31:41] "GET /_static/custom.css HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2019 22:31:41] "GET /_static/doctools.js HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2019 22:31:41] "GET /_static/language_data.js HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2019 22:31:41] "GET /_static/basic.css HTTP/1.1" 200 -
127.0.0.1 - - [29/Oct/2019 22:31:42] code 404, message File not found
127.0.0.1 - - [29/Oct/2019 22:31:42] "GET /favicon.ico HTTP/1.1" 404 -


...