From 8755588310ad55e54c25710b03f5877b1089b2cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20BERTHO?= Date: Tue, 1 May 2018 11:27:33 +0200 Subject: [PATCH] Fixeg path bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi BERTHO --- main.py => SimplePanoramaViewer | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) rename main.py => SimplePanoramaViewer (77%) diff --git a/main.py b/SimplePanoramaViewer similarity index 77% rename from main.py rename to SimplePanoramaViewer index a2718ab..42accae 100755 --- a/main.py +++ b/SimplePanoramaViewer @@ -2,6 +2,7 @@ import os import sys +from os import path from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtCore import * from PyQt5.QtGui import * @@ -9,10 +10,10 @@ from PyQt5.QtWidgets import * from PyQt5.QtWebEngine import * from PyQt5.QtWebEngineWidgets import * -path = os.path.dirname(os.path.realpath(sys.argv[0])) -os.chdir(path) +img = path.abspath(sys.argv[1]) -img = sys.argv[1] +exe_dir = path.dirname(path.realpath(sys.argv[0])) +os.chdir(exe_dir) try: with open("html/index.html", "r", encoding="utf8") as file: @@ -25,7 +26,7 @@ app = QApplication(sys.argv) app.setApplicationName("SimplePanoramaViewer") web = QWebEngineView() -web.setHtml(html,QUrl("file://" + path + "/index.html")) +web.setHtml(html,QUrl("file://" + exe_dir + "/index.html")) web.setWindowTitle(img) web.show()