How to get Linux console window width in Python

Not sure why it is in the module shutil, but it landed there in Python 3.3. See: Querying the size of the output terminal >>> import shutil >>> shutil.get_terminal_size((80, 20)) # pass fallback os.terminal_size(columns=87, lines=23) # returns a named-tuple A low-level implementation is in the os module. Cross-platform—works under Linux, Mac OS, and Windows, probably … Read more

Is there a better Windows Console Window? [closed]

Sorry for the self-promotion, I’m the author of another Console Emulator, not mentioned here. ConEmu is opensource console emulator with tabs, which represents multiple consoles and simple GUI applications as one customizable GUI window. Initially, the program was designed to work with Far Manager (my favorite shell replacement – file and archive management, command history … Read more

Setting the correct encoding when piping stdout in Python

Your code works when run in an script because Python encodes the output to whatever encoding your terminal application is using. If you are piping you must encode it yourself. A rule of thumb is: Always use Unicode internally. Decode what you receive, and encode what you send. # -*- coding: utf-8 -*- print u”åäö”.encode(‘utf-8’) … Read more

`npm install` fails on node-gyp rebuild with `gyp: No Xcode or CLT version detected!`

Even though you have them installed (my case), but by upgrading to Catalina (10.15.*) you can get this error (my case 🙂 ). Therefore, simply installing wouldn’t help as you will get an error that they are already installed. Therefore you need to hopefully just (I) reset the tool or in worse case (II) uninstall … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)