I finally found the reason, why my dashboard does not work under Windows: The function “subprocess()” has difficulties encoding the boxchars, which René uses in his earnings calculator. This can be seen, further below => All lines of the earnings calculator work fine, until it encounters the very first boxchar of its output. This is also shown in the error message.
I have created following test script:
import sys
import subprocess
def main():
process = subprocess.Popen([sys.executable,
'C:\\Users\\lukas\\Downloads\\node07\\earnings.py',
'C:\\Users\\lukas\\Downloads\\node07\\db'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
print("STDOUT:\n", stdout.decode())
print("\nSTDERR:\n", stderr.decode())
if __name__ == "__main__":
main()
This script produces following output:
STDOUT:
←[4mJuly 2024 (Version: 14.0.0) [snapshot: 2024-07-12 20:53:06Z]←[0m
REPORTED BY TYPE METRIC PRICE DISK BANDWIDTH PAYOUT
Node Ingress Upload -not paid- 540.14 GB
Node Ingress Upload Repair -not paid- 21.51 GB
Node Egress Download $ 2.00 / TB (avg) 10.06 GB $ 0.02
Node Egress Download Repair $ 2.00 / TB (avg) 603.65 KB $ 0.00
Node Egress Download Audit $ 2.00 / TB (avg) 72.70 KB $ 0.00
Node Storage Disk Current Total -not paid- 333.24 GB
STDERR:
Traceback (most recent call last):
File "C:\Users\lukas\Downloads\node07\earnings.py", line 527, in <module>
print("Node\t\tStorage\t \u251c Blobs\t-not paid-\t {}".format(formatSize(sum(disk))))
File "C:\Users\lukas\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u251c' in position 27: character maps to <undefined>
Unfortunately, now that I have found the reason for the Windows-incompatibility, I cannot fix it. I tried everything, I could think of, but my hobbyist skills at programming are now exhausted. For now, the script is Unix-only.
If someone can find a fix and share it, I would happily include it.