ValvePython / dota2

🐸 Python package for interacting with Dota 2 Game Coordinator
http://dota2.readthedocs.io
198 stars 32 forks source link

Invalid password + _sys.settrace #84

Closed nikoniko2027 closed 2 years ago

nikoniko2027 commented 2 years ago

Hello! When trying to execute this code

from steam.client import SteamClient
from dota2.client import Dota2Client

client = SteamClient()
dota = Dota2Client(client)

@client.on('logged_on')
def start_dota():
    dota.launch()
    print("hello1")

@dota.on('ready')
def do_dota_stuff():
    # talk to GC
    print("hello2")

client.cli_login()
client.run_forever()
print("hello3")

I am asked to enter my username and password from my Steam account, after which the following errors occur

PYDEV DEBUGGER WARNING:
sys.settrace() should not be used when the debugger is being used.
This may cause the debugger to stop working correctly.
If this is needed, please check:
http://pydev.blogspot.com/2007/06/why-cant-pydev-debugger-work-with.html
to see how to restore the debug tracing back correctly.
Call Location:
  File "C:\Python27amd64\lib\site-packages\gevent\threadpool.py", line 157, in _before_run_task
    _sys.settrace(_get_thread_trace())
It seems that the gevent monkey-patching is being used.
 Please set an environment variable with:
GEVENT_SUPPORT=True
to` enable gevent support in the debugger.
`PYDEV` DEBUGGER WARNING:
sys.settrace() should not be used when the debugger is being used.
This may cause the debugger to stop working correctly.
If this is needed, please check:
http://pydev.blogspot.com/2007/06/why-cant-pydev-debugger-work-with.html
to see how to restore the debug tracing back correctly.
Call Location:
  File "C:\Python27amd64\lib\site-packages\gevent\threadpool.py", line 162, in _after_run_task
    _sys.settrace(None)

After these messages, I get a message that the password for my account was entered incorrectly. Can you please help me solve the problem?

rossengeorgiev commented 2 years ago

Are you using PyDEV IDE? That's probably why. gevent library uses python's trace infrastructure to modify the stack frames and that seems to be incompatible with the IDE. The message does tell you that you can enable gevent support with GEVENT_SUPPORT=True, so try that.

nikoniko2027 commented 2 years ago

Are you using PyDEV IDE? That's probably why. gevent library uses python's trace infrastructure to modify the stack frames and that seems to be incompatible with the IDE. The message does tell you that you can enable gevent support with GEVENT_SUPPORT=True, so try that.

I am using Visual Studio 2019 for Python programming. I have never encountered such a problem before when I was working on network projects. Do you happen to know how it is possible in VS2019 to assign a parameter for GEVENT_SUPPORT=True? P.S. I Googled the information on the Internet and found the following

import os os.environ["GEVENT_SUPPORT"] = 'True'

However, it didn't help me

rossengeorgiev commented 2 years ago

No idea, never tried a python project VS2019.

Rihardskombu commented 1 year ago

hey, I found that I can pass credentials like this client.cli_login("usernamestring", "passwordstring")

debug inside of client.cli_login() can save your life image

Full code example: https://github.com/Rihardskombu/dota2-auth/blob/main/main.py