Error: invalid literal for int() with base 10: ‘-‘ [calculateBandwidth]

invalid literal for int() with base 10: ‘-‘ [calculateBandwidth]


This message keeps showing up in my error log, but a few variations.  Basically, right after the 10: and before the [calculateBandwidth] there is a character or string in single quotes.  The script is expecting that data to be a number, not a character.  For some reason, the script keeps trying to analyze data that isn’t in integer format.  So, I’ve been able to track down the following

My list of cron jobs is stored in


That file lists the various scripts to be executed as well as how often (the numbers in front designate how frequently a cron job is executed.

The job that I think is in play here is:

0 * * * * /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/ >/dev/null 2>&1


The 0 * * * * means that the cron job is called at minute 0, so every hour, the script will execute.

the /dev/null 2>&1 I think means that it will redirect “standard error” to “standard output” (which I don’t fully understand) but basically it means that no errors will get sent to the display.

So now I need to learn python to understand what the script is doing.

Here is the script. I can understand it a little, but not yet enough to figure out the problem.  What I think is happening is the script will cycle through each created website and records bandwidth usage in a file.  For whatever reason, it is pulling some characters instead of numbers for something.  I’ll take a closer look at it when I have extra time.  Right now, this doesn’t seem to be any sort of critical error, so I’m putting it on the back burner.

If you have gotten a similar error and have found a fix before I update this post, please let me know how you did it in the comments.



Leave a Reply