Skip to main content
Question

Python import error


Forum|alt.badge.img
Hi everyone,

 

 

I have set up a FME workspace that works fine and is scheduled to be started every day on FME server. It has a python startup script included that also works fine and has been tested.

 

The trouble is that the scheduled job sometimes fails, telling that the python script has produced an error : 
 Python Exception <NameError>: name 'ftplib' is not defined Error executing string `# -*- coding: utf-8 -*-
 

 

The weird thing is that it happens sometimes, not every time. For now, when the process fails I just resubmit the job and it works almost everytime (it happened once that it fails again).

 

The ftplib is definitly included in the python environment (I tried to start <<path to fme server>>\fme.exe python and then the utf8 thing followed by import ftplib, it works flawlessly).

 

 

So I don't know where the issue can be, FME? FME Python? My script? Environment related issue?

 

 

Thank you for your help.

 

Anthonin

5 replies

david_r
Celebrity
  • July 15, 2015
Hi

 

 

Is it possible that you have a workspace with a Python script somewhere that (re)defines 'ftplib'?

 

 

Try setting both these values to 1 in fmeServerConfig.txt and restarting FME Server:

 

 

MAX_TRANSACTION_RESULT_SUCCESSES=1

 

MAX_TRANSACTION_RESULT_FAILURES=1

 

 

This forces the engines to restart after every translation. If this works, consider analyzing all your running workspaces with Python scripts to look for potential conflicts with ftplib.

 

 

David

Forum|alt.badge.img
  • Author
  • July 15, 2015
Thank you David.

 

 

I don't think I have something redfinning ftplib, but I will check.

 

 

I will try what you propose and keep this thread informed on what's going on after that (it should run at least a week before telling if it works or not).

 

 

Thanks.

 

 

Anthonin

Forum|alt.badge.img
  • Author
  • July 20, 2015
Hi,

 

So it appears not to work. Indeed the process failed the day after I made the changes. And the day after too (same error).

 

Besides, for some reasons I don't know why, all the processes have been queued this weekend. I back up the original configuration to see if it's better...

Forum|alt.badge.img
  • Author
  • November 17, 2015
Hi,

 

 

Just an update to tell that I still have the same issue in FME Server 2015. I tried to re-upload the workspace several times, use a custom Python interpreter, a try catch loop on the import... Nothing worked. It appears to only affect ftplib module. If nobody has any inputs on that, I think I will redesign my code so that it does not use ftplib anymore (I have the chance to have the data available on a classical HTTP server).

 

 

Thanks,

 

Anthonin

mark2atsafe
Safer
Forum|alt.badge.img+44
  • Safer
  • November 17, 2015
anthonin wrote:
Hi,

 

 

Just an update to tell that I still have the same issue in FME Server 2015. I tried to re-upload the workspace several times, use a custom Python interpreter, a try catch loop on the import... Nothing worked. It appears to only affect ftplib module. If nobody has any inputs on that, I think I will redesign my code so that it does not use ftplib anymore (I have the chance to have the data available on a classical HTTP server).

 

 

Thanks,

 

Anthonin

Have you contacted the Safe support team about this issue? If not, I think you should. www.safe.com/support


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