Stop shutil.make_archive adding archive to itself

前端 未结 2 2031
情歌与酒
情歌与酒 2021-01-19 04:04

I have App dir inside Release dir

$ cd Release
$ tree
.
`-- App
    |-- App.exe
    ..........

and I am trying to

相关标签:
2条回答
  • 2021-01-19 04:46

    Here's a couple of solutions that worked or me:

    # curdir: Release
    shutil.make_archive('App-1.0', 'zip', '.', 'App')
    
    # curdir: ../Release
    shutil.make_archive('Release/App-1.0', 'zip', 'Release', 'App')
    
    0 讨论(0)
  • 2021-01-19 05:09

    What I learned while fighting with this is this:

    shutil.make_archive('App-1.0', 'zip', '.', 'App')
    

    While 'App-1.0' is technically a "filename", it must be represented as a path to the file without the extension ('c:\myfiles\myzipfile'). I have not played with all the variants for path names yet, so some of the shortcuts likely work (such as: 'Release/App-1.0').

    0 讨论(0)
提交回复
热议问题