Hi friends!
I'm coding a program; i have a Tkinter window with a view button and i can add names with entry box and add button into a list that will be saved on a db file. Now i want the program to show the list names otomaticly when the program runs. The only problem is that if i want to run the program for the first time, there is no db file, so nothing can be load, so the program won't run and i get this error:

Traceback (most recent call last):
  File "app3.py", line 156, in <module>
    refresh()
  File "app3.py", line 75, in refresh
    refresh()
  File "app3.py", line 64, in refresh
    favorite_movies = pickle.load( open("films.db", "rb"))
IOError: [Errno 2] No such file or directory: 'films.db'

It's almost a long file code so i can't post them here.

Before i decided the program to show the list name otomaticly at the same time as the program runs, when i run the program for the first time, it always created the db file itself, but now with changing the code, i don't know what to do.

Recommended Answers

All 2 Replies

Why don't you use the other thread's solution ? I wrote all the code to create the file if does not exist and also to be able to run the code from another directory etc. If you use a function such as load_favorite() instead of pickle.load( open("films.db", "rb")) it will work.

I fixed the problem. Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.