Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when creating docset #115

Closed
crydotsnake opened this issue Aug 26, 2022 · 7 comments
Closed

Error when creating docset #115

crydotsnake opened this issue Aug 26, 2022 · 7 comments

Comments

@crydotsnake
Copy link

crydotsnake commented Aug 26, 2022

Hello,

i would like to create a docset for guzzle. But when running the doc2dash command:

doc2dash _build/html -n guzzle-docs -d /Users/USERNAME/Git/guzzle/docs

i get an error message.

Converting intersphinx docs from "html" to "/Users/USERNAME/Git/guzzle/docs/guzzle-docs.docset".
Parsing documentation...
Added 22 index entries.
Adding table of contents meta data...  [#################################################################################################################################################################------------------------------------------------------------------------------------------------------------]   60%
Traceback (most recent call last):
  File "/Users/USERNAME/.virtualenvs/doc2dashtest/bin/doc2dash", line 8, in <module>
    sys.exit(main())
  File "/Users/USERNAME/.virtualenvs/doc2dashtest/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/USERNAME/.virtualenvs/doc2dashtest/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/USERNAME/.virtualenvs/doc2dashtest/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/USERNAME/.virtualenvs/doc2dashtest/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/USERNAME/.virtualenvs/doc2dashtest/lib/python3.9/site-packages/doc2dash/__main__.py", line 227, in main
    toc.close()
  File "/Users/USERNAME/.virtualenvs/doc2dashtest/lib/python3.9/site-packages/doc2dash/parsers/utils.py", line 134, in patch_anchors
    patch_files(pbar)
  File "/Users/USERNAME/.virtualenvs/doc2dashtest/lib/python3.9/site-packages/doc2dash/parsers/utils.py", line 114, in patch_files
    with codecs.open(full_path, mode="r", encoding="utf-8") as fp:
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/codecs.py", line 905, in open
    file = builtins.open(filename, mode, buffering)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/USERNAME/Git/guzzle/docs/guzzle-docs.docset/Contents/Resources/Documents/py-modindex.html'

any ideas?

doc2dash version: 2.4.1

@hynek
Copy link
Owner

hynek commented Aug 26, 2022

Are you trying to convert an archive downloaded from readthedocs?

@crydotsnake
Copy link
Author

I'm not sure.

I builded the html files with: make html from here: https://github.com/guzzle/guzzle/tree/master/docs

and then i did: doc2dash _build/html -n guzzle-docs -d /Users/USERNAME/Git/guzzle/docs

@hynek
Copy link
Owner

hynek commented Aug 26, 2022

Ohhh this is interesting! Guzzle is a PHP project! doc2dash technically only supports Python, but there are a few standard types that Guzzle is using:

[DataObjStr(name='allow_redirects-option', domain='std', role='label', priority='-1', uri='request-options.html#allow-redirects-option', dispname='allow_redirects'),
 DataObjStr(name='cert-option', domain='std', role='label', priority='-1', uri='request-options.html#$', dispname='cert'),
 DataObjStr(name='connect_timeout-option', domain='std', role='label', priority='-1', uri='request-options.html#connect-timeout-option', dispname='connect_timeout'),
 DataObjStr(name='cookies-option', domain='std', role='label', priority='-1', uri='request-options.html#$', dispname='cookies'),
 DataObjStr(name='debug-option', domain='std', role='label', priority='-1', uri='request-options.html#$', dispname='debug'),
 DataObjStr(name='decode_content-option', domain='std', role='label', priority='-1', uri='request-options.html#decode-content-option', dispname='decode_content'),
 DataObjStr(name='delay-option', domain='std', role='label', priority='-1', uri='request-options.html#$', dispname='delay'),
 DataObjStr(name='expect-option', domain='std', role='label', priority='-1', uri='request-options.html#$', dispname='expect'),
 DataObjStr(name='genindex', domain='std', role='label', priority='-1', uri='genindex.html#', dispname='Index'),
 DataObjStr(name='http-errors-option', domain='std', role='label', priority='-1', uri='request-options.html#$', dispname='http_errors'),
 DataObjStr(name='installation', domain='std', role='label', priority='-1', uri='overview.html#$', dispname='Installation'),
 DataObjStr(name='modindex', domain='std', role='label', priority='-1', uri='py-modindex.html#', dispname='Module Index'),
 DataObjStr(name='on-headers', domain='std', role='label', priority='-1', uri='request-options.html#$', dispname='on_headers'),
 DataObjStr(name='on_stats', domain='std', role='label', priority='-1', uri='request-options.html#on-stats', dispname='-'),
 DataObjStr(name='proxy-option', domain='std', role='label', priority='-1', uri='request-options.html#$', dispname='proxy'),
 DataObjStr(name='search', domain='std', role='label', priority='-1', uri='search.html#', dispname='Search Page'),
 DataObjStr(name='sink-option', domain='std', role='label', priority='-1', uri='request-options.html#$', dispname='sink'),
 DataObjStr(name='ssl_key-option', domain='std', role='label', priority='-1', uri='request-options.html#ssl-key-option', dispname='ssl_key'),
 DataObjStr(name='stream-option', domain='std', role='label', priority='-1', uri='request-options.html#$', dispname='stream'),
 DataObjStr(name='timeout-option', domain='std', role='label', priority='-1', uri='request-options.html#$', dispname='timeout'),
 DataObjStr(name='verify-option', domain='std', role='label', priority='-1', uri='request-options.html#$', dispname='verify'),
 DataObjStr(name='version-option', domain='std', role='label', priority='-1', uri='request-options.html#$', dispname='version')]

Looks like they just use the role label, which in doc2dash is translated to Sections so that would work!

Unfortunately there's the entry DataObjStr(name='modindex', domain='std', role='label', priority='-1', uri='py-modindex.html#', dispname='Module Index'), that points at py-modindex.html that makes no sense in PHP docs.


I've locally added a workaround that allows that file to be missing and could build the docs (it's only 5.7 MB because of the fonts):

guzzle.docset.zip

Is this useful to you? I could push a new release over the weekend I think (want to do some other minor work).


Are you involved with the project in some capacity? I would love to add better PHP support to doc2dash but have no clue about it. I would suspect there's better ways to integrate PHP docs into Sphinx.

@crydotsnake
Copy link
Author

I've locally added a workaround that allows that file to be missing and could build the docs (it's only 5.7 MB because of the fonts):

Yes thanks a lot! How do you edit the docset? just that i know it for the next time.

No. I'm not involved in this project.

@hynek hynek closed this as completed in 5b0d5f1 Aug 26, 2022
@hynek
Copy link
Owner

hynek commented Aug 26, 2022

I didn't edit the docset; I've fixed the behavior in 5b0d5f1. :)

If you'd like to play with it, you can try running current main but I hope to push a release soon-ish.

@crydotsnake
Copy link
Author

Thanks!

@hynek
Copy link
Owner

hynek commented Sep 14, 2022

JFTR doc2dash 3 is out with the necessary fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants