diff --git a/platformio/commands/upgrade.py b/platformio/commands/upgrade.py index 66eda804..25e5bd01 100644 --- a/platformio/commands/upgrade.py +++ b/platformio/commands/upgrade.py @@ -40,7 +40,7 @@ def cli(dev): to_develop = dev or not all(c.isdigit() for c in __version__ if c != ".") cmds = ( - ["pip", "install", "--upgrade", get_pip_package(to_develop)], + ["pip", "install", "--upgrade", download_dist_package(to_develop)], ["platformio", "--version"], ) @@ -94,7 +94,7 @@ WARNING! Don't use `sudo` for the rest PlatformIO commands. return True -def get_pip_package(to_develop): +def download_dist_package(to_develop): if not to_develop: return "platformio" dl_url = "https://github.com/platformio/platformio-core/archive/develop.zip" @@ -103,7 +103,7 @@ def get_pip_package(to_develop): os.makedirs(cache_dir) pkg_name = os.path.join(cache_dir, "piocoredevelop.zip") try: - with open(pkg_name, "w", encoding="utf8") as fp: + with open(pkg_name, "wb") as fp: r = exec_command( ["curl", "-fsSL", dl_url], stdout=fp, universal_newlines=True )