【问题标题】:exe file looping through beginning of py file?exe文件循环通过py文件的开头?
【发布时间】:2022-11-13 08:13:49
【问题描述】:

我已经整理了一个可以作为 py 文件正常工作的网络抓取程序,但是当转换为 EXE 时,循环通过文件的开头而没有进入价格抓取部分,它似乎循环通过的部分是

print ("program is starting")
if __name__ == '__main__':
    n=0
    print ("program started")
    try:

        print(f"{n} starting...") #0
        n+=1
        ### initilize variables ###
        SCOPES, path, SERVICE_ACCOUNT_FILE, creds, service, SCANNING_ID, sheet, tn_list = init()
        today = datetime.today().strftime("%y%m%d")
        print(f"{n} initialized")#1
        n+=1

        ### separate carriers  tracking numbers ###
        tn_dict={}
        for tn in tn_list:
            if len(tn)<4:
                continue
            if tn[3] not in tn_dict:
                tn_dict[tn[3]] = []
            tn_dict[tn[3]].append(tn[0])
        print(f"{n} trackings seperated")#2
        print(tn_dict)
        n+=1

        ### search tracking numbers with carriers function ###
        main_tracking_dict = {}
        print(n)#3
        n+=1
        tracking_dicts = []
        
        print(n)#4
        n+=1
        try:
            for func, name in ((UPS,"UPS"), (Estes, "Estes"), (Central, "Central"), (Reddaway, "Reddaway"), (YRC, "YRC"),
                                (Pilot, "Pilot"),  (AMTrucking, "AM Trucking"), (fedex_bulk, "Fedex")) :
                       
                print(f"{n} {name} in tn_dict: {name in tn_dict}")#5-12
                
                if name in tn_dict:
                    print(n)
                    new_dict=func(tn_dict[name])

它在没有实际运行的情况下进入最后一行,而是循环回到最开始 从 .py 文件到 .exe 的更改中是否有任何可能导致此问题的内容?

【问题讨论】:

    标签: python exe auto-py-to-exe


    【解决方案1】:

    我不知道问题是什么。如果它适用于 Python,请尝试使用 pyinstaller。我通常使用它。

    【讨论】:

      猜你喜欢
      • 2016-06-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-13
      • 1970-01-01
      • 2019-04-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多