weird error on error logs (invalid literal for int() with base 10: 'wc:' [getErrorLogs])

Provider: OVH

Virtualization Type: KVM

System: Centos 7.5

OLS or Enterprise?
OLS

Installing from official server or mirror server?
official

Install Memcached extension for PHP?
yes

Install LiteSpeed Memcached?
yes

Install Memcached?
yes

Install Redis extension for PHP?
no

Install Redis?
no

Problem:

When I try to see error logs of a website it doesn’t do anything, in cyberpanel Main log shows
invalid literal for int() with base 10: ‘wc:’ [getErrorLogs]
I don’t know why.

But it’s important for server management. It’s very important to know when errors appear and why. We have other methods to check the errors, OK we use it but, this is a bug and need to be solved.

I encountered a similar issue (for access logs) on a fresh new install.
On a new domain, configured after 2.0 update work well, but on a previous domain, configured on 1.9 Cyberpanel, we have the same issue.

invalid literal for int() with base 10: ‘wc:’ [getAccessLogs]

The error logs for as are not loaded at all for any websites. Nothing, no logs form.
It appears to be hidden.

Inspect HTML and I saw few resource errors in browser:
Failed to load resource: the server responded with a status of 404 (Not Found)
…/static/baseTemplate/images/animated-overlay.gif
…/favicon.ico
…/static/baseTemplate/assets/finalBase/bootstrap.min.css.map
…/static/baseTemplate/custom-js/pnotify.nonblock.js.map
…/static/baseTemplate/bootstrap-toggle.min.js.map

The error message invalid literal for int() with base 10 would seem to indicate that you are passing a string that’s not an integer to the int() function . In other words it’s either empty, or has a character in it other than a digit.

You can solve this error by using Python isdigit() method to check whether the value is number or not. The returns True if all the characters are digits, otherwise False .

if val.isdigit():

The other way to overcome this issue is to wrap your code inside a Python try…except block to handle this error.

Python2.x and Python3.x

Sometimes the difference between Python2.x and Python3.x that leads to this ValueError: invalid literal for int() with base 10 .

With Python2.x , int(str(3/2)) gives you “1”. With Python3.x , the same gives you (“1.5”): ValueError: invalid literal for int() with base 10: “1.5”.

http://net-informations.com/python/err/int.htm