On Tue, Apr 25, 2017 at 6:48 PM, Tim Roberts <t...@probo.com> wrote: > gowri shankar wrote: > > ************************************************************ > ************** > > > > MATLAB commands work perfectly wihtout any fuss. > > *I have translated the above code in python but i was able to talk to > > CST with only first 2-3 commands i.e* > > ********************************* > > /import win32com.client/ > > /cst = win32com.client.Dispatch("CSTStudio.Application")/ > > /#Opens a new CST file/ > > /mws=cst.OpenFile('D:\Gowrishankar\PDF\cuboid.cst');/ > > You can't use backslashes like that in a Python string literal. You > need to use one of following: > > mws = cst.OpenFile('D:/Gowrishankar/PDF/cuboid.cst') > mws = cst.OpenFile('D:\\Gowrishankar\\PDF\\cuboid.cst') > mws = cst.OpenFile(r'D:\Gowrishankar\PDF\cuboid.cst') >
Using os.path.join() is also a valid alternative pattern for operational safety and consistency. import os os.path.join( 'D:', os.path.sep, 'Gowrishankar', 'PDF', 'cuboid.cst') >>> 'D:\\Gowrishankar\\PDF\\cuboid.cst' -- Joni Orponen
_______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32