Skip to main content
Solved

Python getNamedConnection failing to retrieve connection by Name (str)

  • January 15, 2025
  • 2 replies
  • 30 views

_fabian_
Contributor
Forum|alt.badge.img+5

I’m trying to retrieve a WebConnection using the FMENamedConnectionManager in a PythonCreator as described here.

Content of the PythonCreator:

import fmeobjects
import fmewebservices

class FeatureCreator(object):  
    def __init__(self):
        fmewebservices.FMENamedConnectionManager.getNamedConnection('SAP S4')

    def input(self, feature: fmeobjects.FMEFeature):
        pass

    def close(self):
        pass

The execution fails with the Error
Python Exception <TypeError>: descriptor 'getNamedConnection' for 'fmewebservices.FMENamedConnectionManager' objects doesn't apply to a 'str' object

even though the documentation clearly states that the first parameter must be a string object (connectionName (str))

What am I doing wrong?

Best answer by david_r

Try invoking the FMENamedConnectionManager as a class instance:

fmewebservices.FMENamedConnectionManager().getNamedConnection('SAP S4')

See also:

 

View original
Did this help you find an answer to your question?

2 replies

david_r
Evangelist
  • Best Answer
  • January 15, 2025

Try invoking the FMENamedConnectionManager as a class instance:

fmewebservices.FMENamedConnectionManager().getNamedConnection('SAP S4')

See also:

 


_fabian_
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • January 16, 2025
david_r wrote:

Try invoking the FMENamedConnectionManager as a class instance:

fmewebservices.FMENamedConnectionManager().getNamedConnection('SAP S4')

 

Thanks, this worked. The documentation was a bit misleading in this regard. ​


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings