0

this is my first question:

Im looking to implement a interactive way to look for a path and then load the data frame with pandas.

Im using Tk, when i run the code it seems like the terminal is running a infinite loop.

`import tkinter as tk
from tkinter import filedialog
root = tk.Tk()
root.withdraw()
file_path_to_open = filedialog.askopenfilename()` 

where is my error ? any advice? im looking for something similar to uigetfile from MATLAB in python.

  • Sorry mate, it was commented since makes my python get stuck , sometimes works and sometimes doesn't , I'm using Python 3.6 on Spyder with anaconda – Miguel Núñez Ochoa Jul 27 '18 at 06:04

1 Answers1

0

I don't know whether this answer is still useful for you, but maybe for those people having the same issue and coming here via google:

The issue is not caused by the piece of code itself, because that is working fine. See also Quick and easy file dialog in Python?

I assume it is caused because of some background tk processes which were not closed cleanly.

My solution was to restart the python kernel (using Jupyter Notebook with python 3.6) and reimporting. Also, it might help to close all background python processes, which might be still running, via the task manager.

Erik A
  • 31,639
  • 12
  • 42
  • 67
Ougaga
  • 127
  • 1
  • 9