Python Forum
[PyGUI] Python Application Not Finding Excel File
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGUI] Python Application Not Finding Excel File
#1
Hey Guys,

I am a newbie in Python! I am trying to import my excel data in python! But I always keep getting this error! I don't know what to do! I am setting the right directory in this line my pd.read_excel... What else could this be?

import pandas as pd
pd.read_excel('This PC/Desktop/IST 467 Data Mining/Module3/Students.xlsx', sheet_name='Sheet1')
But this is the error I keep getting below:

Error:
FileNotFoundError Traceback (most recent call last) <ipython-input-15-42b58c01f825> in <module> ----> 1 pd.read_excel('This PC/Desktop/IST 467 Data Mining/Module3/Students.xlsx', sheet_name='Sheet1') ~\anaconda3\lib\site-packages\pandas\util\_decorators.py in wrapper(*args, **kwargs) 294 ) 295 warnings.warn(msg, FutureWarning, stacklevel=stacklevel) --> 296 return func(*args, **kwargs) 297 298 return wrapper ~\anaconda3\lib\site-packages\pandas\io\excel\_base.py in read_excel(io, sheet_name, header, names, index_col, usecols, squeeze, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, parse_dates, date_parser, thousands, comment, skipfooter, convert_float, mangle_dupe_cols) 302 303 if not isinstance(io, ExcelFile): --> 304 io = ExcelFile(io, engine=engine) 305 elif engine and engine != io.engine: 306 raise ValueError( ~\anaconda3\lib\site-packages\pandas\io\excel\_base.py in __init__(self, path_or_buffer, engine) 865 self._io = stringify_path(path_or_buffer) 866 --> 867 self._reader = self._engines[engine](self._io) 868 869 def __fspath__(self): ~\anaconda3\lib\site-packages\pandas\io\excel\_xlrd.py in __init__(self, filepath_or_buffer) 20 err_msg = "Install xlrd >= 1.0.0 for Excel support" 21 import_optional_dependency("xlrd", extra=err_msg) ---> 22 super().__init__(filepath_or_buffer) 23 24 @property ~\anaconda3\lib\site-packages\pandas\io\excel\_base.py in __init__(self, filepath_or_buffer) 351 self.book = self.load_workbook(filepath_or_buffer) 352 elif isinstance(filepath_or_buffer, str): --> 353 self.book = self.load_workbook(filepath_or_buffer) 354 elif isinstance(filepath_or_buffer, bytes): 355 self.book = self.load_workbook(BytesIO(filepath_or_buffer)) ~\anaconda3\lib\site-packages\pandas\io\excel\_xlrd.py in load_workbook(self, filepath_or_buffer) 35 return open_workbook(file_contents=data) 36 else: ---> 37 return open_workbook(filepath_or_buffer) 38 39 @property ~\anaconda3\lib\site-packages\xlrd\__init__.py in open_workbook(filename, logfile, verbosity, use_mmap, file_contents, encoding_override, formatting_info, on_demand, ragged_rows) 109 else: 110 filename = os.path.expanduser(filename) --> 111 with open(filename, "rb") as f: 112 peek = f.read(peeksz) 113 if peek == b"PK\x03\x04": # a ZIP file FileNotFoundError: [Errno 2] No such file or directory: 'This PC/Desktop/IST 467 Data Mining/Module3/Students.xlsx'
Reply
#2
Is this 'This PC/Desktop/IST 467 Data Mining/Module3/Students.xlsx' Really the path?
looks problematic at best
Reply
#3
try something like this instead. yourUsername needs to be whatever username you log into your system with

'c:\users\yourUsername\desktop\IST 467 Data Mining\Module3\Students.xlsx'
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Application development in Python muralikreddy 4 2,704 Yesterday, 12:05 AM
Last Post: anastasiastefanyuk
  How to make cross platform gui python application ? Jayam 2 3,782 Dec-24-2021, 03:24 PM
Last Post: Linenloid
  Embed Python console in GUI application deanhystad 5 13,793 Jun-04-2021, 05:10 PM
Last Post: deanhystad
  [Tkinter] Tkinter - I need to read file excel from GUI app to script file johnjh 0 10,671 Apr-17-2020, 08:14 PM
Last Post: johnjh
  [PyQt] Import Excel file and use pandas WBPYTHON 2 5,606 Mar-22-2020, 11:28 AM
Last Post: WBPYTHON
  Python Application in Taskbar constantin01 3 5,934 Jan-24-2020, 10:57 AM
Last Post: buran
  Python Wrapper Application panick1992 8 6,598 Mar-15-2017, 11:54 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020