Jays
Jays

Reputation: 75

how to executescript python script in nifi

I want to put rest api output to a file with python script.

enter image description here enter image description here

test1.py - python script

import urllib.request

abc = urllib.request.urlopen('http://xxxxxxx')

print(abc.read())

Python code is fine.

enter image description here

but An error occurs in nifi.

ImportError: No module named request in at line number 1

enter image description here

what should i do?

What's the problem? Is it a Jython problem? How can I solve this?

please help me thank you.

Upvotes: 0

Views: 2089

Answers (1)

Lamanus
Lamanus

Reputation: 13541

That is Jython and you cannot use the external packages of the python in general. I'd recommend you to use the ExecuteStreamCommand with the options,

Command Arguments      /path/to/test1.py
Command Path           /path/to/python

where the python should be installed separately in the NI-FI server.

Upvotes: 1

Related Questions