Book a Demo

Author Topic: automation - getting code import error message  (Read 4523 times)

Wade Brooks

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
automation - getting code import error message
« 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?
« Last Edit: October 02, 2014, 04:50:56 am by WadeBrooks »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: automation - getting code import error message
« Reply #1 on: October 02, 2014, 05:36:33 am »
Just a shot into the dark, but probably you're not doing anything wrong. EA's API and UI differ in quite some points. So I would not be astonished if the API does not pass error messages you encounter via UI. Send a bug report and see what they respond (and post the answer here).

q.

Wade Brooks

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Re: automation - getting code import error message
« Reply #2 on: October 03, 2014, 04:53:19 am »
Hello Richard,
 
Thank you for your enquiry.
 
The ImportFile method only returns true or false to indicate success or failure.  In the event that a failure occurs, it does not currently provide any further error information.  We have logged a feature request on your behalf for this capability, but cannot say at this time if/when such a feature may be implemented.
 
Sorry we could not be of more assistance.
 
Best regards,
 
Aaron Bell
Sparx Systems Pty Ltd

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: automation - getting code import error message
« Reply #3 on: October 03, 2014, 06:18:34 am »
Why is it that I'm always in the right when it gets to those points :(

q.