0

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.

2
Contributors
2
Replies
20
Views
2 Years
Discussion Span
Last Post by Niloofar24
1

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.

Edited by Gribouillis

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.