Skip to main content
Solved

Custom transformers and some 32/64 bit woes


lifalin2016
Contributor
Forum|alt.badge.img+29

Hi,

Last week I built a couple of custom transformers (with Python) in my 64 bit FME. They worked.

Friday I installed PyCharm, which is 32 bit, so I ended up having to install the 32 bit version of FME as well, but finally got it to work there.

Today I'm revisiting my custom transformers in my 64 bit FME, and now they don't work! And they don't work in the 32 bit version neither!!

The error is the "import" statement, that tries to load my custom transformer (import StationingCalculator). The PY/PYC files are present in the FME/transformers folder.

It looks like the whole Python setup is riddled with 32-vs-64 bit issues, so I have to ask, How do I get a stable environment to work with ?

I would prefer to use the 64 bit FME, but also PyCharm, so what the right way to approach this ?

Cheers

 

Lars

Best answer by david_r

Have you set a custom Python interpreter in FME, by any chance?

If so, you will likely need to set the PYTHON_HOME environment variable so that FME finds the correct Python installation (32 vs 64 bits).

Some more info on the enviroment variables here: http://www.developerzen.com/2010/09/23/the-complete-guide-to-setting-up-python-development-environment-on-windows/

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

8 replies

david_r
Celebrity
  • Best Answer
  • June 21, 2016

Have you set a custom Python interpreter in FME, by any chance?

If so, you will likely need to set the PYTHON_HOME environment variable so that FME finds the correct Python installation (32 vs 64 bits).

Some more info on the enviroment variables here: http://www.developerzen.com/2010/09/23/the-complete-guide-to-setting-up-python-development-environment-on-windows/


lifalin2016
Contributor
Forum|alt.badge.img+29
  • Author
  • Contributor
  • June 21, 2016

Hi David,

How do I even do that ? I was under the impression that FME used its own internal Python interpreter. Here's the log file part for my error:

Loaded module 'Python_func' from file 'C:\\Program Files\\FME 2016\\plugins/Python_func.dll'

 

FME API version of module 'Python_func' matches current internal version (3.8 20160224)

 

Using FME's provided Python interpreter from `C:\\Program Files\\FME 2016\\fmepython27\\python27.dll'

 

Python version 2.7 loaded successfully

 

Adding folder `C:\\Program Files\\FME 2016\\transformers\\' to the python path

 

Python Exception <SyntaxError>: invalid syntax (StationingVisitor.py, line 142)

 

Error executing string `import StationingCalculator'

 

...

I don't have a PYTHON_HOME env. variable, but I needed to add a PYTHONPATH, a FME_PYTHON_PATH, and an FME_DEV_HOME to make PyCharm work. The references to FME in these had to be to the 32 bit version before it would work.

The issue is, that these settings are singular, and I'm not sure which are used for what.

I did copy all my transformer files in the 64 bit folder to the similar folder in 32 bit, but something is still amiss.

I'll have a look at the link you sent.

Cheers

 

Lars

lifalin2016
Contributor
Forum|alt.badge.img+29
  • Author
  • Contributor
  • June 21, 2016

Hi again,

I tried adding the FME_PYTHON_PATH (which I disabled above), but it made no difference:

Loaded module 'Python_func' from file 'C:\\Program Files\\FME 2016\\plugins/Python_func.dll'

 

FME API version of module 'Python_func' matches current internal version (3.8 20160224)

 

Using FME's provided Python interpreter from `C:\\Program Files\\FME 2016\\fmepython27\\python27.dll'

 

Python version 2.7 loaded successfully

 

Adding folder `C:\\Program Files\\FME 2016\\transformers\\' to the python path

 

Adding folder `C:\\Program Files\\FME 2016\\fmeobjects\\python27' to the python path

 

Adding folder `C:\\Program Files\\FME 2016' to the python path

 

Python Exception <SyntaxError>: invalid syntax (StationingVisitor.py, line 142)

 

Error executing string `import StationingCalculator'

 

@Python failed to execute command string `import StationingCalculator'

 

@Python execution failed

Cheers

 

Lars

lifalin2016
Contributor
Forum|alt.badge.img+29
  • Author
  • Contributor
  • June 21, 2016

It suddenly occurs to me, that I don't have the 'import StationingCalculator' anywhere in my code. I assume it's some kind of FME wrapper that fails, suggesting some error in my code. I'll be back after checking that.


lifalin2016
Contributor
Forum|alt.badge.img+29
  • Author
  • Contributor
  • June 21, 2016

Hi David,

It was indeed an error (a single missing ":") that was the cause. Hrmpf. I recompiled all my PY files manually, and that revealed the error. Note to self: Do that before freaking out in the future. Wish to Safe: Make a better error message, suggesting a compilation fault as the culprit (as it's FME that initiates the compilation).

I checked whether PyCharm still worked. It does! I had a struggle last week to get it to import the fmeobjects namespace when running programs, now it just works without hiccups, and all my paths currently point to FME 64 bit . Strange! I'll try and reboot my machine to see if it's something cached.

I'm still interested in any "best practice" of having a stable Python development environment, regardless of whether it's inside FME or externally edited and run in PyCharm or something else.

Cheers

 

Lars

david_r
Celebrity
  • June 21, 2016
lifalin2016 wrote:

Hi David,

It was indeed an error (a single missing ":") that was the cause. Hrmpf. I recompiled all my PY files manually, and that revealed the error. Note to self: Do that before freaking out in the future. Wish to Safe: Make a better error message, suggesting a compilation fault as the culprit (as it's FME that initiates the compilation).

I checked whether PyCharm still worked. It does! I had a struggle last week to get it to import the fmeobjects namespace when running programs, now it just works without hiccups, and all my paths currently point to FME 64 bit . Strange! I'll try and reboot my machine to see if it's something cached.

I'm still interested in any "best practice" of having a stable Python development environment, regardless of whether it's inside FME or externally edited and run in PyCharm or something else.

Cheers

 

Lars

Good to hear you found the error.

Have you seen this article? https://knowledge.safe.com/articles/726/use-pycharm-as-fmeobjects-python-ide.html


lifalin2016
Contributor
Forum|alt.badge.img+29
  • Author
  • Contributor
  • June 22, 2016
david_r wrote:

Good to hear you found the error.

Have you seen this article? https://knowledge.safe.com/articles/726/use-pycharm-as-fmeobjects-python-ide.html

Yes, I've been using that to setup PyCharm in the first place. The problem is that it doesn't address any 32/64 bit issues and problems.


lifalin2016
Contributor
Forum|alt.badge.img+29
  • Author
  • Contributor
  • June 22, 2016
lifalin2016 wrote:

It suddenly occurs to me, that I don't have the 'import StationingCalculator' anywhere in my code. I assume it's some kind of FME wrapper that fails, suggesting some error in my code. I'll be back after checking that.

It was actually this line in the FMX that failed:

DYNAMIC_FUNCTION_CONFIGURATION Python import StationingCalculator


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