简体   繁体   中英

how to executescript python script in nifi

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

在此处输入图片说明 在此处输入图片说明

test1.py - python script

import urllib.request

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

print(abc.read())

Python code is fine.

在此处输入图片说明

but An error occurs in nifi.

ImportError: No module named request in at line number 1

在此处输入图片说明

what should i do?

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

please help me thank you.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM