Python Forum

Full Version: Update Python Files
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How to update python apps Without using any framework Hand in pyqt5.
Another Problem: And Replace The Old Source Code File File With Updated? I Can't Figure Out Wall
It will be a small miracle if someone understands that question. I can't wait to see the answer.
I think the best solution is to have an independent update script, which is run by your program.
Then the update script needs to know the installation Path, the online-version and installed-version.
Then you compare them, if installed-version is lower than online-version, download the new files.
I think the best is to use an archive. Then you unpack it and after everything has been extracted,
the independent update script could use return code, to signal the main program not to start.

You'll find some examples if you look for "auto update script python".
QT is not required, you could do it with vanilla Python (no additional dependencies required)
Hmm Good! Answer Is Clear But Here The Problem Is How To Implement In Another Script If you have example plz share
My Approach to this Code:
information = { "__author__": "Harshil Pandey",
"__copyright__": "Copyright (C) 2020, Harshil Pandey",
"__credits__": "harshil Pandey",
"__license__": "The Apache-2.0 License",
"__version__": "1.0",
"__maintainer__": "Harshil Pandey",
"__email__": "[email protected]",
"__status__": "Stable"}

    def updating():
        local_version = float(information["__version__"])
        if local_version < data:
            print("Software Need TO Be Updated")
            requests.get('')
        else:
            print("Software Up-to Date")

    def update_using_manager():
        try:
            # -- Online Version File
            # -- Replace the url for your file online with the one below.
            global data
            response = requests.get(
                'https://raw.githubusercontent.com/Harshil783/QrCode_Tools_In_Python/master/version.txt')
            data = float(response.text.replace("__version__ = '","").replace("'",""))
            updating(data)
        except ConnectionError:
            print("SomeThing Went Wrong! Can Be Due To No Connection.")
Well I Have This thing in github And There Is Version.txt i retrieved but problem how to update i fetch all information but ho w to implement this to code Update The Source Code Of OutDated Python Source Code!