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

Encoding error: 'ascii' codec can't decode byte 0xf0 in position 3: ordinal not in range(128) #159

Closed
mangopipeline opened this issue Jan 27, 2019 · 7 comments

Comments

@mangopipeline
Copy link

Happens during he "Rendering Data" step.
Any ideas?

auto api is also logging sevral "cannot resolve import" messages like the one below...

WARNING: Cannot resolve import of mango.mapis.icon_lib in mango.mutils.qccs

sphinx-err-sced7_.log

@mangopipeline
Copy link
Author

I'm using the latest code from master branch by the way....
63bbe71

@AWhetter
Copy link
Collaborator

Do you have a data object (module level assignment) with a unicode value somewhere? It might be that we need to call self._encode() on data values as well as the docstring (https://github.com/rtfd/sphinx-autoapi/blob/63bbe719c667544a6780ee7f8e2fce1a0ffb6da7/autoapi/mappers/python.py#L578).

The import resolution errors are telling you that autoapi could not find icon_lib in mango.mapis from an import in mango.mutil.qccs. There's not much that I can do to debug it without access to the source code that its parsing. Is the import correct?

@mangopipeline
Copy link
Author

I don’t think I have any data objects objects with Unicode values but I might! Lol
I’m dealing with a pretty big code base that I’m heavly refactoring, is there anyway to get an error message that points me to the file that auto api is crashing on?

The resolve messages seem odd as the modules are there, but I will ignore this for now, and focus on this encoding issue.

I’ll log it as a separate issue if I can’t make since of it after a bit more testing :)

@AWhetter
Copy link
Collaborator

If you put a breakpoint in PythonMapperBase.rendered you can use self to figure out what object is being rendered by looking at self.obj["full_name"].

@property
def rendered(self):
    "Shortcut to render an object in templates."
    try:
        return self.render()
    except Exception:
        import pdb; pdb.set_trace()
        raise

Although the fact that you need to use pdb is maybe an indication that we need to improve the debug logging.

@mangopipeline
Copy link
Author

I will give that a go and let you know what I find out :)

@AWhetter
Copy link
Collaborator

I've added debug logging, so you shouldn't need to use pdb anymore. If you give sphinx-build the -v flag it will print out which module or package is being rendered. If you give it -vv, it will also print which object is being rendered.

@mangopipeline
Copy link
Author

That’s awesome I’ll give it a go this weekend :)

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