speth / planetary-annihilation-db

Unit Database for Planetary Annihilation
MIT License
5 stars 4 forks source link

Fails to parse Legion Expansion mod units #6

Closed Quitch closed 8 years ago

Quitch commented 8 years ago

I'm trying to use this to provide me an easy way to examine stats from the Legion Expansion mod.

I've used two padb.json setups:

{
    "pa_root": "C:/Program Files (x86)/Steam/steamapps/common/Planetary Annihilation Titans/media",
    "mods_root": "C:/Users/username/AppData/Local/Uber Entertainment/Planetary Annihilation/server_mods",
    "versions": []
}
{
    "pa_root": "C:/Users/username/Documents/GitHub/Legion-Expansion",
    "versions": []
}

The first worked correctly, but loading the Legion server mod did not result in the units being added to the unit list.

The second starts the web server correctly, but then errors when units.py tries to parse the unit files:

Error: 500 Internal Server Error

Sorry, the requested URL 'http://localhost:8080/' caused an error:

Internal Server Error
Exception:

AttributeError("'tuple' object has no attribute 'add'",)
Traceback:

Traceback (most recent call last):
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\bottle.py", line 764, in _handle
    return route.call(**args)
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\bottle.py", line 1575, in wrapper
    rv = callback(*a, **ka)
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\webunits.py", line 228, in callback
    db = get_db()
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\webunits.py", line 199, in get_db
    LOADED_DBS[key] = WebUnits(version, mods)
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\webunits.py", line 69, in __init__
    self.load_units()
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\units.py", line 194, in load_units
    self.apply_corrections()
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\units.py", line 207, in apply_corrections
    self.units['titan_structure'].unit_types.add('Titan')
AttributeError: 'tuple' object has no attribute 'add'
speth commented 8 years ago

Method 1 should work correctly now. I'm not sure whether or not it makes any sense to expect method 2 to work at all.

Quitch commented 8 years ago

Updated to latest version, now method 1 results in the same error as method 2

Error: 500 Internal Server Error

Sorry, the requested URL 'http://localhost:8080/?version=current:com.pa.legion-expansion.server' caused an error:

Internal Server Error
Exception:

AttributeError("'tuple' object has no attribute 'add'",)
Traceback:

Traceback (most recent call last):
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\bottle.py", line 764, in _handle
    return route.call(**args)
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\bottle.py", line 1575, in wrapper
    rv = callback(*a, **ka)
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\webunits.py", line 228, in callback
    db = get_db()
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\webunits.py", line 199, in get_db
    LOADED_DBS[key] = WebUnits(version, mods)
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\webunits.py", line 69, in __init__
    self.load_units()
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\units.py", line 190, in load_units
    self.apply_corrections()
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\units.py", line 203, in apply_corrections
    self.units['titan_structure'].unit_types.add('Titan')
AttributeError: 'tuple' object has no attribute 'add'
speth commented 8 years ago

I wasn't able to immediately reproduce this. Are you getting this error using the master branch of the Legion-Expansion repo, or is there a different branch that I can check out that exhibits this behavior?

efitzkiwi commented 8 years ago

I was able to run it fine with Legion Expansion. @Quitch the "Mods" dropdown menu will display your list of server mods.

Quitch commented 8 years ago

I've tried with both master and balance branches, same issue with both for me. I'm running Python 3.5.1 (x64)

Quitch commented 8 years ago

Full console output based on Legion-Expansion-Server (generated by running split_into_mods.py from the Legion-Expansion root folder). This is using the master branch current as of this time.

C:\Users\username\Documents\GitHub\planetary-annihilation-db-master>webunits.py
Bottle v0.11.6 server starting up (using WSGIRefServer())...
Listening on http://localhost:8080/
Hit Ctrl-C to quit.

loading DB for current
Unhandled ammo source 'factory' for /pa/units/land/anti_nuke_launcher/anti_nuke_launcher_tool_weapon.json
Unhandled ammo source 'factory' for /pa/units/land/nuke_launcher/nuke_launcher_tool_weapon.json
Unhandled ammo source 'factory' for /pa/units/land/unit_cannon/unit_cannon_tool_weapon.json
Unknown spawn layer: WL_Underwater
Unknown spawn layer: WL_Underwater
127.0.0.1 - - [23/Feb/2016 19:52:40] "GET / HTTP/1.1" 200 16385
loading DB for current:com.pa.legion-expansion.server
failed to load '/pa/units/orbital/orbital_probe/orbital_probe.json' (version current)
Unhandled ammo source 'time' for /pa/units/air/L_fighter_adv/L_fighter_adv_rocket_tool_weapon.json
Unhandled ammo source 'factory' for /pa/units/land/anti_nuke_launcher/anti_nuke_launcher_tool_weapon.json
Unhandled ammo source 'factory' for /pa/units/land/anti_nuke_launcher/anti_nuke_launcher_tool_weapon.json
Unhandled ammo source 'time' for /pa/units/land/L_bot_artillery/L_bot_artillery_tool_weapon.json
Unhandled ammo source 'time' for /pa/units/land/L_bot_artillery/bomb/bomb_tool_weapon.json
Unhandled ammo source 'factory' for /pa/units/land/nuke_launcher/nuke_launcher_tool_weapon.json
Unhandled ammo source 'factory' for /pa/units/land/L_nuke_launcher/L_nuke_launcher_tool_weapon.json
failed to load '/pa/units/land/tank_hover/tank_hover.json' (version current)
Unhandled ammo source 'time' for /pa/units/land/L_hover_tank_adv/L_hover_tank_adv_tool_weapon.json
Unhandled ammo source 'factory' for /pa/units/land/unit_cannon/unit_cannon_tool_weapon.json
Unknown spawn layer: WL_Underwater
Unknown spawn layer: WL_Underwater
Unhandled ammo source 'time' for /pa/units/sea/L_attack_sub/L_attack_sub_tool_weapon.json
Unknown spawn layer: WL_Underwater
Unhandled ammo source 'time' for /pa/units/sea/L_missile_ship/L_missile_ship_rocket_tool_weapon.json
Unknown spawn layer: WL_Underwater
failed to load '/pa/units/land/titan_bot/titan_bot.json' (version current)
Unhandled ammo source 'time' for /pa/units/land/L_titan_bot/L_titan_bot_rocket_tool_weapon.json
failed to load '/pa/units/land/titan_bot/titan_bot_ammo_death.json' (version current)
failed to load '/pa/units/air/titan_air/titan_air.json' (version current)
failed to load '/pa/units/land/titan_vehicle/titan_vehicle.json' (version current)
failed to load '/pa/units/orbital/titan_orbital/titan_orbital.json' (version current)
failed to load '/pa/units/land/titan_structure/titan_structure.json' (version current)
failed to load '/pa/units/land/bot_tesla/bot_tesla.json' (version current)
failed to load '/pa/units/land/bot_nanoswarm/bot_nanoswarm.json' (version current)
failed to load '/pa/units/land/bot_support_commander/bot_support_commander.json' (version current)
failed to load '/pa/units/land/tank_flak/tank_flak.json' (version current)
Unhandled ammo source 'time' for /pa/units/land/L_tank_swarm/L_tank_swarm_tool_weapon.json
Unhandled ammo source 'time' for /pa/units/land/L_tank_swarm/chain/chain_death_tool_weapon.json
failed to load '/pa/units/land/tank_nuke/tank_nuke.json' (version current)
failed to load '/pa/units/air/solar_drone/solar_drone.json' (version current)
failed to load '/pa/units/air/bomber_heavy/bomber_heavy.json' (version current)
failed to load '/pa/units/air/support_platform/support_platform.json' (version current)
failed to load '/pa/units/sea/fabrication_barge/fabrication_barge.json' (version current)
failed to load '/pa/units/sea/drone_carrier/carrier/carrier.json' (version current)
failed to load '/pa/units/sea/drone_carrier/drone/drone.json' (version current)
failed to load '/pa/units/sea/hover_ship/hover_ship.json' (version current)
failed to load '/pa/units/orbital/orbital_battleship/orbital_battleship.json' (version current)
failed to load '/pa/units/orbital/orbital_railgun/orbital_railgun.json' (version current)
failed to load '/pa/units/land/artillery_unit_launcher/artillery_unit_launcher.json' (version current)
failed to load '/pa/units/air/titan_air/titan_air_ammo_death.json' (version current)
failed to load '/pa/units/land/titan_vehicle/titan_vehicle_ammo_death.json' (version current)
failed to load '/pa/units/orbital/titan_orbital/titan_orbital_tool_weapon_orbital.json' (version current)
failed to load '/pa/units/land/titan_structure/titan_structure_tool_weapon.json' (version current)
Traceback (most recent call last):
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\bottle.py", line 764, in _handle
    return route.call(**args)
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\bottle.py", line 1575, in wrapper
    rv = callback(*a, **ka)
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\webunits.py", line 228, in callback
    db = get_db()
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\webunits.py", line 199, in get_db
    LOADED_DBS[key] = WebUnits(version, mods)
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\webunits.py", line 69, in __init__
    self.load_units()
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\units.py", line 190, in load_units
    self.apply_corrections()
  File "C:\Users\username\Documents\GitHub\planetary-annihilation-db-master\units.py", line 203, in apply_corrections
    self.units['titan_structure'].unit_types.add('Titan')
AttributeError: 'tuple' object has no attribute 'add'
127.0.0.1 - - [23/Feb/2016 19:52:53] "GET /?version=current:com.pa.legion-expansion.server HTTP/1.1" 500 2184

padb.json

{
    "pa_root": "C:/Program Files (x86)/Steam/steamapps/common/Planetary Annihilation Titans/media",
    "mods_root": "C:/Users/username/AppData/Local/Uber Entertainment/Planetary Annihilation/server_mods",
    "versions": []
}

Screenshot prior to selecting mod

clipboard01

Quitch commented 8 years ago

Another colleague pointed out my padb.json was missing "expansion": "pa_ex1". I updated the file to look like below and this now works correctly!

{
    "pa_root": "C:/Program Files (x86)/Steam/steamapps/common/Planetary Annihilation Titans/media",
    "expansion": "pa_ex1",
    "mods_root": "C:/Users/username/AppData/Local/Uber Entertainment/Planetary Annihilation/server_mods",
    "versions": []
}