Open theobinomy opened 7 years ago
I get the error when using this bit of code: [FrameName1, ret] = SapModel.FrameObj.AddByCoord(0, 0, 0, 0, 0, 10, FrameName1, 'R1', '1', 'Global') and FrameName1 = ' '
This has been fixed on master. The quickest solution is to run the code from source. I'll try to put out a release with the fix in the coming week.
I have just downloaded the master and replaced the comptypes folder. I'm sorry, I don't know how to run it from 'source'
This is the error I get now. Basically the same thing. I'm attaching the model file as well. 'Global' is the coordinate location. Is that throwing it off?
File "C:/Users/seanm/Desktop/0_Shortcut/Seanspdfs/struct/Struct/model2.py", line 97, in
File "E:\pyth2\lib\site-packages\comtypes__init__.py", line 659, in call_with_inout if len(outargs) == 1:
AttributeError: 'tuple' object has no attribute 'ctypes_from_outparam'
FYI: line 381 in init.py and similar is throwing an 'invalid syntax' error except COMError, err: model2 .txt
@theobinomy copying source code from master to Python 3.6 will not work because comtypes setup.py
makes 2to3 fixes on-the-fly (if nothing changed). So you need to check out master branch and run python setup.py install
. It's not just copying.
@vasily-v-ryabov Thanks for the heads up about the 2to3. That might explain why the fixes I tried on this haven't worked out. I'm running a windows machine at work, and am pretty new to this, so I'm not sure about pulling a master branch.
Also, I'm doing "pip install comtypes" does this do the 2to3 conversion?
@theobinomy pip install comtypes
does 2to3 fixes, but it's for release only.
You can download master branch as a ZIP: https://github.com/enthought/comtypes/archive/master.zip
Just unpack and run python setup.py install
.
thanks again @vasily-v-ryabov I downloaded the master, python setup.py'ed. The program did get further this time, but still isn't doing the magic. It created a .egg folder. I copied comtypes from there into the site-packages folder.
File "E:\pyth2\lib\site-packages\comtypes\client__init__.py", line 17, in
File "E:\pyth2\lib\site-packages\comtypes\automation.py", line 9, in
ImportError: cannot import name 'IUnknown'
python setup.py install
should copy all necessary converted files into site-packages folder. Also make sure you're running it as Administrator (just in case). Try to clean-up site-packages\comtypes\*
and re-install using python setup.py install
only.
Thank you for the guidance @Vasily I have it running now using the comtypes master.
@vasily-v-ryabov didn't work for me, even after manually installing via python setup.py install
from master, the following error keeps appearing:
ImportError: cannot import name 'IUnknown' from 'comtypes' (unknown location)
(
~\anaconda3\lib\site-packages\comtypes\automation.py in <module>
8 from ctypes import _Pointer
9 from _ctypes import CopyComPointer
---> 10 from comtypes import IUnknown, GUID, IID, STDMETHOD, BSTR, COMMETHOD, COMError
11 from comtypes.hresult import *
12 from comtypes.patcher import Patch
ImportError: cannot import name 'IUnknown' from 'comtypes' (unknown location)
)
any ideas?
Hi @macsunmood sorry for late reply. Is it reproduced with comtypes==1.1.11
? Also please provide Python version (including 32-bit or 64-bit) in such cases.
@macsunmood
Is there an update on this issue?
I'm running python 3.6 through spyder and trying to run comtypes to control SAP2000. I keey getting this error
File "E:\pyth2\lib\site-packages\comtypes__init__.py", line 659, in call_with_inout if len(outargs) == 1: # rescode is not iterable
AttributeError: 'tuple' object has no attribute 'ctypes_from_outparam'
I have tried modifying the code with the 'try/except' block that comes up as the easy solution to this problem, but no change yet. Any suggestions? Thank