CarlosOliveira1988 / Investment_Portfolio_Analysis

This repository is useful to perform some financial analysis in Investment Portfolio
4 stars 0 forks source link

Application breakes when does not find the portfolio file #50

Closed cezaroliveira closed 2 years ago

cezaroliveira commented 3 years ago

Describe the bug

When running a file that needs the portfolio file, the application brokes.

To Reproduce

Steps to reproduce the behavior:

  1. Go to some Python file that needs the portfolio file (portfolio_investment.py for example)
  2. Run the Python file
  3. See error

Expected behavior

Application execute successfully even with the default portfolio file in base folder project.

Screenshots

If applicable, add screenshots to help explain your problem.

image

[Running] python -u "d:\Ambiente\SCM\Git\repositorios\Investment_Portfolio_Analysis\portfolio_investment.py"
Traceback (most recent call last):
  File "d:\Ambiente\SCM\Git\repositorios\Investment_Portfolio_Analysis\portfolio_investment.py", line 637, in <module>
    portfolio = PorfolioInvestment(file)
  File "d:\Ambiente\SCM\Git\repositorios\Investment_Portfolio_Analysis\portfolio_investment.py", line 25, in __init__
    self.operations = pd.read_excel(
  File "C:\Python39\lib\site-packages\pandas\util\_decorators.py", line 311, in wrapper
    return func(*args, **kwargs)
  File "C:\Python39\lib\site-packages\pandas\io\excel\_base.py", line 364, in read_excel
    io = ExcelFile(io, storage_options=storage_options, engine=engine)
  File "C:\Python39\lib\site-packages\pandas\io\excel\_base.py", line 1191, in __init__
    ext = inspect_excel_format(
  File "C:\Python39\lib\site-packages\pandas\io\excel\_base.py", line 1070, in inspect_excel_format
    with get_handle(
  File "C:\Python39\lib\site-packages\pandas\io\common.py", line 710, in get_handle
    handle = open(handle, ioargs.mode)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Fred\\Documents\\GitHub\\Investment_Portfolio_Analysis\\Extrato_Fred.xlsx'

[Done] exited with code=1 in 1.191 seconds

Desktop (please complete the following information):

Additional context

This will happen when the file does not exists in environment.

CarlosOliveira1988 commented 2 years ago

An interactive GUI was implemented, in order to load the wished Portfolio file.

All personal reference files were removed from the source code. In its Default State, the application now uses the '..\portfolio_lib\PORTFOLIO_TEMPLATE.xlsx' file.

image