Solved

folder existance checker


Badge

Hello,

I am trying to use Python caller to check if a folder exist. Here is the code:

But it doesnt geve back outcome to attribute "van". Where is my mistake?

import fme
import fmeobjects
import os

def processFeature(feature):
    van = os.path.isdir(feature.getAttribute('_LAS_eleresiutvonal'))
    print van
    feature.setAttribute('_van', van)
class FeatureProcessor(object):
    def __init__(self):
        pass
    def input(self,feature):   
        self.pyoutput(feature)
    def close(self):
        pass
icon

Best answer by ebygomm 23 March 2020, 15:31

View original

11 replies

Userlevel 1
Badge +10

What version of python are you using? That code won't work for python 3

Have you enterd _van in the Attributes to Expose parameter

Badge

What version of python are you using? That code won't work for python 3

Have you enterd _van in the Attributes to Expose parameter

I tried it but it gives back missing values :

Badge +22

Is your class or function to process features set to processFeature (good) or FeatureProcessor (bad in this case)?

Userlevel 1
Badge +10

I tried it but it gives back missing values :

Is everything else set up exactly as the screenshot?

Badge

Is everything else set up exactly as the screenshot?

everything is okay, only python output is missing

Userlevel 4

In the above code, the lines 9-15 are not (should not be) used. Try deleting these lines and see if you get a different error message.

Badge

In the above code, the lines 9-15 are not (should not be) used. Try deleting these lines and see if you get a different error message.

I deleted, now it says:

 

 

PythonFactory failed to load python symbol `FeatureProcessor'
Factory proxy not initialized
PythonCaller(PythonFactory): PythonFactory failed to process feature
Userlevel 1
Badge +10

everything is okay, only python output is missing

If you look at the screenshot, you will see that class or Function to process feature is set to processFeature, and the additional unwanted code is deleted. If you set up your pythoncaller exactly as posted it will work
Userlevel 1
Badge +10

The bit in yellow needs to be set to match the bit in red so processFeature

You are calling a class that doesn't exist

Badge
If you look at the screenshot, you will see that class or Function to process feature is set to processFeature, and the additional unwanted code is deleted. If you set up your pythoncaller exactly as posted it will work

I got it, it works well ;)

Userlevel 4

I deleted, now it says:

 

 

PythonFactory failed to load python symbol `FeatureProcessor'
Factory proxy not initialized
PythonCaller(PythonFactory): PythonFactory failed to process feature

Thanks, now we see the real error. Do as suggested by @ebygomm and it should work.

Reply