fonsleenaars / tqdb

Python parser for the Titan Quest Anniversary Edition, Ragnarok, Atlantis, Eternal Ember DLC database.
https://tq-db.net
MIT License
50 stars 15 forks source link

Can't run run.py and prepare.py can't find game directory #57

Closed chefranov closed 4 years ago

chefranov commented 5 years ago

Hi. I installed python on windows. I tryed to run your script prepare.py but your script can't find game directory screenshot_2 But i have the entry in registry screenshot_3

After that I tried run manually your script. I ran run.py but also errors screenshot_4

Can you help me?

fonsleenaars commented 5 years ago

Oops! You still have to execute this step from the manual setup:

Python Python 3.6 or higher and Pipenv are required to run this project. To get started with a clean setup, open up a shell, navigate to your local repository, and run:

pipenv clean pipenv install

I will update the documentation to include this mandatory setup step!

chefranov commented 5 years ago

When I run pipenv clean screenshot_5

fonsleenaars commented 5 years ago

Powershell seems to not recognize Python as being installed.

Can you try just typing python in your Powershell and see if it recognizes that command?

chefranov commented 5 years ago

screenshot_6

fonsleenaars commented 5 years ago

A yeah, so exit out of that by typing exit() and then type pip install --user pipenv

chefranov commented 5 years ago

Done screenshot_7 Next actions?

fonsleenaars commented 5 years ago

pipenv clean pipenv install

Then autoinstaller again

chefranov commented 5 years ago

screenshot_8

The same errors :(

fonsleenaars commented 5 years ago

I can help you later, still at work atm, sorry! I'll look at it tonight my time.

fonsleenaars commented 5 years ago

You might have to try running a regular command prompt, instead of powershell, and see if pipenv clean will run there. I think Powershell isn't loading pip loaded packages or something, I'm not sure.

chefranov commented 5 years ago

The same problem: pipenv is not command

fonsleenaars commented 5 years ago

Ok, in that command prompt: pip install pipenv, then pipenv clean and pipenv install again. We'll get there!

chefranov commented 5 years ago

screenshot_1 Maybe Do I need to add something to PATH?

fonsleenaars commented 5 years ago

That should have happened when you setup Python, but I think they're not on the PATH at the moment. So yes, although you might want to google for "installing pipenv on Windows" and "PATH" in that query somewhere ;-)

I'm at work again (I live in the US now) so I'll be slower to respond.

chefranov commented 5 years ago

I fixed error, but now I have new issue :) screenshot_2

fonsleenaars commented 5 years ago

Haha, wow I wasn't aware that 3.7 would check-fail 3.6, that's odd. I think you can just try running pipenv install and then running the autosetup again.

chefranov commented 5 years ago

A lot of errors screenshot_3

fonsleenaars commented 5 years ago

Try installing the packages in the Pipfile manually:

pipenv install numexpr Pillow pytest

chefranov commented 5 years ago

The same errors

fonsleenaars commented 5 years ago

Hm, what about pip install numexp Pillow pytest ?

chefranov commented 5 years ago

screenshot_4

fonsleenaars commented 5 years ago

Was that pip or pipenv install, that last screenshot? I don't see the pip but maybe I'm blind.

chefranov commented 5 years ago

ohh, it was my mistake screenshot_5

fonsleenaars commented 5 years ago

Ah cool, so that works. Try the auto setup again now , python prepare.py

chefranov commented 5 years ago

about prepare.py i wrote in first message. Script can't find game directory but directory exist

fonsleenaars commented 5 years ago

Open up prepare.py in your editor and edit these lines:

def tqdb_prepare():
    # Open the TQAE key and grab the install location:
    try:
        tqae_key = winreg.OpenKey(
            winreg.HKEY_LOCAL_MACHINE, LOOKUP_KEY, 0, winreg.KEY_READ)
        install = winreg.QueryValueEx(tqae_key, 'InstallLocation')[0]
    except WindowsError:
        print('Could not find installation directory for Titan Quest')
        return

Add the exception the the except clause and print by changing that line to:

    except WindowsError as we:
        print('Could not find installation directory for Titan Quest')
        print(we)

        return

Then run the file again.

chefranov commented 5 years ago

Here is https://stackoverflow.com/questions/46041719/windows-reports-error-when-trying-to-install-package-using-pipenv how to fix issue with pipenv on Windows

chefranov commented 5 years ago
C:\tqdb>python prepare.py
Could not find installation directory for Titan Quest
[WinError 2] Не удается найти указанный файл // can't find file
fonsleenaars commented 5 years ago

Ah! I think this might have something to do with 32 vs 64-bit systems.

Can you update this line in prepare.py:

tqae_key = winreg.OpenKey(
            winreg.HKEY_LOCAL_MACHINE, LOOKUP_KEY, 0, winreg.KEY_READ)
        install = winreg.QueryValueEx(tqae_key, 'InstallLocation')[0]

To be:

tqae_key = winreg.OpenKey(
            winreg.HKEY_LOCAL_MACHINE, LOOKUP_KEY, 0, access=winreg.KEY_READ | winreg.KEY_WOW64_64KEY)
        install = winreg.QueryValueEx(tqae_key, 'InstallLocation')[0]

Then try again. If that doesn't work, change KEY_WOW64_64KEY to KEY_WOW64_32KEY in that update, then try one more time!

chefranov commented 5 years ago

In first case screenshot_6 In second case screenshot_7

fonsleenaars commented 5 years ago

Ok, I'll have to debug this further, there's something going on with accessing the registry, I don't know if that has to do with a 32 vs 64-bit install of Python or something else, but I'll have to see what's causing this unable to lookup file.

You can still try to run through the Manual setup, that does the same as the Automated setup, just takes more effort.

chefranov commented 5 years ago

Okay, thanks. In the evening I check Manual setup. And one more question. I read readme and there is mention that images of stuff is a sprite. How can I get separate images?

fonsleenaars commented 5 years ago

The parser creates a directory with all the images it then turns into a sprite, that it deletes at the end. I'll either add an option to not delete it, or show you where to turn off that delete from happening later.

chefranov commented 5 years ago

Yes, it will be cool

chefranov commented 5 years ago

And prepare.py work! Previous time it was my mistake. Work with it: winreg.HKEY_LOCAL_MACHINE, LOOKUP_KEY, 0, access=winreg.KEY_READ | winreg.KEY_WOW64_64KEY) What Do i need to do after prepare.py? After prepare.py I ran run.py but have these errors: screenshot_2

chefranov commented 5 years ago

Could you help me?

chefranov commented 5 years ago

Heeey?

fonsleenaars commented 5 years ago

Sorry! Work got really busy.

I remember running into some of those issues, but not these specific ones. I'll look into my logs later this week, sorry for the delay, busy busy! If we can't find a solution, maybe the quickest solution is to do some pair programming with Discord or something!

chefranov commented 5 years ago

Ok, thank you. I will waiting for you. Don't forget

fonsleenaars commented 5 years ago

Alright I've figured out a few things, it's a strange bug so I'm diving into it more this weekend, should have an update for you maybe Sunday.

fonsleenaars commented 5 years ago

Was traveling last 2 weeks, back home now.

Didn't get a solution that weekend I posted an update, trying again today & tomorrow!

chefranov commented 5 years ago

Okay