From 733b324a9a69cd2a85134057417e7f7acd480d64 Mon Sep 17 00:00:00 2001 From: patricksferraz Date: Tue, 7 Jul 2020 16:21:17 -0300 Subject: [PATCH] fix: adds abspath for files search --- pandas_ui/funct1.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/pandas_ui/funct1.py b/pandas_ui/funct1.py index dd0b786..5e98b4f 100644 --- a/pandas_ui/funct1.py +++ b/pandas_ui/funct1.py @@ -30,7 +30,8 @@ import plotly.graph_objects as go import numpy as np import sys -from IPython.display import display, HTML;import os +from IPython.display import display, HTML +import os @@ -1371,15 +1372,12 @@ def column_selected_disp(column_selected_val): ####################################################################################################### def summ_disp(column_summ_val): - - patho = eval('pd.__file__') - patho = patho.replace('pandas\__init__.py','') + patho = os.path.abspath(os.path.dirname(__file__)) - - file = open(patho +"pandas_ui\plot.png", "rb") + file = open(os.path.join(patho, 'plot.png'), "rb") image = file.read() - file1 = open(patho +"pandas_ui\plt1.png", "rb") + file1 = open(os.path.join(patho, 'plt1.png'), "rb") image1 = file1.read() csv = widgets.Image( value=image, @@ -3436,10 +3434,8 @@ def on_bcmd_clicked(antrl): display(headcmd) display(lineout) - patho = eval('pd.__file__') - patho = patho.replace('pandas\__init__.py','') - patho = patho+'pandas_ui\panda.html' - file = open(patho, "rb") + patho = os.path.abspath(os.path.dirname(__file__)) + file = open(os.path.join(patho, 'panda.html'), "rb") image = file.read() htm = widgets.HTML( value=image @@ -4735,9 +4731,8 @@ def plthlp_response(cntrl): display('~ ld : Add different line dashes to plot based on values of a column') display('~ mar_x : Add a marginal distribution of x values ( y vales, z values)') display('~ s_max : Set size of the point in the plot') - patho = eval('pd.__file__') - patho = patho.replace('pandas\__init__.py','') - file = open(patho + 'pandas_ui\zis.jpg', 'rb') + patho = os.path.abspath(os.path.dirname(__file__)) + file = open(os.path.join(patho, 'zis.jpg'), "rb") image = file.read() display(lineout) display(' Reference ')