Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Win32API Troubles
#3
(Mar-24-2020, 07:03 PM)buran Wrote: may I ask why that complicated scheme running the code? What does "pasting actual code", where it comes from? Why not simply save the code as py files and run it the normal way?

https://python-forum.io/Thread-How-to-Ex...ython-code

it looks like import win32api was changed probably by mistake - import was deleted and first line in empty, second line is just win32api. But that is just a guess based on the traceback

I'm running it for a game, and it basically requires it to be through Powershell. I have the code in its own document, and I'd always just paste it into Powershell (after I did those previously stated steps). The one thing I neglected to mention, was what Powershell displayed in the actual code; that error I pasted is what it says below after I hit enter. Here's what it says on the actual code:
>>> import win32api
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.
>>> import mouse
>>> from time import sleep
>>> import random
>>> from random import randint
>>>
>>> # Digits
>>> runter =[18,18,14,14,14,14,14,14,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
>>> cunter =[-4,-4,-4,-4,-4,-4,-4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
>>>
>>>
>>> # vars
>>> count = 0
>>> EinAus = False
>>> jaornein = randint(0,1)
>>>
>>>
>>>
>>> # Loop
>>> count = 0
>>> while True:
...     if win32api.GetAsyncKeyState(ord('0')):
...         EinAus = not EinAus
...         sleep(0.2)
...         print('On')
...     sleep(0.2)
...     while EinAus is True:
...         count = 0
...         while mouse.is_pressed(button='left'):
...             if count < 40:
...                 jaornein = randint(0,1)
...                 if jaornein == 1:
...                     randomized = randint(0,5)
...                 elif jaornein == 0:
...                     randomized = random.uniform(0,-5)
...                 print(randomized)
...                 ammount = runter[count]
...                 drew = cunter[count]
...                 if jaornein == 1:
...                     ammount = ammount + randomized
...                     drew = drew + randomized
...                 elif jaornein == 0:
...                     ammount = ammount - randomized
...                     drew = drew - randomized
...                 ammountFinal = int(round(ammount))
...                 drewFinal = int(round(drew))
...                 win32api.mouse_event(0x0001,drewFinal,ammountFinal)
...                 sleep(0.10)
...             count = count + 1
...             if count > 40:
...                 count = 0
...                 ammount = 0
...                 drew = 0
...         if win32api.GetAsyncKeyState(ord('0')):
...             print('Out')
...             EinAus = not EinAus
...             sleep(0.2)
...             break
...         sleep(0.1)
You see, it keeps saying that the module cannot be found. Thing is, it has always been installed and it was working before. Out of the blue this issue happened. Tried reinstalling, same issue. Odd issue and I'm out of ideas on how to fix it :/
Reply


Messages In This Thread
Win32API Troubles - by daaaabs - Mar-24-2020, 06:53 PM
RE: Win32API Troubles - by buran - Mar-24-2020, 07:03 PM
RE: Win32API Troubles - by daaaabs - Mar-24-2020, 08:19 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  troubles with tqdm max22 2 514 Nov-27-2023, 09:20 PM
Last Post: max22
  Installation troubles on Win 10 peringek 1 2,927 Dec-31-2020, 07:30 AM
Last Post: caleb_cruze
  Python win32api keybd_event: How do I input a string of characters? JaneTan 3 3,804 Oct-19-2020, 04:16 AM
Last Post: deanhystad
  converting user input to float troubles RecklessTechGuy 3 2,452 Aug-17-2020, 12:41 PM
Last Post: deanhystad
  csv troubles DPaul 4 2,335 Aug-13-2020, 05:18 PM
Last Post: DPaul
  local variable troubles yokaso 4 3,191 Oct-20-2019, 05:25 PM
Last Post: ichabod801
  how do i fix “No module named win32api” on python2.7 ? shongr2001 1 12,904 Apr-18-2019, 04:03 PM
Last Post: snippsat
  How to import win32api and win32con SheeppOSU 2 25,659 Feb-19-2019, 12:04 AM
Last Post: snippsat
  Troubles with instaling pocketsphinx Thais781 1 2,627 Aug-07-2018, 10:05 AM
Last Post: Larz60+
  Troubles with classes, taken from a book sylas 2 3,194 Jun-05-2017, 08:39 AM
Last Post: sylas

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020