will7200 / Yugioh-bot

Bot for Yugioh Duel Links via Nox and Steam
MIT License
58 stars 9 forks source link

Exception: Win handle is not valid for Steam #42

Closed NaniteFactory closed 6 years ago

NaniteFactory commented 6 years ago
[locations]
home= .
assets = %(home)s\assets
bin = %(home)s\bin
log = %(home)s\log
cache_file = %(home)s\assets\predefined.h5

[bot]
startbotonstartup = True
provider = Steam
runtimepersistence = runTimeOptions.json
sleepfactor = .9

[steam]
location = E:\Program Files (x86)\Steam

[nox]
noxlocation = C:\Program Files (x86)\Nox\bin
killnoxondone = False
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\Users\user\Downloads\Yugioh-bot-0.4.5>python main.py bot -s
2018-02-03 01:48 - DEBUG - bot - Watching C:\Users\user\Downloads\Yugioh-bot-0.4.5\runTimeOptions.json for runTime Options
2018-02-03 01:48 - INFO - apscheduler.scheduler - Scheduler started
2018-02-03 01:48 - CRITICAL - bot - Could not get a provider, take a look at your config file
2018-02-03 01:48 - CRITICAL - bot - Win handle is not valid for Steam
2018-02-03 01:48 - DEBUG - bot - Traceback (most recent call last):
  File "main.py", line 49, in setup_runtime
    dlRuntime.set_provider(get_provider(uconfig.get('bot', 'provider'))(scheduler, uconfig, dlRuntime))
  File "C:\Users\user\Downloads\Yugioh-bot-0.4.5\bot\providers\steam\steam.py", line 41, in __init__
    self.ensure_resolutions_matches()
  File "C:\Users\user\Downloads\Yugioh-bot-0.4.5\bot\providers\steam\steam.py", line 135, in ensure_resolutions_matches
    img = self.get_img_from_screen_shot()
  File "C:\Users\user\Downloads\Yugioh-bot-0.4.5\bot\providers\actions.py", line 36, in get_img_from_screen_shot
    screen_shot = self.take_png_screenshot()
  File "C:\Users\user\Downloads\Yugioh-bot-0.4.5\bot\providers\steam\steam.py", line 294, in take_png_screenshot
    raise Exception("Win handle is not valid for Steam")
Exception: Win handle is not valid for Steam

C:\Users\user\Downloads\Yugioh-bot-0.4.5>

python main.py bot -s in my windows command prompt gives me error above.

I've run python install.py and put tesseract into bin\tess\.

I get Python 3.5.2 :: Anaconda 4.2.0 (64-bit) with python --version.

Any suggestions?

NaniteFactory commented 6 years ago

So I tried master rather than the release version then I got a different error. It is the latest update 9709a47108ced43f3a909698e1f61be51b795037. It seems like there's some issue with resolutions of the steam client, but I can't really figure out a thing. Please help!

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\Users\user\Downloads\Yugioh-bot>python main.py bot -s
2018-02-03 02:29 - INFO - apscheduler.scheduler - Scheduler started
2018-02-03 02:29 - CRITICAL - bot - Could not get a provider, take a look at your config file
2018-02-03 02:29 - CRITICAL - bot - Unmatched resolution of 748-1285 expected 929-1606
2018-02-03 02:29 - DEBUG - bot - Traceback (most recent call last):
  File "main.py", line 49, in setup_runtime
    dlRuntime.set_provider(get_provider(uconfig.get('bot', 'provider'))(scheduler, uconfig, dlRuntime))
  File "C:\Users\user\Downloads\Yugioh-bot\bot\providers\steam\steam.py", line 47, in __init__
    self.ensure_resolutions_matches()
  File "C:\Users\user\Downloads\Yugioh-bot\bot\providers\steam\steam.py", line 141, in ensure_resolutions_matches
    "Unmatched resolution of {}-{} expected {}-{}".format(height, width, pre_height, pre_width))
  File "C:\Users\user\Downloads\Yugioh-bot\bot\common.py", line 65, in bot_assertion
    raise error_type(message)
bot.providers.BotSetupError: Unmatched resolution of 748-1285 expected 929-1606

C:\Users\user\Downloads\Yugioh-bot>

Any assistance would be appreciated, thanks.

curtiola commented 6 years ago

Right now it doesn't support resolutions lower than 1606x929, I think Will is trying to collect some data to solve the issue. At the moment if you can't increase your resolution you would need to use Nox instead of Steam.

will7200 commented 6 years ago

@NaniteFactory curtiola nailed it with the explanation. When I was making the steam version I was unaware of the steam configuration exe that allowed to change the resolution hence I made it for the default on my computer which was 1600 by 920. Currently working on porting to other resolutions.

NaniteFactory commented 6 years ago

Okay, thanks. I'll be running it on Nox for now. I just got Nox installed, and it works fine with the 480x800 resolution.