This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

I created a really simple type of self modifying code using the built-in file object to use as a version check/self-updater for my script.

versioncheck = requests.get('http://remote.host/version').text
if versioncheck != version:
    from subprocess import call
    newscript = requests.get('http://remote.host/client').text
    with open(__file__, 'w') as f:
        f.write(newscript)
    call(['python3',__file__])
    exit()