Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asset conversion issue, AttributeError: 'NoneType' object has no attribute 'readable' #1557

Closed
FabioLolix opened this issue Oct 3, 2023 · 6 comments · Fixed by #1561
Closed
Labels
area: assets Involved with assets (images, sounds, ...) bug Behaving differently as it should behave lang: python Done in Python code

Comments

@FabioLolix
Copy link

Hello, using the program build from the latest commit on Arch Linux I wasn't able to convert the assets from 3 steam editions

I had only Age2HD installed, after the first try I performed a file check from steam, then downloaded the other 2 games but didn't work

I'm missing something?

(1) ~/.steam/steam/steamapps/common/Age2HD
(2) ~/.steam/steam/steamapps/common/AoE2DE
(3) ~/.steam/steam/steamapps/common/AoEDE
$ openage convert --force --source-dir /home/fabio/.steam/steam/steamapps/common/Age2HD
INFO [py] Looking for compatible games to convert...
INFO [py] Compatible game edition detected:
INFO [py]  * Age of Empires 2: HD Edition
INFO [py] converting metadata
INFO [py] using cached wrapper: /tmp/HDEDITION_empires2_x1_p1.dat.pickle
INFO [py] Starting conversion...
INFO [py] Extracting Genie data...
INFO [py] Creating API-like objects...
INFO [py] Linking API-like objects...
INFO [py] Generating auxiliary objects...
INFO [py] Creating nyan objects...
INFO [py] Creating requests for media export...
INFO [py] Starting export...
INFO [py] Dumping info file...
INFO [py] Dumping data files...
INFO [py] Exporting media files...
INFO [py] -- Exporting graphics files...
INFO [py] -- Exporting terrain files...
INFO [py] -- Exporting sound files...
INFO [py] Dumping metadata files...
INFO [py] asset conversion complete; asset version: 7
Traceback (most recent call last):
  File "/usr/sbin/openage", line 20, in <module>
    main()
  File "/usr/lib/python3.11/site-packages/openage/__main__.py", line 171, in main
    return args.entrypoint(args, cli.error)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/openage/convert/main.py", line 263, in main
    convert_assets(outdir, args, srcdir)
  File "/usr/lib/python3.11/site-packages/openage/convert/main.py", line 129, in convert_assets
    with asset_locations_path.open("a") as file_obj:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/openage/util/fslike/path.py", line 133, in open
    return TextIOWrapper(handle)
           ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'readable'
$ openage convert
  Do you want to convert assets? [Y/n]
> y

Please select an Age of Empires installation directory.
Insert the index of one of the proposals, or any path:
(0) 
(1) ~/.steam/steam/steamapps/common/Age2HD
(2) ~/.steam/steam/steamapps/common/AoE2DE
(3) ~/.steam/steam/steamapps/common/AoEDE
> 2
converting from '/home/fabio/.local/share/Steam/steamapps/common/AoE2DE'
INFO [py] Looking for compatible games to convert...
INFO [py] Compatible game edition detected:
INFO [py]  * Age of Empires 2: Definitive Edition
INFO [py] converting metadata
INFO [py] Starting conversion...
INFO [py] Extracting Genie data...
INFO [py] Creating API-like objects...
INFO [py] Linking API-like objects...
INFO [py] Generating auxiliary objects...
INFO [py] Creating nyan objects...
WARN [py] Could not create upgrade from unit 1755 to 330
WARN [py] Could not create upgrade from unit 1755 to 207
WARN [py] Could not create upgrade from unit 68 to 1734
WARN [py] Could not create upgrade from unit 129 to 1734
WARN [py] Could not create upgrade from unit 130 to 1734
WARN [py] Could not create upgrade from unit 131 to 1734
INFO [py] Creating requests for media export...
INFO [py] Starting export...
INFO [py] Dumping info file...
INFO [py] Dumping data files...
INFO [py] Exporting media files...
INFO [py] -- Exporting graphics files...
INFO [py] Dumping metadata files...
INFO [py] asset conversion complete; asset version: 7
Traceback (most recent call last):
  File "/usr/sbin/openage", line 20, in <module>
    main()
  File "/usr/lib/python3.11/site-packages/openage/__main__.py", line 171, in main
    return args.entrypoint(args, cli.error)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/openage/convert/main.py", line 263, in main
    convert_assets(outdir, args, srcdir)
  File "/usr/lib/python3.11/site-packages/openage/convert/main.py", line 129, in convert_assets
    with asset_locations_path.open("a") as file_obj:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/openage/util/fslike/path.py", line 133, in open
    return TextIOWrapper(handle)
           ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'readable'

$ openage convert
  Do you want to convert assets? [Y/n]
> y

Please select an Age of Empires installation directory.
Insert the index of one of the proposals, or any path:
(0) 
(1) ~/.steam/steam/steamapps/common/Age2HD
(2) ~/.steam/steam/steamapps/common/AoE2DE
(3) ~/.steam/steam/steamapps/common/AoEDE
> 3
converting from '/home/fabio/.local/share/Steam/steamapps/common/AoEDE'
INFO [py] Looking for compatible games to convert...
INFO [py] Compatible game edition detected:
INFO [py]  * Age of Empires 1: Definitive Edition (Steam)
INFO [py] converting metadata
INFO [py] Starting conversion...
INFO [py] Extracting Genie data...
INFO [py] Creating API-like objects...
INFO [py] Linking API-like objects...
INFO [py] Generating auxiliary objects...
INFO [py] Creating nyan objects...
INFO [py] Creating requests for media export...
INFO [py] Starting export...
INFO [py] Dumping info file...
INFO [py] Dumping data files...
INFO [py] Exporting media files...
INFO [py] -- Exporting graphics files...
INFO [py] -- Exporting sound files...
INFO [py] Dumping metadata files...
INFO [py] asset conversion complete; asset version: 7
Traceback (most recent call last):
  File "/usr/sbin/openage", line 20, in <module>
    main()
  File "/usr/lib/python3.11/site-packages/openage/__main__.py", line 171, in main
    return args.entrypoint(args, cli.error)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/openage/convert/main.py", line 263, in main
    convert_assets(outdir, args, srcdir)
  File "/usr/lib/python3.11/site-packages/openage/convert/main.py", line 129, in convert_assets
    with asset_locations_path.open("a") as file_obj:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/openage/util/fslike/path.py", line 133, in open
    return TextIOWrapper(handle)
           ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'readable'

@heinezen heinezen added bug Behaving differently as it should behave lang: python Done in Python code area: assets Involved with assets (images, sounds, ...) labels Oct 3, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in openage converter Oct 3, 2023
@heinezen heinezen moved this from 📋 Backlog to 🔖 TODO in openage converter Oct 3, 2023
@heinezen
Copy link
Member

heinezen commented Oct 3, 2023

I think the file where we cache the paths may not be created yet when this is called, so the append operation fails.

@heinezen
Copy link
Member

heinezen commented Oct 3, 2023

I can't reproduce this on my machine, even when using the same commands as you. Maybe you could do some additional checks:

  • Can you run the tests with make test? This checks if file appending works correctly.
  • In the assets folder, can you check if the file assets/converted/assets_location.cache exists? This is the file that the converter is trying to write to. If it's not there, maybe creating it manually has an effect?
  • If the file exists, can you try to delete it and see if that changes anything?

@FabioLolix
Copy link
Author

Thanks for your reply

I have enabled tests but they haven't been found

==> Avvio di check() in corso...
Internal ctest changing into directory: /home/fabio/Dev/Github/PKGBUILD/openage-git/src/build
Test project /home/fabio/Dev/Github/PKGBUILD/openage-git/src/build
No tests were found!!!

and manually

$ make test
Running tests...
Test project /home/fabio/Dev/Github/PKGBUILD/openage-git/src/build
No tests were found!!!
[fabio@archlinux build]$ LANG=C make tests
make: *** No rule to make target 'tests'.  Stop.

exist assets/converted/assets_locations.cache, creating asset_location.cache change nothing

$ l
totale 4
-rw-r--r-- 1 fabio fabio    0  3 ott 23.52 asset_location.cache
-rw-r--r-- 1 fabio fabio    0  3 ott 23.52 asset_locations.cache
drwxr-xr-x 3 fabio fabio 4096  3 ott 23.52 hd_base

deleting all under assets/converted change nothing

@heinezen
Copy link
Member

heinezen commented Oct 4, 2023

@FabioLolix thanks for checking!

exist assets/converted/assets_locations.cache, creating asset_location.cache change nothing

I was looking for asset_locations.cache so I guess that filecould be created. Weird that it can't write to it then.

I think we could make the asset location cache optional as a temporary solution...

@heinezen
Copy link
Member

heinezen commented Oct 6, 2023

@FabioLolix Could you check if open("w") fixes the error?

@FabioLolix
Copy link
Author

Conversion now works, I only get a warning:

INFO [py] asset conversion complete; asset version: 7
WARN [py] Cannot access asset location cache file [Union(Path(Directory(/home/fabio/.local/share/openage), (b'assets',)) @ (), WriteBlocker(Directory(/usr/share/openage).root).root @ ())]:converted/asset_locations.cache
INFO [py] Skipped saving asset location

Still can't launch that there are other problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: assets Involved with assets (images, sounds, ...) bug Behaving differently as it should behave lang: python Done in Python code
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants