happyleavesaoc/aoc-mgz

shutil.SameFileError: '/tmp/tmp246qmkok' and '/tmp/tmp246qmkok' are the same file

Closed this issue · 2 comments

Investigating what's causing it.

$ PYTHONPATH="." python mgz/cli.py extract tests/recs/de-20.06.aoe2record                                                                                                                                                                                                                        
INFO:mgz.summary:parsed header in 5.24 seconds
INFO:mgz.summary:parsed body in 0.71 seconds
Traceback (most recent call last):
  File "/home/tass/dev/aoe2/aoc-mgz/mgz/cli.py", line 285, in <module>
    main()
  File "/home/tass/dev/aoe2/aoc-mgz/mgz/cli.py", line 281, in main
    loop.run_until_complete(run(get_args()))
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/tass/dev/aoe2/aoc-mgz/mgz/cli.py", line 220, in run
    await extract_rec(args.playback.split(',')[0], rec, args.select)
  File "/home/tass/dev/aoe2/aoc-mgz/mgz/cli.py", line 61, in extract_rec
    data = await summary.async_extract(30000)
  File "/home/tass/dev/aoe2/aoc-mgz/mgz/summary/__init__.py", line 338, in async_extract
    return await get_extracted_data(
  File "/home/tass/dev/aoe2/aoc-mgz/mgz/summary/extract.py", line 396, in get_extracted_data
    client = await Client.create(playback, handle.name, start_time, duration, interval)
  File "/home/tass/dev/aoe2/aoc-mgz/mgz/playback.py", line 92, in create
    self.session, self.state_ws = await self.start_instance(interval, cycles)
  File "/home/tass/dev/aoe2/aoc-mgz/mgz/playback.py", line 98, in start_instance
    shutil.copyfile(
  File "/usr/lib/python3.9/shutil.py", line 244, in copyfile
    raise SameFileError("{!r} and {!r} are the same file".format(src, dst))
shutil.SameFileError: '/tmp/tmp246qmkok' and '/tmp/tmp246qmkok' are the same file
python mgz/cli.py extract tests/recs/de-20.06.aoe2record  6.56s user 0.33s system 98% cpu 6.996 total

FYI, extract will not function without some external dependencies -- and those won't work on DE anyway. You're getting an error because the playback parameter was not specified.

It should warn you about this unless playback was specified - might be a bug preventing that.