ValvePython / csgo

🔫 Python package for interacting with CS:GO Game Coordinator
http://csgo.readthedocs.io
124 stars 17 forks source link

ffi.from_handle() #25

Closed withs closed 4 years ago

withs commented 4 years ago

hi, i ahve a problem when login i got : Fatal Python error: ffi.from_handle() detected that the address passed points to garbage. If it is really the result of ffi.new_handle(), then the Python object has already been garbage collected Python runtime state: initialized

code

from steam.client import SteamClient
from csgo.client import CSGOClient
import logging

logon_details = {
    'username': "unshibasauvage",
    'password': "pass",
}

logging.basicConfig(format='[%(asctime)s] %(levelname)s %(name)s: %(message)s', level=logging.DEBUG)

client = SteamClient()
client.login(logon_details)
cs = CSGOClient(client)

@client.on('logged_on')
def start_csgo():
    cs.launch()

@cs.on('ready')
def gc_ready():
    # send messages to gc
    pass

client.cli_login()

error

C:\Users\Shibo\AppData\Local\Programs\Python\Python38\python.exe D:/Documents/Project/CsgoSkinScreenshot---CSS/test.py [2020-05-11 21:47:04,036] DEBUG SteamClient: Attempting login [2020-05-11 21:47:04,036] DEBUG SteamClient: Connect initiated. [2020-05-11 21:47:04,036] DEBUG CMServerList: Attempting bootstrap via WebAPI [2020-05-11 21:47:04,039] DEBUG urllib3.connectionpool: Starting new HTTPS connection (1): api.steampowered.com:443 [2020-05-11 21:47:04,316] DEBUG urllib3.connectionpool: https://api.steampowered.com:443 "GET /ISteamDirectory/GetCMList/v1/?cellid=0&format=json HTTP/1.1" 200 793 [2020-05-11 21:47:04,317] DEBUG CMServerList: Recieved 100 servers from WebAPI [2020-05-11 21:47:04,317] DEBUG CMServerList: Added 100 new CM addresses. [2020-05-11 21:47:04,318] DEBUG Connection: Attempting connection to ('155.133.248.34', 27020) [2020-05-11 21:47:04,335] DEBUG Connection: Connected. [2020-05-11 21:47:04,335] DEBUG SteamClient: Emit event: 'connected' [2020-05-11 21:47:04,351] DEBUG SteamClient: Incoming: <Msg(<EMsg.ChannelEncryptRequest: 1303> | ChannelEncryptRequest)> [2020-05-11 21:47:04,351] DEBUG SteamClient: Emit event: <EMsg.ChannelEncryptRequest: 1303> [2020-05-11 21:47:04,351] DEBUG SteamClient: Securing channel [2020-05-11 21:47:04,354] DEBUG SteamClient: Outgoing: <Msg(<EMsg.ChannelEncryptResponse: 1304> | ChannelEncryptResponse)> Fatal Python error: ffi.from_handle() detected that the address passed points to garbage. If it is really the result of ffi.new_handle(), then the Python object has already been garbage collected Python runtime state: initialized

Thread 0x00004098 (most recent call first): File "C:\Users\Shibo\AppData\Local\Programs\Python\Python38\lib\site-packages\gevent_threading.py", line 60 in wait File "C:\Users\Shibo\AppData\Local\Programs\Python\Python38\lib\site-packages\gevent_threading.py", line 146 in get File "C:\Users\Shibo\AppData\Local\Programs\Python\Python38\lib\site-packages\gevent\threadpool.py", line 155 in run

Current thread 0x00004ef0 (most recent call first): File "C:\Users\Shibo\AppData\Local\Programs\Python\Python38\lib\site-packages\gevent_ffi\loop.py", line 264 in python_stop File "C:\Users\Shibo\AppData\Local\Programs\Python\Python38\lib\site-packages\gevent\libuv\loop.py", line 498 in __run_queued_callbacks File "C:\Users\Shibo\AppData\Local\Programs\Python\Python38\lib\site-packages\gevent\libuv\loop.py", line 218 in _run_callbacks File "C:\Users\Shibo\AppData\Local\Programs\Python\Python38\lib\site-packages\gevent_ffi\loop.py", line 300 in python_prepare_callback File "C:\Users\Shibo\AppData\Local\Programs\Python\Python38\lib\site-packages\gevent\libuv\loop.py", line 542 in run File "C:\Users\Shibo\AppData\Local\Programs\Python\Python38\lib\site-packages\gevent\hub.py", line 618 in run

Process finished with exit code -1073740791 (0xC0000409)

info

python : Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] os : windows 10

thx for help :)

rossengeorgiev commented 4 years ago

That is a problem with gevent. See https://github.com/gevent/gevent/issues/1587

No release with the fix yet, but you can try installing an older version of gevent. Like 1.5.0 or 1.4.0

withs commented 4 years ago

its working when i search csgo python i only found cheating stuff do you know some one who make a tuto or explain csgo python ? exept the doc thx :)

like how to connect : i used client.cli_login('my_user', 'my_pass') i tried to lauch the program with cs launched and without cs but nor working

[2020-05-12 13:06:41,228] DEBUG Connection: Connected.
[2020-05-12 13:06:41,743] DEBUG SteamClient: Emit event: 'error'
[2020-05-12 13:06:41,743] DEBUG SteamClient: Emit event: 'disconnected'

maybe because my game is moded and it launch with -insecure or the account have email 2fa

do you think its possible to make an event wich know when an items is inspected in the main menu

:) thc for your work

rossengeorgiev commented 4 years ago

I assume the initial issue is resolved. Look at the examples in the documentation, and recipes here: https://github.com/ValvePython/steam/tree/master/recipes/1.Login