Skip to content

Commit

Permalink
I04_1-268: file path did not work for .exe bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
UrszulaNeuman committed Apr 25, 2018
1 parent 385a38d commit aa79021
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dls_barcode/geometry/unipuck_locator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import math
import os

import sys

from dls_util.image.contours_manager import ContoursManager
from dls_util.image.image_morphology import ImageMorphology
from dls_barcode.geometry.unipuck import Unipuck
Expand Down Expand Up @@ -101,8 +103,12 @@ def _find_contours_of_features(self, x, y, rad):

def _find_feature(self, features_cnt): # do this better
# compares the feature from the image with the features found on the edge of the puck
dir_path = os.path.dirname(os.path.realpath(__file__))
f_path = os.path.join(dir_path, '..', '..', 'resources', 'features', 'fit.png')
if getattr(sys, 'frozen', False): # for the .exe bundle
#see: #see https://pythonhosted.org/PyInstaller/runtime-information.html
f_path = os.path.join('..', 'resources', 'features', 'fit.png')
else:
dir_path = os.path.dirname(os.path.abspath(__file__))
f_path = os.path.join(dir_path, '..', '..', 'resources', 'features', 'fit.png')
img_feature_cnt = ContoursManager(255 - self._read_feature_image(f_path))
img_feature_cnt.find_all()

Expand Down

0 comments on commit aa79021

Please sign in to comment.