redruin1 / factorio-draftsman

A complete, well-tested, and up-to-date module to manipulate Factorio blueprint strings. Compatible with mods.
MIT License
116 stars 19 forks source link

error loading FreightForwarding mod #70

Closed jshield closed 1 year ago

jshield commented 1 year ago

Cloned main down, updated factorio-data to "a7452ebca5ef4fa12f9e024be1fb5492fbb6d869 factorio-data (1.1.81)", installed stock FreightForwardingPack mod, no customized settings.

works correctly on 1.1.81 data without any mods installed.

and the resulting log occurs:


Discovering mods...

aai-vehicles-ironclad
auto-track-laying
beautiful_bridge_railway_Cargoships
big-mining-drill
bzlead
bztitanium
CanalBuilderMAV
cargo-ships-graphics
cargo-ships
ch-concentrated-solar
DeadlockLargerLamp
extended-descriptions
flib
FreightForwardingPack
FreightForwarding
Hovercrafts
IntermodalContainers
lex-aircraft
Long_Range_Delivery_Drones
Milestones
Mini_Trains
PlutoniumEnergy
RemoteConfiguration
simhelper
SpidertronEnhancements
SpidertronPatrols
TrainGroups
Train_Control_Signals
underwater-pipes
wret-beacon-rebalance-mod

Determining dependency tree...

aai-vehicles-ironclad 0.6.8
archive? True
dependencies:
           base >= 1.1.0
auto-track-laying 1.0.6
archive? True
dependencies:
           base >= 0.18
beautiful_bridge_railway_Cargoships 1.2.0
archive? True
dependencies:
           base >= 0.15
big-mining-drill 0.1.1
archive? True
dependencies:
           base >= 1.1.0
         ! aai-industry
bzlead 1.2.18
archive? True
dependencies:
           base >= 1.1.0
         ? bzsilicon
         ? space-exploration
         ? Krastorio2
         ? Rich-Rocks-Requiem
         ? 248k
         ? deadlock-beltboxes-loaders
         ? DeadlockCrating
bztitanium 1.2.12
archive? True
dependencies:
           base >= 1.0.0
         ? aai-industry
         ? space-exploration
         ? Krastorio2
         ? Rich-Rocks-Requiem
         ? FactorioExtended-Plus-Core
         ? Pre0-17-60Oil
         ? Deadlock-SE-bridge
         ? deadlock-beltboxes-loaders
         ? DeadlockCrating
         ? modmashsplinterresources
         ? EndgameCombat
         ? PowerArmorMK3
         ? 248k
         ! nullius
CanalBuilderMAV 2.0.3
archive? True
dependencies:
           base >= 1.0.0
         ! CanalBuilder
         ! CanalBuilder17
         ! CanalBuilder18
         ! CanalBuilder2
         ! CanalBuilderWLK
         ? Dectorio >= 0.12.5
cargo-ships-graphics 0.1.0
archive? True
dependencies:
           base >= 1.1
         ~ cargo-ships >= 0.1.0
cargo-ships 0.1.22
archive? True
dependencies:
           base >= 1.1
           cargo-ships-graphics >= 0.1.0
         ? factorio-world >= 1.0.2
         ? NewIslands >= 0.1.0
         ? islands_world >= 1.1.0
         ? SeaBlock >= 0.5.5
         ? Hovercraft >= 0.0.1
         ? Hovercrafts >= 1.1.0
         ? angelspetrochem >= 0.9.17
         ? ctg >= 0.4.3
         ? Krastorio2 >= 1.0.18
         ! cargo-ships-seraph
         ? rso-mod
ch-concentrated-solar 0.3.2
archive? True
dependencies:
           base >= 1.1
         ? Krastorio2
         ? space-exploration >= 0.3.0
         ? AAIIndustry
         ? gvv
DeadlockLargerLamp 1.5.0
archive? True
dependencies:
           base >= 1.1.0
         ? Dectorio
extended-descriptions 1.1.0
archive? True
dependencies:
           base >= 1.1.74
         ? pypostprocessing
         ? deadlock-beltboxes-loaders
         ? angelsrefining
         ? angelspetrochem
         ? pyindustry
         ? FlareStack
         ? space-exploration
flib 0.12.7
archive? True
dependencies:
           base >= 1.1.80
FreightForwardingPack 1.2.0
archive? True
dependencies:
           base
         ~ FreightForwarding
           auto-track-laying
           RemoteConfiguration
           extended-descriptions
           TrainGroups
           Train_Control_Signals
           Milestones
           Long_Range_Delivery_Drones
           aai-vehicles-ironclad
           big-mining-drill
           wret-beacon-rebalance-mod
           DeadlockLargerLamp
           PlutoniumEnergy
           ch-concentrated-solar
         ? PowerOverload
FreightForwarding 1.6.2
archive? True
dependencies:
           base > 1.1.60
           IntermodalContainers
           cargo-ships
           Mini_Trains
           SpidertronPatrols >= 2.4.3
           lex-aircraft
           Hovercrafts
           bzlead
           bztitanium
           CanalBuilderMAV
           underwater-pipes
           beautiful_bridge_railway_Cargoships
         ? FreightForwardingPack
         ? auto-track-laying
         ? Milestones
         ? aai-vehicles-ironclad
         ? big-mining-drill
         ? PlutoniumEnergy
         ? ch-concentrated-solar
         ? Transport_Drones
         ? trainConstructionSite
         ? Mining-Space-Industries-II
         ? Krastorio2
         ! XenosFreightForwardingLandfillFix
         ! boblogistics
         ! DeadlockCrating
         ! IslandStart
         ! rso-mod
         ! space-exploration
         ! IndustrialRevolution3
         ! nullius
         ! pypostprocessing
Hovercrafts 1.2.2
archive? True
dependencies:
           base >= 1.1.0
         ? laser_tanks_updated >= 0.19.0
         ? laser_tanks > 0.18.15
         ? space-exploration
IntermodalContainers 2.0.1
archive? True
dependencies:
           base
         ? ReStack
         ! DeadlockCrating
lex-aircraft 1.1.0
archive? True
dependencies:
           base >= 1.1.0
         ? SpidertronEnhancements >= 1.8.6
         ? SpidertronPatrols >= 2.2.6
         ? aai-programmable-structures >= 0.7.4
         ? aai-programmable-vehicles >= 0.7.22
         ? space-exploration >= 0.6.81
         ? Krastorio2 >= 1.3.4
Long_Range_Delivery_Drones 1.0.6
archive? True
dependencies:
           base >= 1.1.62
Milestones 1.3.17
archive? True
dependencies:
           base >= 1.1.60
           flib >= 0.7.0
Mini_Trains 1.0.0
archive? True
dependencies:
           base
PlutoniumEnergy 1.4.6
archive? True
dependencies:
           base >= 1.1.0
         ? AtomicArtillery >= 0.2.1
         ? SchallUraniumProcessing
         ? SchallArtillery >= 1.0.0
         ? SchallRadioactiveWaste
         ? bobplates
         ? bobwarfare
         ? AtomicRocketScreenBurn
         ? IndustrialRevolution >= 2.0.0
         ? space-exploration
RemoteConfiguration 1.2.2
archive? True
dependencies:
           base
         ? WireShortcutX
         ? informatron
simhelper 1.1.4
archive? True
dependencies:
SpidertronEnhancements 1.8.16
archive? True
dependencies:
           base >= 1.1.60
           simhelper >= 1.1.2
         ? RemoteConfiguration
         ? SpidertronWaypoints >= 1.7.2
         ? SpidertronWeaponSwitcher >= 1.2.2
         ? spidertron-grid
         ? aai-vehicles-ironclad
SpidertronPatrols 2.4.3
archive? True
dependencies:
           base >= 1.1.72
           SpidertronEnhancements >= 1.8.14
         ? SpidertronWeaponSwitcher >= 1.2.0
         ? nullius
TrainGroups 1.3.5
archive? True
dependencies:
           base >= 1.1.80
           flib >= 0.12.6
         ? Train_Control_Signals
         ? TrainScheduleSignals
Train_Control_Signals 1.0.6
archive? True
dependencies:
           base >= 1.1.7
underwater-pipes 2.0.3
archive? True
dependencies:
           base
wret-beacon-rebalance-mod 1.0.15
archive? True
dependencies:
           base
         ! beacon-overhaul
         ! beacon-interference
         ! space-exploration
         ? FactorioExtended-Plus-Module
         ? Krastorio2
         ? PickerDollies
         ? bobmodules
         ? SeaBlock

Load order:
['base', 'simhelper', 'CanalBuilderMAV', 'DeadlockLargerLamp', 'Hovercrafts', 'IntermodalContainers', 'Long_Range_Delivery_Drones', 'Mini_Trains', 'PlutoniumEnergy', 'RemoteConfiguration', 'Train_Control_Signals', 'aai-vehicles-ironclad', 'auto-track-laying', 'beautiful_bridge_railway_Cargoships', 'big-mining-drill', 'bzlead', 'bztitanium', 'cargo-ships-graphics', 'ch-concentrated-solar', 'extended-descriptions', 'flib', 'underwater-pipes', 'wret-beacon-rebalance-mod', 'Milestones', 'TrainGroups', 'cargo-ships', 'SpidertronEnhancements', 'SpidertronPatrols', 'lex-aircraft', 'FreightForwardingPack', 'FreightForwarding']

SETTINGS.LUA:
        mod: CanalBuilderMAV
        mod: Hovercrafts
        mod: IntermodalContainers
        mod: PlutoniumEnergy
        mod: RemoteConfiguration
        mod: beautiful_bridge_railway_Cargoships
        mod: bzlead
        mod: bztitanium
        mod: ch-concentrated-solar
        mod: wret-beacon-rebalance-mod
        mod: Milestones
        mod: cargo-ships
        mod: SpidertronEnhancements
        mod: SpidertronPatrols
        mod: lex-aircraft
        mod: FreightForwarding
LUA:    FreightForwarding
LUA:    FreightForwarding
SETTINGS-UPDATES.LUA:
        mod: cargo-ships
SETTINGS-FINAL-FIXES.LUA:
DATA.LUA:
        mod: base
        mod: CanalBuilderMAV
        mod: DeadlockLargerLamp
        mod: Hovercrafts
        mod: IntermodalContainers
        mod: Long_Range_Delivery_Drones
LUA:    Long_Range_Delivery_Drones
LUA:    Long_Range_Delivery_Drones
        mod: Mini_Trains
LUA:    Mini_Trains
        mod: PlutoniumEnergy
        mod: RemoteConfiguration
        mod: Train_Control_Signals
        mod: aai-vehicles-ironclad
        mod: beautiful_bridge_railway_Cargoships
        mod: big-mining-drill
        mod: bzlead
LUA:    bzlead
LUA:    bzlead
LUA:    bzlead
        mod: bztitanium
LUA:    bztitanium
LUA:    bztitanium
LUA:    bztitanium
        mod: ch-concentrated-solar
        mod: flib
LUA:    flib
        mod: underwater-pipes
        mod: wret-beacon-rebalance-mod
        mod: Milestones
LUA:    flib
        mod: TrainGroups
        mod: cargo-ships
LUA:    cargo-ships
LUA:    cargo-ships
LUA:    cargo-ships
LUA:    cargo-ships
LUA:    cargo-ships
LUA:    cargo-ships
LUA:    cargo-ships
LUA:    cargo-ships
LUA:    cargo-ships
LUA:    cargo-ships
LUA:    cargo-ships
LUA:    cargo-ships
LUA:    cargo-ships
LUA:    cargo-ships
        mod: SpidertronEnhancements
LUA:    simhelper
        mod: SpidertronPatrols
        mod: lex-aircraft
LUA:    lex-aircraft
LUA:    lex-aircraft
LUA:    lex-aircraft
        mod: FreightForwarding
LUA:    FreightForwarding
LUA:    FreightForwarding
LUA:    FreightForwarding
LUA:    FreightForwarding
LUA:    bzlead
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\ProgramData\scoop\apps\python\3.11.3\Scripts\draftsman-update.exe\__main__.py", line 7, in <module>
  File "C:\ProgramData\scoop\apps\python\3.11.3\Lib\site-packages\draftsman\env.py", line 1823, in main
    update(
  File "C:\ProgramData\scoop\apps\python\3.11.3\Lib\site-packages\draftsman\env.py", line 1757, in update
    load_stage(lua, mods, mod, stage)
  File "C:\ProgramData\scoop\apps\python\3.11.3\Lib\site-packages\draftsman\env.py", line 267, in load_stage
    lua.execute(mod.data[stage])
  File "lupa\lua52.pyx", line 412, in lupa.lua52.LuaRuntime.execute
  File "lupa\lua52.pyx", line 1736, in lupa.lua52.run_lua
  File "lupa\lua52.pyx", line 1750, in lupa.lua52.call_lua
  File "lupa\lua52.pyx", line 1776, in lupa.lua52.execute_lua_call
  File "lupa\lua52.pyx", line 1665, in lupa.lua52.raise_lua_error
lupa.lua52.LuaError: [string "<python>"]:179: module 'me' not found:no file 'me' found in 'FreightForwarding' archive
        no field package.preload['me']
        no file './factorio-mods/FreightForwarding//me.lua'
        no file './factorio-mods/bzlead/me.lua'
        no file './factorio-mods/FreightForwarding/prototypes/me.lua'
        no file './factorio-mods/FreightForwarding\me.lua'
        no file 'me.lua'
        no file 'C:\ProgramData\scoop\apps\python\3.11.3\Lib\site-packages\draftsman\factorio-data\core\me.lua'
        no file 'C:\ProgramData\scoop\apps\python\3.11.3\Lib\site-packages\draftsman\factorio-data\core\lualib\me.lua'
        no file 'C:\ProgramData\scoop\apps\python\3.11.3\Lib\site-packages\draftsman\me.lua'
        no file 'C:\ProgramData\scoop\apps\python\3.11.3\lua\me.lua'
        no file 'C:\ProgramData\scoop\apps\python\3.11.3\lua\me\init.lua'
        no file 'C:\ProgramData\scoop\apps\python\3.11.3\me.lua'
        no file 'C:\ProgramData\scoop\apps\python\3.11.3\me\init.lua'
        no file '.\me.lua'
        no file 'C:\ProgramData\scoop\apps\python\3.11.3\me.dll'
        no file 'C:\ProgramData\scoop\apps\python\3.11.3\loadall.dll'
        no file '.\me.dll'
stack traceback:
        [string "<python>"]:3: in main chunk
        [string "<python>"]:179: in function 'require'
        [C]: in function 'old_require'
        [string "./factorio-mods/FreightForwarding/prototypes/..."]:2: in main chunk
        [string "<python>"]:179: in function 'require'
        [C]: in function 'old_require'
        [string "./factorio-mods/bzlead/data-util"]:5: in main chunk
        [string "<python>"]:179: in function 'require'
        [C]: in function 'old_require'

EDIT: fixed formatting

{
  "mods":
  [

    {
      "name": "base",
      "enabled": true
    },

    {
      "name": "aai-vehicles-ironclad",
      "enabled": true
    },

    {
      "name": "auto-track-laying",
      "enabled": true
    },

    {
      "name": "beautiful_bridge_railway_Cargoships",
      "enabled": true
    },

    {
      "name": "big-mining-drill",
      "enabled": true
    },

    {
      "name": "bzlead",
      "enabled": true
    },

    {
      "name": "bztitanium",
      "enabled": true
    },

    {
      "name": "CanalBuilderMAV",
      "enabled": true
    },

    {
      "name": "cargo-ships",
      "enabled": true
    },

    {
      "name": "cargo-ships-graphics",
      "enabled": true
    },

    {
      "name": "ch-concentrated-solar",
      "enabled": true
    },

    {
      "name": "DeadlockLargerLamp",
      "enabled": true
    },

    {
      "name": "extended-descriptions",
      "enabled": true
    },

    {
      "name": "flib",
      "enabled": true
    },

    {
      "name": "FreightForwarding",
      "enabled": true
    },

    {
      "name": "FreightForwardingPack",
      "enabled": true
    },

    {
      "name": "Hovercrafts",
      "enabled": true
    },

    {
      "name": "IntermodalContainers",
      "enabled": true
    },

    {
      "name": "lex-aircraft",
      "enabled": true
    },

    {
      "name": "Long_Range_Delivery_Drones",
      "enabled": true
    },

    {
      "name": "Milestones",
      "enabled": true
    },

    {
      "name": "Mini_Trains",
      "enabled": true
    },

    {
      "name": "PlutoniumEnergy",
      "enabled": true
    },

    {
      "name": "RemoteConfiguration",
      "enabled": true
    },

    {
      "name": "simhelper",
      "enabled": true
    },

    {
      "name": "SpidertronEnhancements",
      "enabled": true
    },

    {
      "name": "SpidertronPatrols",
      "enabled": true
    },

    {
      "name": "TrainGroups",
      "enabled": true
    },

    {
      "name": "Train_Control_Signals",
      "enabled": true
    },

    {
      "name": "underwater-pipes",
      "enabled": true
    },

    {
      "name": "wret-beacon-rebalance-mod",
      "enabled": true
    }
  ]
}
aai-vehicles-ironclad_0.6.8.zip
auto-track-laying_1.0.6.zip
beautiful_bridge_railway_Cargoships_1.2.0.zip
big-mining-drill_0.1.1.zip
bzlead_1.2.18.zip
bztitanium_1.2.12.zip
CanalBuilderMAV_2.0.3.zip
cargo-ships_0.1.22.zip
cargo-ships-graphics_0.1.0.zip
ch-concentrated-solar_0.3.2.zip
DeadlockLargerLamp_1.5.0.zip
extended-descriptions_1.1.0.zip
flib_0.12.7.zip
FreightForwarding_1.6.2.zip
FreightForwardingPack_1.2.0.zip
Hovercrafts_1.2.2.zip
IntermodalContainers_2.0.1.zip
lex-aircraft_1.1.0.zip
Long_Range_Delivery_Drones_1.0.6.zip
Milestones_1.3.17.zip
Mini_Trains_1.0.0.zip
mod-list.json
mod-settings.dat
PlutoniumEnergy_1.4.6.zip
RemoteConfiguration_1.2.2.zip
simhelper_1.1.4.zip
SpidertronEnhancements_1.8.16.zip
SpidertronPatrols_2.4.3.zip
Train_Control_Signals_1.0.6.zip
TrainGroups_1.3.5.zip
underwater-pipes_2.0.3.zip
wret-beacon-rebalance-mod_1.0.15.zip
redruin1 commented 1 year ago

Turns out this is because while I allow files to require files from different mods, those required files "forget" that they're in a different mod archive, so if those files try to require additional files, it will attempt to load them from an entirely different archive and predictably fail. So (despite my best efforts) I do need to keep a persistent tree of the current mod/file and handle entering and exiting their scope. I'll try and get to that this weekend.

redruin1 commented 1 year ago

Alright, this is now fixed. Now behaves successfully with the FreightForwarding pack as described, and I cross-checked it against Space Exploration which still works, so ideally there should be no regression issues with any other mod. In the process I also fixed an issue where Lua require paths with a prepended dot or slash wouldn't be resolved correctly, which is also now fixed. I'll probably push 1.0.4 to PYPI once I get it cleaned up in a little bit.