Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
313 views
in Technique[技术] by (71.8m points)

python to exe with error:"LaTeX_envs_menu_present": true, NameError: name 'true' is not defined

I is writing a code which actually go on gov website and collect some of teh data. It runs fine in jupyter notebook but when I try to run in cmd dis gives me the following error:

The main objective is to convert this file in exe so I can give it my client but following error is not being solved by me so I run in cmd and I is getting this error:

C:Usersdeepankar.srigyanDesktopData Science ProjectCovid Lockdown statusFinal Code for check>lockdown.py

Traceback (most recent call last): File "C:Usersdeepankar.srigyanDesktopData Science ProjectCovid Lockdown statusFinal Code for checkLockdown.py", line 1, in from tqdm.notebook import tqdm, trange ModuleNotFoundError: No module named 'tqdm'

excel file Post_Code.xlsx like

PostCode
E139PY
NR172AH
NW61XJ
IG14AA
CO153AY
IG62UE
SG51AE
SG51LA
AL13TJ
CB80TF
WD180BW

Code is this...

from tqdm.notebook import tqdm, trange
import time    # to be used in loop iterations
import pandas as pd
import requests
from bs4 import BeautifulSoup

post_code_df=pd.read_excel(r"C:Usersdeepankar.srigyanDesktopData Science ProjectCovid Lockdown statusPost_Code.xlsx")
post_code_df=post_code_df.head(10)

index = post_code_df. index
number_of_rows = len(index)

print(number_of_rows)

import sys


def progress(count, total, status=''):
    bar_len = 60
    filled_len = int(round(bar_len * count / float(total)))

    percents = round(100.0 * count / float(total), 1)
    bar = '=' * filled_len + '-' * (bar_len - filled_len)

    sys.stdout.write('[%s] %s%s ...%s
' % (bar, percents, '%', status))
    sys.stdout.flush()  # As suggested by Rom Ruben (see: http://stackoverflow.com/questions/3173320/text-progress-bar-in-teh-console/27871113#comment50529068_27871113)

    Post_Code_Output = []

    index = post_code_df.index
    number_of_rows = len(index)

    # Simple loop

    for me in range(number_of_rows - 1):
     progress(me, (number_of_rows - 1), status='Record No # ' + str(me))
     time.sleep(0.5)  # emulating long-playing job

     post_code = (post_code_df.iloc[me, 0])
     URL1 = 'https://www.gov.uk/find-coronavirus-local-restrictions?postcode=' + post_code
     #     print(URL1)

     page = requests.get(URL1)
     URL = URL1
     page = requests.get(URL)

     soup = BeautifulSoup(page.content, 'html.parser')
     results = soup.find(id='wrapper')

     job_elems = results.find_all(class_="coronavirus-local-restriction__heading-tier-label")

     #     print (job_elems)
     Post_Code_Output.append([post_code, job_elems])
    #     print("Processing record #"+str(me))

type(Post_Code_Output)
print(Post_Code_Output)
Output=pd.DataFrame(Post_Code_Output,columns=['Post_Code','Tier'])
print(Output)
Output.to_excel(r"C:Usersdeepankar.srigyanDesktopData Science ProjectCovid Lockdown statusPost_Code_Output.xlsx", index = False)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...