charlesbel / Microsoft-Rewards-Farmer

A simple bot that uses selenium to farm Microsoft Rewards written in Python
MIT License
1.01k stars 268 forks source link

locale.Error: unsupported locale setting #239

Closed Pilotkosinus closed 1 year ago

Pilotkosinus commented 1 year ago

Good day

I am trying to run the program on an AWS Kali Linux server. I always get an error message. The time and date of my server are set correctly. On my Windows machine everything runs without problems.

`Traceback (most recent call last):

File "/home/kali/Microsoft-Rewards-Farmer/main.py", line 110, in main()

File "/home/kali/Microsoft-Rewards-Farmer/main.py", line 15, in main executeBot(loadedAccounts)

File "/home/kali/Microsoft-Rewards-Farmer/main.py", line 71, in executeBot with Browser( ^^^^^^^^

File "/home/kali/Microsoft-Rewards-Farmer/src/browser.py", line 27, in init self.utils = Utils(self.webdriver, f"{self.localeLang}_{self.localeGeo}") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/home/kali/Microsoft-Rewards-Farmer/src/utils.py", line 18, in init pylocale.setlocale(pylocale.LC_NUMERIC, locale)

File "/usr/lib/python3.11/locale.py", line 626, in setlocale return _setlocale(category, locale) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

locale.Error: unsupported locale setting`

udu3324 commented 1 year ago

I think this issue is related to #233

charlesbel commented 1 year ago

Fixed it !

Pilotkosinus commented 1 year ago

Fixed it !

So I recloned the repo but still got the error.

` Traceback (most recent call last):

File "/home/kali/Microsoft-Rewards-Farmer/main.py", line 110, in main()

File "/home/kali/Microsoft-Rewards-Farmer/main.py", line 15, in main executeBot(loadedAccounts)

File "/home/kali/Microsoft-Rewards-Farmer/main.py", line 71, in executeBot with Browser( ^^^^^^^^

File "/home/kali/Microsoft-Rewards-Farmer/src/browser.py", line 27, in init self.utils = Utils(self.webdriver) ^^^^^^^^^^^^^^^^^^^^^

File "/home/kali/Microsoft-Rewards-Farmer/src/utils.py", line 18, in init pylocale.setlocale(pylocale.LC_NUMERIC, pylocale.getdefaultlocale()[0]) File "/usr/lib/python3.11/locale.py", line 626, in setlocale return _setlocale(category, locale) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

locale.Error: unsupported locale setting `

pilonull commented 1 year ago

Yea, I'm also running in to this error. On ubuntu 22.04 LTS

have tried with python3.10 and 3.11

charlesbel commented 1 year ago

I understand why, because there is no env variable declared on your machines, so I handled it in the script, try it !

pilonull commented 1 year ago

I understand why, because there is no env variable declared on your machines, so I handled it in the script, try it !

Pulled the latest zip from the releases page and the error is still occurring. Also tried downloading code zip and same issue.

python3.10: 

alex@Ubuntu-Plex:~/Desktop/Microsoft-Rewards-Farmer-master$ python3 main.py 
********************{ asdfasdfwer@gmail.com }********************
Traceback (most recent call last):
  File "/home/alex/Desktop/Microsoft-Rewards-Farmer-master/main.py", line 110, in <module>
    main()
  File "/home/alex/Desktop/Microsoft-Rewards-Farmer-master/main.py", line 15, in main
    executeBot(loadedAccounts)
  File "/home/alex/Desktop/Microsoft-Rewards-Farmer-master/main.py", line 71, in executeBot
    with Browser(
  File "/home/alex/Desktop/Microsoft-Rewards-Farmer-master/src/browser.py", line 27, in __init__
    self.utils = Utils(self.webdriver)
  File "/home/alex/Desktop/Microsoft-Rewards-Farmer-master/src/utils.py", line 20, in __init__
    pylocale.setlocale(pylocale.LC_NUMERIC, locale)
  File "/usr/lib/python3.10/locale.py", line 620, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

python3.11:

alex@Ubuntu-Plex:~/Desktop/Microsoft-Rewards-Farmer-master$ python3.11 main.py 
********************{ apasdfasdfy@gmail.com }********************
Traceback (most recent call last):
  File "/home/alex/Desktop/Microsoft-Rewards-Farmer-master/main.py", line 110, in <module>
    main()
  File "/home/alex/Desktop/Microsoft-Rewards-Farmer-master/main.py", line 15, in main
    executeBot(loadedAccounts)
  File "/home/alex/Desktop/Microsoft-Rewards-Farmer-master/main.py", line 71, in executeBot
    with Browser(
         ^^^^^^^^
  File "/home/alex/Desktop/Microsoft-Rewards-Farmer-master/src/browser.py", line 27, in __init__
    self.utils = Utils(self.webdriver)
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/home/alex/Desktop/Microsoft-Rewards-Farmer-master/src/utils.py", line 20, in __init__
    pylocale.setlocale(pylocale.LC_NUMERIC, locale)
  File "/usr/lib/python3.11/locale.py", line 626, in setlocale
    return _setlocale(category, locale)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
locale.Error: unsupported locale setting
charlesbel commented 1 year ago

I understand why, because there is no env variable declared on your machines, so I handled it in the script, try it !

Pulled the latest zip from the releases page and the error is still occurring. Also tried downloading code zip and same issue.

python3.10: 

alex@Ubuntu-Plex:~/Desktop/Microsoft-Rewards-Farmer-master$ python3 main.py 
********************{ asdfasdfwer@gmail.com }********************
Traceback (most recent call last):
  File "/home/alex/Desktop/Microsoft-Rewards-Farmer-master/main.py", line 110, in <module>
    main()
  File "/home/alex/Desktop/Microsoft-Rewards-Farmer-master/main.py", line 15, in main
    executeBot(loadedAccounts)
  File "/home/alex/Desktop/Microsoft-Rewards-Farmer-master/main.py", line 71, in executeBot
    with Browser(
  File "/home/alex/Desktop/Microsoft-Rewards-Farmer-master/src/browser.py", line 27, in __init__
    self.utils = Utils(self.webdriver)
  File "/home/alex/Desktop/Microsoft-Rewards-Farmer-master/src/utils.py", line 20, in __init__
    pylocale.setlocale(pylocale.LC_NUMERIC, locale)
  File "/usr/lib/python3.10/locale.py", line 620, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

python3.11:

alex@Ubuntu-Plex:~/Desktop/Microsoft-Rewards-Farmer-master$ python3.11 main.py 
********************{ apasdfasdfy@gmail.com }********************
Traceback (most recent call last):
  File "/home/alex/Desktop/Microsoft-Rewards-Farmer-master/main.py", line 110, in <module>
    main()
  File "/home/alex/Desktop/Microsoft-Rewards-Farmer-master/main.py", line 15, in main
    executeBot(loadedAccounts)
  File "/home/alex/Desktop/Microsoft-Rewards-Farmer-master/main.py", line 71, in executeBot
    with Browser(
         ^^^^^^^^
  File "/home/alex/Desktop/Microsoft-Rewards-Farmer-master/src/browser.py", line 27, in __init__
    self.utils = Utils(self.webdriver)
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/home/alex/Desktop/Microsoft-Rewards-Farmer-master/src/utils.py", line 20, in __init__
    pylocale.setlocale(pylocale.LC_NUMERIC, locale)
  File "/usr/lib/python3.11/locale.py", line 626, in setlocale
    return _setlocale(category, locale)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
locale.Error: unsupported locale setting

What do you get when you run in python

import locale
locale.getdefaultlocale()

?

pilonull commented 1 year ago

What do you get when you run in python

import locale
locale.getdefaultlocale()

?

image

hard to see but here's the copy/paste text, there's an _ between en and US

('en_US', 'UTF-8')

charlesbel commented 1 year ago

What do you get when you run in python

import locale
locale.getdefaultlocale()

?

image

hard to see but here's the copy/paste text, there's an _ between en and US

('en_US', 'UTF-8')

OK, and what do you have when you run in a terminal locale -a ?

pilonull commented 1 year ago

OK, and what do you have when you run in a terminal locale -a ?

image

and for easy copy/paste:

C
C.utf8
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IL
en_IL.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZM
en_ZM.utf8
en_ZW.utf8
POSIX
pilonull commented 1 year ago

Also:

image

Pilotkosinus commented 1 year ago

Unbenannt

Pilotkosinus commented 1 year ago

Unbenannt

EricThunder commented 1 year ago

Getting the exact same issue with the exact same output of the above commands as other people