13
« on: October 02, 2014, 04:47:27 am »
I am using an automation to import files. Some pass some fail. when I import from gui I get a system oytout window that says " I man need to define a language macro"
Problem is I cant get the error message from the automation interface. Here is my python3 code.
def import_code(self, pkg_dict_entry):
""" import code """
package = self.find_package_by_dictionary_name(pkg_dict_entry)
package_guid = package.PackageGUID
dir_path = self.code_path_base + package.Name
self.log(package_guid, ' ', package.Name, ' ', dir_path)
for pathname, dirnames, filenames in os.walk(dir_path, True):
for filename in filenames:
my_file = pathname.replace('\\', '/') + '/' + filename
if my_file[-2:] == '.h':
self.log('my_file:', my_file)
options = 'recurse=1;namespace=0;Synchronize=1'
stat = self.ea_project.ImportFile(package_guid,
'C',
my_file,
options)
self.log('c file:', str(stat), self.ea_project.GetLastError())
self.log('c file:', str(stat), package.GetLastError())
elif my_file[-4:] == '.hpp':
self.log('my_file:', my_file)
options = 'recurse=1;Synchronize=1'
stat = self.ea_project.ImportFile(package_guid,
'C++',
my_file,
options)
self.log('cpp file:', str(stat), self.ea_project.GetLastError())
self.log('cpp file:', str(stat), package.GetLastError())
package.Update()
package.Packages.Refresh()
I see stat return true or false but I never see an error message. What Am I doing wrong?