1hubert / genshin-dialogue-autoskip

A simple python script to automatically skip dialogue in Genshin Impact
MIT License
63 stars 23 forks source link

What do I do over here? it says no module named win32api #28

Closed Chrisseh21 closed 2 months ago

Chrisseh21 commented 11 months ago

When I run the batch file as administrator it opens up this and shows this

C:\Windows\System32>pushd "A:\genshin-dialogue-autoskip-main\"

A:\genshin-dialogue-autoskip-main>py ./autoskip_dialogue.py Traceback (most recent call last): File "A:\genshin-dialogue-autoskip-main\autoskip_dialogue.py", line 6, in from win32api import GetSystemMetrics ModuleNotFoundError: No module named 'win32api' Press any key to continue . . .

1hubert commented 11 months ago

Have you installed required modules with pip install -r requirements.txt?

If you already did, try running these commands consecutively:

pip uninstall pipywin32
pip uninstall pywin32
pip install pywin32
1hubert commented 11 months ago

Also, what's your python version? I use 3.12 with no such issues.

Carraraaa commented 11 months ago

I have the same issue as him, i am using 3.12, i installed the modules and ran the commands you listed, it still hasnt worked :(

1hubert commented 11 months ago

That's worrying. I'll look into it later.

win32api is only used to auto-detect the resolution of your monitor, so a lazy solution is to just get rid of it and input the resolution manually. To do it: 1) Open .env with notepad and write your screen's resolution like this:

WIDTH=1920
HEIGHT=1080

2) Delete lines:

Carraraaa commented 11 months ago

File "C:\Users\enzoc\Downloads\genshin-dialogue-autoskip-main\genshin-dialogue-autoskip-main\autoskip_dialogue.py", line 7, in import pyautogui ModuleNotFoundError: No module named 'pyautogui' Pressione qualquer tecla para continuar. . .

i'm pretty sure i downloaded PyAutoGUI

Requirement already satisfied: PyAutoGUI in c:\users\enzoc\appdata\local\packages\pythonsoftwarefoundation.python.3.12_qbz5n2kfra8p0\localcache\local-packages\python312\site-packages (0.9.54)

1hubert commented 11 months ago

It's likely that you have multiple python installations on your pc, and the one on which you've installed pyautogui is different than the one running the autoskip_dialogue.py.

Carraraaa commented 10 months ago

I made sure I installed the modules at the right python and the file that we removed win32api didnt work, but the original file did after i installed pillow! thanks for the help, that was probably the same issue Chrisseh21 had.

You should add Pillow to the requirements too!

1hubert commented 10 months ago

I'm glad you got it to work, @Carraraaa .

I'm not entirely convinced that Pillow was the missing component here. win32api and Pillow serve completely different purposes and never seen anyone else needing to install one of them for the other to work. In your PR, I've send a GIF showcasing that a clean Python 3.12 installation with the current set of requirements installed works just fine.

Have a nice day!

1hubert commented 10 months ago

@Chrisseh21 Try installing Pillow and let me know if it fixed the No module named 'win32api' error.

If it won't help, there may be many variables at play causing this error, so I've written a short guide on how to setup an isolated Anaconda environment: 1) Download and install Anaconda 2) Open Anaconda Prompt as Admin 3) Type the following commands line-by-line to set up a clean Python 3.12 environment with the bare minimum modules needed to work for the script:

cd Desktop
git clone https://github.com/1hubert/genshin-dialogue-autoskip.git
cd genshin-dialogue-autoskip
conda create -n skipper-env
conda activate skipper-env
conda install python=3.12
pip install -r requirements.txt
autoskip_dialogue.py

Here's how it looks like: presentation

Hope that helps.

Grimm0595 commented 10 months ago

sadly still produces the same error for me.

1hubert commented 10 months ago

@Grimm0595 You're saying that you still got the No module named 'win32api', after setting up the Anaconda environment?

Sorry, I'm really not sure what else might be causing that error.

Grimm0595 commented 10 months ago

yeah, sadly I made sure I followed the steps. thank you for the attempts I appreciate it tho!

thatboihoe commented 2 months ago

im not sure what im doing or how to start not sure if someone minds helping me

Grimm0595 commented 2 months ago

Okay so my issue was that I have been using a Python environment in a different location where it is installed this happened because I have been installing pips from left and right in both the Python panel and Anaconda so it created many Python versions that some are incompatible and incomplete. my fix was to go to whatever compiler you are using and experiment with the many python folders that are created there eventually I got the right environment for my program. ( I was using pycharm)

1hubert commented 2 months ago

im not sure what im doing or how to start not sure if someone minds helping me

@thatboihoe

1) Download Python from the official website and make sure to select "Add to PATH" during installation 2) Download the genshin-dialogue-autoskip script as zip (see the screenshot below) 3) Unzip the script (doesn't really matter where, but I recommend /Desktop for your convenience) 4) Open the folder, and in the file manager's search bar type cmd. A terminal should pop up 5) In the terminal, write pip install -r requirements.txt and wait until every required module installs 6) Right-click run.bat and select "Open as Administrator". You should see instructions on which keys activate/deactivate the script 7) In the game's settings, navigate to Settings > Other and set Auto-Play Story to Off

image

thatboihoe commented 2 months ago

Thank u bro imma try again in the morning, just never doen anything like this so idk how any of it works