Fix ExampleApp: Use pg module from directory when run without installation (#1432)
Co-authored-by: 2xB <2xB@users.noreply.github.com>
This commit is contained in:
parent
3aa3e9b991
commit
100c793174
|
@ -1,15 +1,16 @@
|
|||
import sys, os
|
||||
|
||||
# Set up path to contain pyqtgraph module when run without installation
|
||||
if __name__ == "__main__" and (__package__ is None or __package__==''):
|
||||
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
sys.path.insert(0, parent_dir)
|
||||
import examples
|
||||
__package__ = "examples"
|
||||
|
||||
import pyqtgraph as pg
|
||||
from pyqtgraph.Qt import QtCore, QtGui
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __package__ is None or __package__ == "":
|
||||
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
sys.path.insert(0, parent_dir)
|
||||
import examples
|
||||
__package__ = "examples"
|
||||
|
||||
from .ExampleApp import main as run
|
||||
run()
|
||||
|
|
Loading…
Reference in New Issue