Sitelet https://web.archive.org/web/20201210055525/https://github.com/pyrogram/pyrogram/issues/356
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

Cannot configure unkown_error logging #356

Open
jillro opened this issue Jan 16, 2020 · 2 comments
Open

Cannot configure unkown_error logging #356

jillro opened this issue Jan 16, 2020 · 2 comments

Comments

@jillro
Copy link

@jillro jillro commented Jan 16, 2020

Checklist

  • I am sure the error is coming from Pyrogram's code and not elsewhere.
  • I have searched in the issue tracker for similar bug reports, including closed ones.
  • I ran pip3 install -U https://github.com/pyrogram/pyrogram/archive/develop.zip and reproduced the issue using the latest development version.

Description

When a RPC UnknownError is raised, Pyrogram tries to open and write in unkown_errors.txt in the current directory. If Pyrogram has no write access to current directory, the program crash, and the only error logged is a permission denied error, without any information on the UnkownError.

Pyrogram should not require write access to current directory and should use standard Python tools for logging. Pyrogram can configure a default logging handler for unkown rpc errors to current directory, but in any case it should use the standard python logging so users can configure another handler.

Steps to Reproduce

I don't know how to reproduce an unkown RPC error, because I cannot read the log to understand mine.

Traceback

File "virtualenv/lib/python3.7/site-packages/pyrogram/session/session.py", line 439, in send
    raise e from None
File "virtualenv/lib/python3.7/site-packages/pyrogram/session/session.py", line 436, in send
    return self._send(data, timeout=timeout)
File "virtualenv/lib/python3.7/site-packages/pyrogram/session/session.py", line 423, in _send
    RPCError.raise_it(result, type(data))
File "virtualenv/lib/python3.7/site-packages/pyrogram/errors/rpc_error.py", line 74, in raise_it
    is_unknown=True)
File "virtualenv/lib/python3.7/site-packages/pyrogram/errors/rpc_error.py", line 50, in __init__
    with open("unknown_errors.txt", "a", encoding="utf-8") as f:
@delivrance
Copy link
Member

@delivrance delivrance commented Jan 19, 2020

@jillro Thanks for the report, I assume you are keeping your session files elsewhere otherwise you'd get a similar error when running.

About the issue, maybe we can just get rid of that portion of code altogether. The idea behind was to have people report unknown errors regardless of their logging settings.

@jillro
Copy link
Author

@jillro jillro commented Jan 20, 2020

Indeed we are keeping session informations in database. Removing that portion of code would be enough I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.