greenpass icon indicating copy to clipboard operation
greenpass copied to clipboard

Windows testing

Open berdav opened this issue 2 years ago • 5 comments

The program is currently untested on Windows. Needs analysis and test to identify the problems and fixes.

berdav avatar Nov 19 '21 10:11 berdav

I'm testing the app with Windows 10 Pro, 21H1 - Python 3.9.2 Installed with pip install greenpass

Some initial note:

  • I need to add an environmental variable on Windows called LANG and to assign it the proper value, IT in my case. Despite this the results are reported in English, but without this variable the program return error in getting os.environ["LANG"];
  • I choose the option --no-color because otherwise the windows prompt show symbols, not colors;
  • With these only two adjustments it is running okay for me using a .bat file like this:
@echo off

set PATH_TO_QR_FILE=C:\Users\utente\Desktop\new\GPimg.png

cd "C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python*"
cd Scripts

Python greenpass --no-color --qr %PATH_TO_QR_FILE%

pause

davidev94 avatar Jan 13 '22 20:01 davidev94

Thank you! I'm opening a new branch for this.

From your suggestion it would be sufficient to use the locale library to get the locale (and not the environment variable) and to remove the colors if we are on windows.

You can find the current branch with these modifications in the windows branch.

With this it should be fine, and print the localized output.

Can you test the new branch? Otherwise I will try it this weekend.

berdav avatar Jan 14 '22 11:01 berdav

Hi, I tested the windows branch and now it runs without errors, but the output remains localized in english. After few investigation I find out that... see this self-explaining capture:

C:\Users\utente>python
Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.getlocale()[0]
'Italian_Italy'
>>> locale.getdefaultlocale()[0]
'it_IT'

so I change line 191 of greenpass.py with getdefaultlocale and now it works properly. (In linux for me both functions returns it_IT) Tested also --settings and --language options and they also works ok.

NOTE I'm approching now to cooperation on Github and I had few knowledge in Python, so maybe I do not make things properly to run the new branch, but I had to use the args --clear-cache to make the --settings option works properly, otherwise it returns me an error.

davidev94 avatar Jan 15 '22 14:01 davidev94

Ok, perfect, I'm changing the getlocale to the default locale :)

Thank you again.

It always gives you that error? If so I will leave this issue open for that problem.

berdav avatar Jan 21 '22 15:01 berdav

No, now it works properly.

davidev94 avatar Jan 21 '22 17:01 davidev94