0

I am trying to convert the py file to exe file but after conversion I have successfully converted the py to exe .But on clicking on the exe file the terminal just closes and open and nothing happens. My script displays a notification with a new word and its meaning everyday when I run on the ide(Pycharm) but after the conversion to exe using auto-py-to-exe nothing is happening.I have also tried by importing the missing modules

import urllib.request # used to send requests basically https requests from bs4 import BeautifulSoup # used to parse xml and html pages so that we can extract data from webpages. It # creates a parse tree for webpages import time from plyer import notification if __name__ == '__main__': url = "https://www.dictionary.com/e/word-of-the-day/" # any url can be inserted here as u wish html_file = urllib.request.urlopen(url) soup = BeautifulSoup(html_file, 'lxml') # for documentation check this https://zetcode.com/python/beautifulsoup/ soup1 = soup.find(class_="otd-item-headword__word") # inspect the page and find the specific data to crawl the # data from the html code try: soup1 = soup1.get_text() except AttributeError: print('No words for today. You have learnt enough') exit() txt10 = soup1.rstrip() # The rstrip() method returns a copy of the string by removing the trailing characters # specified as argument. soup2 = soup.find(class_="otd-item-headword__pos") soup2 = soup2.get_text() txt11 = soup2.rstrip() soup3 = soup.find(class_="wotd-item-origin__content wotd-item-origin__content-full") txt = soup3.get_text() txt1 = txt.rstrip() notification.notify( title="*** WORD OF THE DAY ***" + "\n" + ' '.join(txt10.split()) + "\n", message="MEANING:" + ' '.join(txt11.split()), # app_icon=r"C:\Users\HP\PycharmProjects\MyProjects\book.ico", app_icon=r"C:\Users\purba\PycharmProjects\pythonProject\dictionary.ico", ticker=r"Vocab APP", app_name=r"PYTHON PROJECT: VOCAB APP 365", timeout=60 ) time.sleep(60 * 60) 
1
  • this isn't any issue actually, its just that python exists as soon as the program is done with the code, so that means either you have to put a time.sleep(5) #put the number of seconds you want it to sleep or you can just create a gui of your program Commented Sep 18, 2021 at 5:03

3 Answers 3

1

This is normal behavior. The python script will exit immediately after it completed its job. To make your application hang before closing, you can add this code at the end of your script:

input("Press any key to exit...") 
Sign up to request clarification or add additional context in comments.

2 Comments

Its still the same, its not doing anything different. I tried it
I was having a similar issue. I fixed it by pip uninstalling typing. Just pip uninstall typing and try your pyinstaller command. It should fix it.
0
 pip uninstall typing 

That should fix it. Thereafter run your pyinstaller code, your exe file will be created and when you run it, it won't crash.

Comments

0

Follow these step or watch this YouTube tutorial:

  • Install pip install pyinstaller module in python.

  • Go to your python installed directories. and open command prompt then install pyinstaller

  • After open command prompt and type "pyinstaller --onefile -w then your file path or name

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.