<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hello<div class=""><br class=""></div><div class="">I am running python 2.7.11 + PytQt 5.6 on MaxOS 10.11.5</div><div class="">I have installed an extension that I built called ‘psd' that has an open() method that takes a path to a PSD file</div><div class=""><br class=""></div><div class="">when I run the script the line containing 'type (path)' command returns:</div><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""><span class="Apple-tab-span" style="white-space:pre">      </span><type 'unicode’></span></font></div><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""><br class=""></span></font></div><div class="">but the next line containing ‘file = psd.open (fname)’ fails with:</div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>UnicodeEncodeError: 'ascii' codec can't encode character u'\u2022’ </span></div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">It seems as if there is some implicit type conversion being done when the filename is passed to the psd.open() method.</div><div style="margin: 0px; line-height: normal;" class="">If I try the command directly at the python command line it works fine and opens the file so I don’t think it is the extension causing the problem.</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">any idea what I am doing wrong??</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">I have this at the top of the file:</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">#!/usr/bin/python</div><div style="margin: 0px; line-height: normal;" class=""># -*- coding: utf-8 -*-</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">and this is the code fragment:</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">def LoadImageFile (self, fname, defer=False):<span class="Apple-tab-span" style="white-space: pre;">               </span></span></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>(path,file) = os.path.split (fname)</span></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>(root,extn) = os.path.splitext (file)</span></font></div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space: pre; font-size: 11px;"><font face="Menlo" class="">              </font></span></div><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="font-size: 11px; white-space: pre;">        </span><span style="font-size: 11px;" class="">if extn != '.psd’:</span></font></div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="font-size: 11px; font-family: Menlo; white-space: pre;">               </span><span style="font-size: 11px; font-family: Menlo;" class="">return</span></div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="white-space: pre; font-size: 11px;"><font face="Menlo" class="">            </font></span></div><div style="margin: 0px; line-height: normal;" class=""><span class="Apple-tab-span" style="font-size: 11px; font-family: Menlo; white-space: pre;">  </span><span style="font-size: 11px; font-family: Menlo;" class="">print "in LoadImageFIle fname: " + fname</span></div><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" class=""><span class="Apple-tab-span" style="font-size: 11px; white-space: pre;">        </span><span style="font-size: 11px;" class="">print type (fname)</span></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""><br class=""></span></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>file = psd.open (fname)</span></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>iw = float (file.imagecols)</span></font></div><div style="margin: 0px; line-height: normal;" class=""><font face="Menlo" class=""><span style="font-size: 11px;" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>ih = float (file.imagerows)</span></font></div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">and this is the traceback </div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">in LoadImageFIle fname: /Volumes/diablo-external/Dropbox/•Production/gail/--EXPORTS--/new-December/Drawings/gail-armsBack-Rebuild-01.VP/mon_head-01-0.psd</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><type 'unicode'></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Traceback (most recent call last):</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  File "gfx-Teatro.py", line 267, in <module></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">    main()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  File "gfx-Teatro.py", line 37, in main</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">    app.Run(args)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  File "gfx-Teatro.py", line 81, in Run</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">    self.InitializeProject ()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  File "gfx-Teatro.py", line 94, in InitializeProject</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">    self.NewDefaultScene (self.controller.job, "Performance")</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  File "gfx-Teatro.py", line 110, in NewDefaultScene</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">    scene.LoadXsheets ([dir])<span class="Apple-tab-span" style="white-space:pre">                         </span></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  File "/Volumes/diablo-external/Dropbox/Development/-Applications-/Teatro/Scene.py", line 511, in LoadXsheets</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">    xsheet = self.LoadXsheets (flist, into, item)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  File "/Volumes/diablo-external/Dropbox/Development/-Applications-/Teatro/Scene.py", line 511, in LoadXsheets</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">    xsheet = self.LoadXsheets (flist, into, item)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  File "/Volumes/diablo-external/Dropbox/Development/-Applications-/Teatro/Scene.py", line 511, in LoadXsheets</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">    xsheet = self.LoadXsheets (flist, into, item)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  File "/Volumes/diablo-external/Dropbox/Development/-Applications-/Teatro/Scene.py", line 511, in LoadXsheets</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">    xsheet = self.LoadXsheets (flist, into, item)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  File "/Volumes/diablo-external/Dropbox/Development/-Applications-/Teatro/Scene.py", line 521, in LoadXsheets</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">    background.LoadXsheets ([file], dir=path, level=0, item=self.tranItem)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  File "/Volumes/diablo-external/Dropbox/Development/-Applications-/Teatro/Background.py", line 224, in LoadXsheets</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">    entry.LoadXsheets (fname)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  File "/Volumes/diablo-external/Dropbox/Development/-Applications-/Teatro/Xsheet.py", line 341, in LoadXsheets</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">    self.Read(project)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  File "/Volumes/diablo-external/Dropbox/Development/-Applications-/Teatro/Xsheet.py", line 504, in Read</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">    entry.Read (xfile)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  File "/Volumes/diablo-external/Dropbox/Development/-Applications-/Teatro/Xcolumn.py", line 312, in Read</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">    entry.Load ()</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  File "/Volumes/diablo-external/Dropbox/Development/-Applications-/Teatro/Xreference.py", line 138, in Load</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">    plate.LoadImageFile (fname)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  File "/Volumes/diablo-external/Dropbox/Development/-Applications-/Teatro/Layout.py", line 1218, in LoadImageFile</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">    file = psd.open (fname)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">UnicodeEncodeError: 'ascii' codec can't encode character u'\u2022' in position 33: ordinal not in range(128)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">e-c908-38136:Teatro michael_ferraro$ python -V</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div></div></div></body></html>