s2client-proto icon indicating copy to clipboard operation
s2client-proto copied to clipboard

Windows tempDir does not seem to work correctly

Open skjb opened this issue 7 years ago • 3 comments

I have a PySC2 script that creates a new game with a different map, plays, then repeats.

After around 100-120 games it crashes with the following error:

SC2APIProtocol.ResponseCreateGame.Error.InvalidMapData: 'temporary map 'C:\Users\Steven\AppData\Local\Temp\StarCraft II\TempLaunchMap.SC2Map' has invalid data.'

In https://github.com/deepmind/pysc2/blob/dev/pysc2/lib/sc_process.py#L66 it defines the tempDir as sc-* where * is a unique ID, however all of the temp files are instead inside StarCraft II as per the error message. The sc-* directories are created but are empty.

Inside the StarCraft II directory there are a series of TempKeyFrameP##, TempPortraitP## and TempWriteReplyP## directories, as well as a number of TempLaunchMap~##.SC2Map files. The numbering on the files goes from 00 to 99 and there is one with no number at all.

image

From my guess the number limit is reached and so the application crashes, maybe it is trying to copy the TempLaunchMap.SC2Map to a numbered file but can't, then it attempts to read the map and the data does not match the map it is expecting.

I have checked with @tewalds and in their Linux systems the sc-* directories are used correctly.

skjb avatar May 15 '18 00:05 skjb

Hello, I also encountered this problem, may I ask if you have solved it now? Please give me some advice, please

dmcyad avatar Jul 17 '24 13:07 dmcyad

你好,我已经解决了这个问题。我造成这个错误的原因是我每次循环都会把星际争霸2的端口关闭然后再重新启动,然而事实上,正确的写法应该是整个训练过程只启动一次星际争霸2的端口,也就是只要执行一次星际争霸2的构造函数。之后环境需要reset或者restart的话直接调用内部接口就可以,这样子不会造成缓存文件有100个然后报错的情况。希望我的经验能够帮助到你们

dmcyad avatar Jul 18 '24 09:07 dmcyad

@dmcyad 可以给出内部接口函数吗?找了半天没找到

yong-world avatar Nov 17 '24 07:11 yong-world