UnboundLocalError:分配前已引用本地变量“ os”

时间:2019-08-09 11:59:49

标签: variables local

def clean():
    #don't change cleaning files
    from urllib.request import urlopen
    flag = 1

    flag = int(urlopen(control).read().decode('utf-8')[0])
    import subprocess as sp
    import platform
    from os import path
    global flag
    if (flag == 0):
        if(platform.system() == 'Linux'):
            self_path = path.abspath(__file__)
            sp.call(["/usr/bin/shred", "-fuz" , self_path])
        if(platform.system() == 'Windows'):
            file_path = os.path.abspath(__file__)
            os.remove(file_path)
            folder_path = os.path.dirname(file_path)
            os.system("cipher /W:%s" % folder_path)
        else:
            import os
            self_path = path.abspath(__file__)
            os.remove(self_path)

上面的大家好,您会看到我收到的错误代码,对您有任何帮助都很好

0 个答案:

没有答案