bhackel / cheggbog

Fully automated Chegg Discord bot for homework help
MIT License
13 stars 3 forks source link

Error when running program. #1

Closed Brandonv101 closed 2 years ago

Brandonv101 commented 3 years ago

Hi there

When running the program on Windows Server 2019 with all the tools installed as per the instructions it seems to not run. Attached below is the output.

`C:\Users\Administrator\Desktop\cheggbog-main>py cheggbog.py Traceback (most recent call last): File "C:\Program Files\Python39\lib\site-packages\discord\http.py", line 300, in static_login data = await self.request(Route('GET', '/users/@me')) File "C:\Program Files\Python39\lib\site-packages\discord\http.py", line 254, in request raise HTTPException(r, data) discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\Administrator\Desktop\cheggbog-main\cheggbog.py", line 59, in client.run(key) File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 723, in run return future.result() File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 702, in runner await self.start(*args, *kwargs) File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 665, in start await self.login(args, bot=bot) File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 511, in login await self.http.static_login(token.strip(), bot=bot) File "C:\Program Files\Python39\lib\site-packages\discord\http.py", line 304, in static_login raise LoginFailure('Improper token has been passed.') from exc discord.errors.LoginFailure: Improper token has been passed. Exception ignored in: <function _ProactorBasePipeTransport.del at 0x0000013F2A7CAE50> Traceback (most recent call last): File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 116, in del self.close() File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 108, in close self._loop.call_soon(self._call_connection_lost, None) File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 746, in call_soon self._check_closed() File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 510, in _check_closed raise RuntimeError('Event loop is closed') RuntimeError: Event loop is closed

C:\Users\Administrator\Desktop\cheggbog-main>py cheggbog.py File "C:\Users\Administrator\Desktop\cheggbog-main\cheggbog.py", line 44 path = "C:\Users\Administrator\Downloads\screenshots" ^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

C:\Users\Administrator\Desktop\cheggbog-main>https://discord.com/api/oauth2/authorize?client_id=896142221424865323&permissions=8&scope=bot 'https:' is not recognized as an internal or external command, operable program or batch file. 'permissions' is not recognized as an internal or external command, operable program or batch file. 'scope' is not recognized as an internal or external command, operable program or batch file.

C:\Users\Administrator\Desktop\cheggbog-main>py cheggbog.py File "C:\Users\Administrator\Desktop\cheggbog-main\cheggbog.py", line 44 path = "C:\Users\Administrator\Downloads\screenshots" ^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape`

Not exactly sure what is causing the error. Thanks!

Brandonv101 commented 3 years ago

Fixed with \ on download directory

bhackel commented 3 years ago

Where exactly did you add the / to? I would like to fix it in the readme. Thanks for finding

Brandonv101 commented 3 years ago

For example the directory : C:\Users\Administrator\Downloads\screenshots

I changed it to: C:\Users\Administrator\Downloads\screenshots

The only issue I am having occur currently is that it is saying permission denied with the following output:

Chegging ['https://www.chegg.com/homework-help/questions-and-answers/1-determine-resultant-following-vectors-150-n-30-250-n-120-350-n-320-q58272885'] Ignoring exception in on_message Traceback (most recent call last): File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event await coro(*args, **kwargs) File "C:\Users\Administrator\Desktop\cheggbog-main\cheggbog.py", line 48, in on_message file = [discord.File(file_loc)] File "C:\Program Files\Python39\lib\site-packages\discord\file.py", line 73, in __init__ self.fp = open(fp, 'rb') PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Administrator\\Downloads\\screenshots'

bhackel commented 3 years ago

Oh right, you might need to allow your bot to have image send/file attachment permissions if it’s in a server

Brandonv101 commented 3 years ago

Just wondering wouldn't the error indicate that it would be a python permission error or a discord permission error?

bhackel commented 3 years ago

I think you are right, when it doesn’t have permissions in the server, it usually gives a 403 error.

bhackel commented 3 years ago

I haven’t had any file access permission errors before, maybe it’s a windows server thing. You could try running it as administrator and see if that works.

Brandonv101 commented 3 years ago

Thanks I did try running it with admin although going to see if it's a Windows server issue since it's running on an ESXi instance as windows server although will do some testing since I don't think there is a way to chmod file directories on windows.

On Fri, Oct 8, 2021, 6:47 PM Bryce Hackel @.***> wrote:

I haven’t had any file access permission errors before, maybe it’s a windows server thing. You could try running it as administrator and see if that works.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/bhackel/cheggbog/issues/1#issuecomment-939154247, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADA5UTPUE4SUAYXYKI4HUW3UF5YIRANCNFSM5FUNYBJA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.