google-deepmind / pysc2

StarCraft II Learning Environment
Apache License 2.0
8.03k stars 1.16k forks source link

run error in replay_actions #77

Closed pangzhenjia closed 7 years ago

pangzhenjia commented 7 years ago

Hi, I'm using win10 and python3.6. I have installed this package and can use the command " python pysc2.bin.play ..." to play as human or play replay. But, when I want to dumpped the actions from replay, I got the errors as follows:

python -m pysc2.bin.replay_actions --replays "D:\Blizzard App\StarCraft II\Replays\test"

Getting replay list: D:\Blizzard App\StarCraft II\Replays\test 1 replays found.

[0] Starting up a new SC2 instance. C:\Users\chensy\Desktop\pysc2 source\pysc2\lib\protocol.py:103: RuntimeWarning: Trying to access flag sc2_verbose before flags were parsed. This will raise an exception in the fut ure. if FLAGS.sc2_verbose: ERROR:root:Trying to access flag sc2_verbose before flags were parsed. Traceback (most recent call last): File "D:\Software\Anaconda\lib\site-packages\gflags\flagvalues.py", line 535, in getattr raise exceptions.UnparsedFlagAccessError(error_message) gflags.exceptions.UnparsedFlagAccessError: Trying to access flag sc2_verbose before flags were parsed. C:\Users\chensy\Desktop\pysc2 source\pysc2\lib\protocol.py:81: RuntimeWarning: Trying to access flag sc2_verbose before flags were parsed. This will raise an exception in the futu re. if FLAGS.sc2_verbose: ERROR:root:Trying to access flag sc2_verbose before flags were parsed. Traceback (most recent call last): File "D:\Software\Anaconda\lib\site-packages\gflags\flagvalues.py", line 535, in getattr raise exceptions.UnparsedFlagAccessError(error_message) gflags.exceptions.UnparsedFlagAccessError: Trying to access flag sc2_verbose before flags were parsed. C:\Users\chensy\Desktop\pysc2 source\pysc2\lib\protocol.py:85: RuntimeWarning: Trying to access flag sc2_verbose before flags were parsed. This will raise an exception in the futu re. if FLAGS.sc2_verbose: ERROR:root:Trying to access flag sc2_verbose before flags were parsed. Traceback (most recent call last): File "D:\Software\Anaconda\lib\site-packages\gflags\flagvalues.py", line 535, in getattr raise exceptions.UnparsedFlagAccessError(error_message) gflags.exceptions.UnparsedFlagAccessError: Trying to access flag sc2_verbose before flags were parsed. [0] SC2 Started successfully. ERROR:root:Trying to access flag sc2_verbose before flags were parsed. Traceback (most recent call last): File "D:\Software\Anaconda\lib\site-packages\gflags\flagvalues.py", line 535, in getattr raise exceptions.UnparsedFlagAccessError(error_message) gflags.exceptions.UnparsedFlagAccessError: Trying to access flag sc2_verbose before flags were parsed. ERROR:root:Trying to access flag sc2_verbose before flags were parsed. Traceback (most recent call last): File "D:\Software\Anaconda\lib\site-packages\gflags\flagvalues.py", line 535, in getattr raise exceptions.UnparsedFlagAccessError(error_message) gflags.exceptions.UnparsedFlagAccessError: Trying to access flag sc2_verbose before flags were parsed. ERROR:root:Trying to access flag sc2_verbose before flags were parsed. Traceback (most recent call last): File "D:\Software\Anaconda\lib\site-packages\gflags\flagvalues.py", line 535, in getattr raise exceptions.UnparsedFlagAccessError(error_message) gflags.exceptions.UnparsedFlagAccessError: Trying to access flag sc2_verbose before flags were parsed. [0] Got replay: D:\Blizzard App\StarCraft II\Replays\test\0000e057beefc9b1e9da959ed921b24b9f0a31c63fedb8d94a1db78b58cf92c5.SC2Replay ERROR:root:Trying to access flag sc2_verbose before flags were parsed. Traceback (most recent call last): File "D:\Software\Anaconda\lib\site-packages\gflags\flagvalues.py", line 535, in getattr raise exceptions.UnparsedFlagAccessError(error_message) gflags.exceptions.UnparsedFlagAccessError: Trying to access flag sc2_verbose before flags were parsed. ERROR:root:Trying to access flag sc2_verbose before flags were parsed. Traceback (most recent call last): File "D:\Software\Anaconda\lib\site-packages\gflags\flagvalues.py", line 535, in getattr raise exceptions.UnparsedFlagAccessError(error_message) gflags.exceptions.UnparsedFlagAccessError: Trying to access flag sc2_verbose before flags were parsed. ERROR:root:Trying to access flag sc2_verbose before flags were parsed. Traceback (most recent call last): File "D:\Software\Anaconda\lib\site-packages\gflags\flagvalues.py", line 535, in getattr raise exceptions.UnparsedFlagAccessError(error_message) gflags.exceptions.UnparsedFlagAccessError: Trying to access flag sc2_verbose before flags were parsed. ============================================= Summary 10 secs ============================================= Replays: 0, Steps total: 0

Camera move: 0, Select pt: 0, Select rect: 0, Control group: 0

Maps: 0 {}

Races: 0 {}

Unit ids: 0 {}

Valid abilities: 0 {}

Made abilities: 0 {}

Valid actions: 0 {}

Made actions: 0 {}

Crashing replays: 0 []

Invalid replays: 0 [] ---------------------------------------------- Process stats ---------------------------------------------- [ 0] replay: 0000e057be, replays: 0, steps: 0, game loops: 0, last: replay_info, 0 s ago

Hope for your help, thanks~ By the way, your api really do a great job!

Tangent-Wei commented 7 years ago

add this line "FLAGS(sys.argv)" after defining flags to parse the flags explicit. it works.

tewalds commented 7 years ago

I can't seem to replicate this problem. I just switched to a newer version of the flags and app library, so hopefully this is now fixed. Can you verify?

pangzhenjia commented 7 years ago

Hi, sorry that I'm late to reply. @Tangent-Wei , your way fix it well. Just add " FLAGS(sys.argv)" in the replay_action.py file. Also, I have fixed it in a tricky way:

(in protocol.py): class FLAGS(object): sc2_verbose = 0

By the way, there may be a "bug" in the replay_action.py, in about 117 line: " replay_name = os.path.basename(replay_path)[:10] " it means that the name is just 10 characters? @tewalds

tewalds commented 7 years ago

Ah, yeah, that may not be optimal in all cases. It was useful when running over blizzard's replay packs where the name is just a giant hash. Overall that script needs a bunch of love, but is something I'm unlikely to do given we do it rather differently internally.

keerthanpg commented 6 years ago

@pangzhenjia Where is the replay_action.py file? Did you mean replay_actions.py? I can't find where the sc2_verbose flag is but it is throwing up the flag parsing error.

keerthanpg commented 6 years ago

Solved this by upgrading to pysc2 1.2