Skip to main content
Solved

Python getNamedConnection failing to retrieve connection by Name (str)

  • January 15, 2025
  • 2 replies
  • 54 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:

 

2 replies

david_r
Celebrity
  • 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

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. ​