L0laapk3 / FactorioMaps

L0laapk3's FactorioMaps mod
https://mods.factorio.com/mod/L0laapk3_FactorioMaps
Other
119 stars 22 forks source link

Script hangs with other directory #43

Closed phi1010 closed 5 years ago

phi1010 commented 5 years ago

Environment: Windows 10 x64, Steam, Python 3.6.1, Factorio 0.17.50, Mod 3.4.0

With ModMyFactory, there is no mod directory, it is a symlink or junction instead, suggesting to unpack the script somewhere else, e.g. in %factoriodata%/mapper/%zipfilename%/ instead of %factoriodata%/mods/%zipfilename%/

In this case the auto.py script hangs waiting for the latest.txt to be created, even after factorio.exe is dead again (e.g. closed by user from the main menu).

I'd suggest adding a point 4.5 to the manual, telling users to wait for the game to start, hang and be killed -- and when the "Welcome to FactorioMaps, back to main menu" popup opens, something has gone wrong. Probably also to look out for a factorio console message, indicating that mapping has started -- if there is one.

L0laapk3 commented 5 years ago

Thanks for the report, can you verify that the output folder printed by auto.py corresponds with the actual path to script-output?

phi1010 commented 5 years ago

(PS: Calling from the mods/-directory despite the link works fine, just took a bit of time until it was finished.)

"../../script-output" seemed okay -- however, there was no latest.txt anywhere on my computer. Is the script-output also used as input, should there be a certain file created by python? The symlink to the script-output somewhere in the %TEMP% directory passed to Factorio also was functional when using the Explorer to navigate it.

L0laapk3 commented 5 years ago

the latest.txt is generated at https://github.com/L0laapk3/FactorioMaps/blob/06efafbc9aafdb2031fdc97c1855924f0978cf5f/control.lua#L138 , to (script-output relative to directory in %TEMP%) / FactorioMaps / savename / latest.txt . If factorio does not give an error report, it must be created somewhere :D

it goes trough the following steps:

  1. Creates a random directory FactorioMaps-xxxxxx in %TEMP%
  2. Creates config/config.ini file in there, passes that to factorio
  3. Factorio reads the config["path"]["write-data"] key (that points to the same random directory) and uses the script-output path relative to that.
  4. FactorioMaps / savename / latest.txt is created in control.lua before any screenshots are saved.
phi1010 commented 5 years ago

I think fm.autorun somehow was not set, since I got displayed this message: https://github.com/L0laapk3/FactorioMaps/blob/06efafbc9aafdb2031fdc97c1855924f0978cf5f/control.lua#L252

As said, it was due to a misconfiguration (although I don't know how that actually could cause it) -- thus I think it would be useful to tell users in the Manual/FAQ/DialogBox that the dialog box should not be shown upon correct configuration.

L0laapk3 commented 5 years ago

Okay, ill have a look at that, but you managed to get it working in the end? :D

phi1010 commented 5 years ago

I did, but having no error message (after some timeout) and no mention in the manual what I should wait for was a bit confusing.

L0laapk3 commented 5 years ago

I'll look into adding it.