Support Questions

Find answers, ask questions, and share your expertise

NIFI ExecuteStreamCommand error pymongo

avatar
New Contributor

Hello,

 

Iwant to execute .py from nifi, I am able to do that but when saving data in mongo from the script (using pymongo) I got an error:

Executable command python3 ended in an error: Traceback (most recent call last):

'MYpath/MY.py', in line 104, in <module> 

mycol.insert(document)

 

If I execute this .py in command is working fine.

 

Command Arguments Strategy
 
Command Arguments Property
 
Command Arguments
 
MYpath/MY.py;1000000000
 
Command Path
 
python3
 
Ignore STDIN
 
true
 
Working Directory
 
path
 
Argument Delimiter
 
;
 
Output Destination Attribute
 
No value set
 
Max Attribute Length
 
200
1 ACCEPTED SOLUTION

avatar

First of all, you are getting an error inside the python file. So we can eliminate several causes (e.g. not being able to access the file, or not being able to find the file).

 

Secondly, I believe you are able to run the file from the command line, that would eliminate a problem in the file itself, or with the general logic and setup.

 

This leaves two likely suspects:

1. You are running from a different place (for instance a different node)

2. You are running with different rights (for instance a different user) or less authentication (for instance no kerberos ticket)

 

Step 1 can be tested easily by manually going to all Nifi nodes and running the command from the command line.

 

Step 2 might be tested by running something like !whoami in python from the command line, and from nifi and inspecting the results.

 

If this does not help, try to get some more info out of python on what goes wrong.


- Dennis Jaheruddin

If this answer helped, please mark it as 'solved' and/or if it is valuable for future readers please apply 'kudos'.

View solution in original post

1 REPLY 1

avatar

First of all, you are getting an error inside the python file. So we can eliminate several causes (e.g. not being able to access the file, or not being able to find the file).

 

Secondly, I believe you are able to run the file from the command line, that would eliminate a problem in the file itself, or with the general logic and setup.

 

This leaves two likely suspects:

1. You are running from a different place (for instance a different node)

2. You are running with different rights (for instance a different user) or less authentication (for instance no kerberos ticket)

 

Step 1 can be tested easily by manually going to all Nifi nodes and running the command from the command line.

 

Step 2 might be tested by running something like !whoami in python from the command line, and from nifi and inspecting the results.

 

If this does not help, try to get some more info out of python on what goes wrong.


- Dennis Jaheruddin

If this answer helped, please mark it as 'solved' and/or if it is valuable for future readers please apply 'kudos'.