Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError 'LANG' Unix (MacOs) #1014

Closed
Eksponat opened this issue Jan 23, 2024 · 15 comments
Closed

KeyError 'LANG' Unix (MacOs) #1014

Eksponat opened this issue Jan 23, 2024 · 15 comments

Comments

@Eksponat
Copy link

Help please, i dont know how startup this software.
Screenshot 2024-01-23 at 11 40 11 PM

@AndyIreland
Copy link

haven't you got an old windows laptop you could try using instead?

@Eksponat
Copy link
Author

unfortunately no

@Eksponat Eksponat reopened this Jan 24, 2024
@AndyIreland
Copy link

#122

@Eksponat
Copy link
Author

Eksponat commented Jan 24, 2024

Left code: my fix
Right code: original
If anyone has the same problem, here is the solution code, edit "main.py":

        langlayout = widgets.QHBoxLayout()
        self.langcombo = widgets.QComboBox()
        langlabels = widgets.QLabel(_("Interface language (need save and close)"))
        langlayout.addWidget(langlabels)
        langlayout.addWidget(self.langcombo)

        if 'LANG' in os.environ:
            for s in options.lang_list:
                self.langcombo.addItem(s)
                if options.lang_list[s].split("_")[0] ==os.environ['LANG'].split("_")[0]:
                    self.langcombo.setCurrentText(s)
        else:
        # Handle the situation when "LANG" is not present in the environment
            print ("The 'LANG' variable is not set in the support environment.")

        layout.addLayout(langlayout)
Screenshot 2024-01-24 at 5 47 02 AM

@Furtif
Copy link
Collaborator

Furtif commented Jan 24, 2024

Install requirements 🤦🏻‍♂️

@Eksponat
Copy link
Author

I did everything that was required, including in #122, none of the suggestions corrected the situation.

@Furtif
Copy link
Collaborator

Furtif commented Jan 24, 2024

I did everything that was required, including in #122, none of the suggestions corrected the situation.

correct situation is:

if not os.environ["LANG"]:
  export "LANG" = "en-US" 

more or less this.

or try : ... except: export "LANG" = "en-US"

@Furtif
Copy link
Collaborator

Furtif commented Jan 24, 2024

ex:

       # languages setting
        lgn = None
        try:
            lgn = os.environ['LANG'].split("_")[0]
        except:
            lgn = "English"
            
        langlayout = widgets.QHBoxLayout()
        self.langcombo = widgets.QComboBox()
        langlabels = widgets.QLabel(_("Interface language (need save and close)"))
        langlayout.addWidget(langlabels)
        langlayout.addWidget(self.langcombo)
        for s in options.lang_list:
            self.langcombo.addItem(s)
            if options.lang_list[s].split("_")[0] == lgn:
                self.langcombo.setCurrentText(s)
        # self.langcombo.setCurrentIndex(0)
        layout.addLayout(langlayout)
        #

this teoricaly set English by default is not exists

@Furtif
Copy link
Collaborator

Furtif commented Jan 24, 2024

or set environement var

if 'LANG' not in os.environ.keys():
  os.environ['LANG'] = "en_US"

@Furtif Furtif reopened this Jan 24, 2024
@Furtif Furtif changed the title I cant't startup this software. KeyError 'LANG' Unix (MacOs) Jan 24, 2024
@Furtif Furtif closed this as completed in aafe90b Jan 24, 2024
@Furtif Furtif reopened this Jan 24, 2024
@Furtif
Copy link
Collaborator

Furtif commented Jan 24, 2024

Please re-sync you clone repo and try :
aafe90b
cdb0f04

@Furtif
Copy link
Collaborator

Furtif commented Jan 24, 2024

try uses python 3.12
if ok close this issue.
Thanks.

Furtif added a commit that referenced this issue Jan 24, 2024
@Le-Spirit
Copy link

Le-Spirit commented Feb 8, 2024

Not exactelly related but I've fully documented my successfull installation on a Mac, It could maybe help some ?

Installation DDT4all - MacOS Catalina february 2024

1) Install Python 3.12 (latest at the time of writing, see for ex. [(https://www.pythonguis.com/installation/install-pyqt-mac/]this page))

Copy / paste the following in your favorite browser

https://www.python.org/ftp/python/3.12.2/python-3.12.2-macos11.pkg

Once the installer is downloaded, run the installer (python-3.12.2-macos11.pkg) found in your downloads folder

At the installation's end, do not forget to update the certificates for your machine

Go to Macintosh HD -> Applications -> Python 3.12 Double-clic on Install Certificates.command

and inform your Mac that it nows runs with the latest Python version

Stay in Macintosh HD -> Applications -> Python 3.12 Double-clic on Update Shell Profile.command


WARNING
If an older version of Python is already installed, you MUST remove it before proceeding

Go to /Library/Frameworks/Python.framework/Versions/

and trash the full folder (E.g. 3.11)
EO WARNING


2) Install DDT4all and it's dependencies

Go to Macintosh HD -> Applications -> Utilities Open Terminal

run the following command followed by a return (Wait for the download to resume)

git clone --recursive https://github.com/cedricp/ddt4all.git

Point to the directory

cd ddt4all

Install the dependencies

pip3 install -r requirements.txt

Your computer should now be ready for:

Upgrade the modules

git submodule update --init --recursive

3) Test the application DDT4all
Stay in Terminal Point to the directory

cd ~/ddt4all

Run the application

python3 main.py

4) make a shortcut to be able to open it without Terminal

Go to Macintosh HD -> Applications Open TextEdit -> Make a new document -> Convert it to text format

Copy / paste the following

#!/bin/bash
cd ~/ddt4all
python3 main.py

Save the document where you want to find it (E.g. Desktop folder), name it for ex. DDT4allStarter

Right-clic on the saved document and change it's name ending in "sh" (DDT4allStarter.sh)
(sh stands for shell script)

While you have the Information window open, also select Open with and point to Macintosh HD -> Applications -> Utilities -> Terminal
(you must select all applications for be able to select it, otherwise it will remain grayed)

Open Terminal

Copy / paste the following (note the empty space et the end of the command, keep it)

chmod a+x

and drag / drop after the empty space the file you just created previously, you should have for ex:

chmod a+x ~/Desktop/DDT4allStarter.sh
followed by a Return

You now just have to double-clic DDT4allStarter to start DDT4All

Enjoy, you should be ready for connection... but do not forget to install the latest database

@Furtif
Copy link
Collaborator

Furtif commented Feb 8, 2024

pip3 install -r requirements.txt

@Le-Spirit
Copy link

^ merci / thank you Furtif, previous post updated and enhanced.

@tLupus1978
Copy link

great, thanks for this perfect explanation!

@Furtif Furtif closed this as completed in dbb218a Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants