kdeldycke/dotfiles

Error when testing line 101 - "COMPUTER_MODEL_SHORTHAND..."

wolfferine opened this issue · 2 comments

When testing line 101:

ioreg -c IOPlatformExpertDevice -d 2 -r | grep "\"model\" =" | python -c "print(''.join([c for c in input() if c.isupper()]))"

I get the following error (on macOS Big Sur and Python version 2.7.16)

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 1
    |   "model" = <"MacBookAir7,2">
    ^
SyntaxError: invalid syntax

Appreciate some help/explanation
(i do have programming experience - but not with python)

The issue is Python 2.7. The CLI was designed for Python 3.x, as all my scripts assume the latter is the default.

You can try:

❯ ioreg -c IOPlatformExpertDevice -d 2 -r | grep '"model" =' | python3 -c "print(''.join([c for c in input() if c.isupper()]))"
MBA

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.