• Join/Login
  • Business Software
  • Open Source Software
  • For Vendors
  • Blog
  • About
  • More
    • Articles
    • Create
    • SourceForge Podcast
    • Site Documentation
    • Subscribe to our Newsletter
    • Support Request
SourceForge logo
For Vendors Help Create Join Login
SourceForge logo
Business Software
Open Source Software
SourceForge Podcast
Resources
  • Articles
  • Case Studies
  • Blog
Menu
  • Help
  • Create
  • Join
  • Login
  • Home
  • Browse
  • comtypes
  • Bugs

UnicodeDecodeError:

Status: Beta
Brought to you by: cfarrow, jaraco, theller
  • Summary
  • Files
  • Reviews
  • Support
  • Mailing Lists
  • Tickets ▾
    • Feature Requests
    • Bugs
    • Patches
Menu ▾ ▴
  • Create Ticket
  • View Stats

Group

Searches

  • Changes
  • Closed Tickets
  • Open Tickets

Help

  • Formatting Help

#13 UnicodeDecodeError:

open
nobody
None
5
2014-08-30
2009-02-04
Nobuhiro Hatori
No

I try
Autodesk MAYA 2008 windows operate from IE 7.0 use comtypes "CreateObject".

ex.
Click "openImageFile"
1. IE (Maya.CommandEngine.MEL)
2. MAYA (melCommand "python")
3. comtypes ( CreateObject("Photoshop.Application") )
open imageFile on PhotoShop.

1.------ test.html ------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
<script type="text/vbscript">
<!--
Dim MEL
Set MEL = CreateObject("Maya.CommandEngine.MEL")
MEL.Connect()
//-->
</script>
</head>
<body>
<p><a href="#" title="open" onclick="MEL.Execute('nh_execPyTest')">openImageFile</a></p>
</body>
</html>

2.------ nh_execPyTest.mel ------

global proc nh_execPyTest(){
python("nh_openPSD2()");
}

3. ------ nh_openPSD2.py ------
from comtypes.client import CreateObject
def nh_openPSD2():
try:
psApp = CreateObject("Photoshop.Application")
docRef = psApp.Open(<IMAGEPATH>)
except Exception, x:
print x

====== ERROR ======

# Traceback (most recent call last):
# File "<maya console>", line 1, in <module>
# File "C:\Documents and Settings\hatori\My Documents\maya\7.0\scripts\opt\et1.py", line 32, in nh_openPSD2
# psApp = CreateObject("Photoshop.Application")
# File "C:\Python25\Lib\site-packages\comtypes\client\__init__.py", line 197, in CreateObject
# obj = comtypes.CoCreateInstance(clsid, clsctx=clsctx, interface=interface)
# File "C:\Python25\Lib\site-packages\comtypes\__init__.py", line 1119, in CoCreateInstance
# _ole32.CoCreateInstance(byref(clsid), punkouter, clsctx, byref(iid), byref(p))
# File "..\Modules\_ctypes\callproc.c", line 754, in GetResult
# WindowsError: (-2147417843, '\x83A\x83v\x83......') #

...... is
UnicodeDecodeError: 'ascii' codec can't decode byte 0x83 in position 20: ordinal not in range(128)

=====================

I tried
--- sitecustomize.py ---
import sys
sys.setdefaultencoding('utf-8')

and win32com
http://techarttiki.blogspot.com/2008/08/photoshop-scripting-with-python.html

was error.
nh_execPyTest.mel and nh_openPSD2.py is operating.

Could advice be got?

Discussion

  • Christopher L Farrow

    Christopher L Farrow - 2014-02-19

    Transferred to https://github.com/enthought/comtypes/issues/16 .

     
    If you would like to refer to this comment somewhere else in this project, copy and paste the following link:

Log in to post a comment.

SourceForge
  • Create a Project
  • Open Source Software
  • Business Software
  • Top Downloaded Projects
Company
  • About
  • Team
  • SourceForge Headquarters
    1320 Columbia Street Suite 310
    San Diego, CA 92101
    +1 (858) 422-6466
Resources
  • Support
  • Site Documentation
  • Site Status
  • SourceForge Reviews
SourceForge logo
© 2026 Slashdot Media. All Rights Reserved.
Terms Privacy Opt Out Advertise
×