Pyflink get_gateway() method is not working

  pycharm, pyflink, python

I am using pycharm to run simple pyflink latest 1.13 example (it is only two line).
for the interpreter i created virtual environment and use it in my pycharm project
I downloaded also java8
i tried many steps to solve the issue but

from pyflink.common.serialization import Encoder
from pyflink.common.typeinfo import Types
from pyflink.datastream import StreamExecutionEnvironment
from pyflink.datastream.connectors import StreamingFileSink
def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    print(f'Hi, {name}')  # Press Ctrl+F8 to toggle the breakpoint.
    env = StreamExecutionEnvironment.get_execution_environment()
    env.set_parallelism(1)

C:UsersmyuserAppDataLocalProgramsPythonPython38myvenvScriptspython.exe C:/Users/myuser/PycharmProjects/pythonProject3/main.py
Hi, PyCharm
Traceback (most recent call last):
File "C:/Users/myuser/PycharmProjects/pythonProject3/main.py", line 19, in
print_hi(‘PyCharm’)
File "C:/Users/myuser/PycharmProjects/pythonProject3/main.py", line 13, in print_hi
env = StreamExecutionEnvironment.get_execution_environment()
File "C:UsersmyuserAppDataLocalProgramsPythonPython38myvenvlibsite-packagespyflinkdatastreamstream_execution_environment.py", line 688, in get_execution_environment
gateway = get_gateway()
File "C:UsersmyuserAppDataLocalProgramsPythonPython38myvenvlibsite-packagespyflinkjava_gateway.py", line 62, in get_gateway
_gateway = launch_gateway()
File "C:UsersmyuserAppDataLocalProgramsPythonPython38myvenvlibsite-packagespyflinkjava_gateway.py", line 106, in launch_gateway
p = launch_gateway_server_process(env, args)
File "C:UsersmyuserAppDataLocalProgramsPythonPython38myvenvlibsite-packagespyflinkpyflink_gateway_server.py", line 221, in launch_gateway_server_process
return Popen(command, stdin=PIPE, preexec_fn=preexec_fn, env=env)
File "C:UsersmyuserAppDataLocalProgramsPythonPython38libsubprocess.py", line 858, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:UsersmyuserAppDataLocalProgramsPythonPython38libsubprocess.py", line 1311, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

i hope any one can help

Source: Python Questions

One Reply to “Pyflink get_gateway() method is not working”

LEAVE A COMMENT