nokia / RED

RED - Robot Editor
Other
339 stars 112 forks source link

NumPy library causes "Unable to communicate with XML-RPC server" #346

Open modrz opened 4 years ago

modrz commented 4 years ago

All of a sudden while using Red to familiarize myself with Red + Robot Framework I stumbled upon errors everywhere in Red with "Unable to communicate with XML-RPC server". image

I tried to update to your latest version here, but still same problem persisted. It started to show up when I tried to show documentation, then it continues to show XML-RPC server errors almost everywhere. I'm not able to use my project anymore, even after restarting Red.

image

I was able to trace back where my problems are coming from.

I had added a Python file with following code:

stagingvars = {"BASEURL":"https://api-staging.something.com/network/things"} prodvars = {"BASEURL":"https://api-prod.something.com/network/things"} emptyvars = {"DUMMY":""}

def get_variables(env):

if env == 'PROD':
    return prodvars
elif env == 'STAGING':
    return stagingvars
else: 
    return emptyvars

===

This code did not gave me any problems until I decided to use the upper function in this code:

from numpy.core.defchararray import upper stagingvars = {"BASEURL":"https://api-staging.something.com/network/things"} prodvars = {"BASEURL":"https://api-prod.something.com/network/things"} emptyvars = {"DUMMY":""}

def get_variables(env):

if upper(env) == 'PROD':
    return prodvars
elif env == 'STAGING':
    return stagingvars
else: 
    return emptyvars

===

Now after some seconds Red starts to throw me the XML-RPC server errors everywhere, right until I remove the "from numpy.core.defchararray import upper" and upper function from the code.

1) I work under WIndows 7 64bit 2) I installed Python 3.7 (64bit) 3) pip install robotframework 3) pip install --upgrade RESTinstance 4) downloaded Red and unzipped it and run Red from the unzipped folder 5) created a project to familiarize myself with Red, Robot Framework and REST API calls tests

If I need to provide anything more, please let me know.

Originally posted by @gvdwinkel in https://github.com/nokia/RED/issues/295#issuecomment-553619680

modrz commented 4 years ago

Hi,

It looks like there is some problem with RED session server and NumPy library. Similar problem exists in libdoc generation. we fixed it by generating libdocs in separate process. In your case python server extracts variables from variable file. We need to investigate it.

If you need numpy only for string manipulation, I think you can use builtin upper() method which should not cause such problems. https://docs.python.org/3/library/stdtypes.html#str.upper

gvdwinkel commented 4 years ago

Thank you for the quick reply. Indeed using the builtin str.upper method does not cause me these problems. That does solve it for me, although it might be interesting still to know what causes this issue when using the NumPy library.

BTW could you edit your 1st post above (my original comment) to change my original URL in 2nd example to be replaced with "something" (like in my 1st example)..I accidentally forgot to replace it myself.

modrz commented 4 years ago

Good to hear you can use builtin methods to solve it. Yes, this is interesting case indeed and may cause similar problems in different places, we will investigate it. BTW, It looks like the problem exists only on Windows platforms.