#
#
# .2020-06-13 16:35:24
Python
# ., 2020-06-13 16:35:24

Why does the program close immediately?

I have a program in Python. I converted it to an .exe file, the conversion was successful, but the file closes immediately when it starts. Here
is the code
I

import pickle

with open('listfile.data', 'rb') as filehandle:  
   music_list = pickle.load(filehandle)

name_music = input("Введите название музыки:  ")
put2music = input("Введите путь к музыке:  ")

music_list.append(name_music)
music_list.append(put2music)
print(music_list)

with open('listfile.data', 'wb') as filehandle:
    pickle.dump(music_list, filehandle)

There are no errors in the program itself, because when I run it in a .py file, everything works.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Karbivnichy, 2020-06-13
@hottabxp

Most likely it cannot find the file 'listfile.data'.
In general, Python in exe is a crutch.

W
Web Dentist, 2020-06-13
@kgb_zor

Add at the end input()to make the program wait for input.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question