Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codec can't {decode,encode} #35

Closed
JohnAZoidberg opened this issue Mar 28, 2021 · 9 comments
Closed

codec can't {decode,encode} #35

JohnAZoidberg opened this issue Mar 28, 2021 · 9 comments

Comments

@JohnAZoidberg
Copy link

JohnAZoidberg commented Mar 28, 2021

Took the release binary 3.1.1-11 from the SDR

$ ilorest serverinfo –power --url https://15.111.111.111 -u username -p password               
Traceback (most recent call last):                                                                
  File "rdmc.py", line 800, in <module>                                                           
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 19: ordinal not in range(128)
Failed to execute script rdmc                                                                     
$ ilorest
iLOrest : RESTful Interface Tool version 3.1.1
Copyright (c) 2014-2020 Hewlett Packard Enterprise Development LP
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Both remote and local mode is accessible when RESTful Interface Tool is run as administrator. Only remote mode is available for non-admin user groups.
iLOrest > serverinfo –power --url https://15.111.111.111 -u username -p password                                    
Traceback (most recent call last):
  File "rdmc.py", line 810, in <module>
  File "rdmc.py", line 314, in run
  File "rdmc.py", line 380, in cmdloop
  File "shlex.py", line 275, in split
  File "shlex.py", line 25, in __init__
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 11: ordinal not in range(128)
Failed to execute script rdmc

Is it built with Python2 or Python3?

@rajeevkallur
Copy link

rajeevkallur commented Mar 29, 2021

3.1.1 was python2. But the above error will be resolved in next versions of ilorest (3.2.1 which is python3). To be released sometime in April.

@JohnAZoidberg
Copy link
Author

JohnAZoidberg commented Mar 31, 2021

Great, thanks!

@knumskull
Copy link

knumskull commented Mar 31, 2021

@JohnAZoidberg I just recently recognized, by copying information from HP website, it contains wrong characters. Maybe it's worth to write the whole command manually on the shell.

@JohnAZoidberg
Copy link
Author

JohnAZoidberg commented Mar 31, 2021

What contains wrong characters?
As you can see I did both, write the command in the ilorest shell and also completely in bash.

@knumskull
Copy link

knumskull commented Apr 1, 2021

If I copy your command from above and paste it into bash shell on my system, you will see same error as you got.

$ ilorest serverinfo –power --url https://15.111.111.111 -u username -p password
Traceback (most recent call last):
  File "rdmc.py", line 800, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 19: ordinal not in range(128)
Failed to execute script rdmc

writing the same command manually, entering each character by each, it will work and trying to establish a connection.

$ ilorest serverinfo -power --url https://15.111.111.111 -u username -p password
iLOrest : RESTful Interface Tool version 3.1.1
Copyright (c) 2014-2020 Hewlett Packard Enterprise Development LP
----------------------------------------------------------------------------------------------
^CTraceback (most recent call last):
  File "rdmc.py", line 810, in <module>
  File "rdmc.py", line 302, in run
  File "rdmc.py", line 187, in _run_command
  File "extensions/iLO COMMANDS/ServerInfoCommand.py", line 67, in run
  File "extensions/iLO COMMANDS/ServerInfoCommand.py", line 424, in serverinfovalidation
  File "rdmc_base_classes.py", line 206, in login_select_validation
  File "extensions/COMMANDS/LoginCommand.py", line 100, in loginfunction
  File "build/bdist.linux-x86_64/egg/redfish/ris/rmc.py", line 201, in login
  File "build/bdist.linux-x86_64/egg/redfish/ris/gen_compat.py", line 94, in getgen
  File "build/bdist.linux-x86_64/egg/redfish/rest/v1.py", line 347, in _get_root
  File "build/bdist.linux-x86_64/egg/redfish/rest/v1.py", line 109, in get
  File "build/bdist.linux-x86_64/egg/redfish/rest/connections.py", line 225, in rest_request
  File "urllib3/request.py", line 66, in request
  File "urllib3/request.py", line 87, in request_encode_url
  File "urllib3/poolmanager.py", line 321, in urlopen
  File "urllib3/connectionpool.py", line 622, in urlopen
KeyboardInterrupt
Failed to execute script rdmc

Same applies when running the command in ilorest interactive shell. For me it works.

some details of my system

[cloud-user@rhel7 ~]$ rpm -q ilorest
ilorest-3.1.1-11.x86_64
[cloud-user@rhel7 ~]$ uname -a
Linux rhel7.crazy.lab 3.10.0-1127.8.2.el7.x86_64 #1 SMP Thu May 7 19:30:37 EDT 2020 x86_64 x86_64 x86_64 GNU/Linux
[cloud-user@rhel7 ~]$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.8 (Maipo)
[cloud-user@rhel7 ~]$ python --version
Python 2.7.5
[cloud-user@rhel7 ~]$ python3 --version
-bash: python3: command not found

@JohnAZoidberg
Copy link
Author

JohnAZoidberg commented Apr 8, 2021

You're right! The issue is the - sign in front of power.
It's 0xe2 0x80 0x93 instead of 0x2d: https://www.fileformat.info/info/unicode/char/2013/index.htm

I guess I must've copied it from somewhere.

@JohnAZoidberg
Copy link
Author

JohnAZoidberg commented Apr 8, 2021

It's present a couple times in this repo. Please replace it with the ascii character: https://sourcegraph.com/search?q=repo:%5Egithub%5C.com/HewlettPackard/python-redfish-utility%24+%E2%80%93&patternType=literal

@rajeevkallur
Copy link

rajeevkallur commented Jul 1, 2021

Please use version 3.2.2 and let us know if there is any issue.

JohnAZoidberg added a commit to JohnAZoidberg/python-redfish-utility that referenced this issue Jul 26, 2021
@JohnAZoidberg
Copy link
Author

JohnAZoidberg commented Jul 26, 2021

You're right. It does work now, thanks!
But still let's remove those weird minus signs :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants