Thursday 28 December 2023

Homebrew installed python on mac returns weird response including "line 1: //: is a directory" & "line 7: syntax error near unexpected token `('"

When I run python3 I get the following

 % python3
/opt/homebrew/bin/python3: line 1: //: is a directory
/opt/homebrew/bin/python3: line 3: //: is a directory
/opt/homebrew/bin/python3: line 4: //: is a directory
/opt/homebrew/bin/python3: line 5: //: is a directory
/opt/homebrew/bin/python3: line 7: syntax error near unexpected token `('
/opt/homebrew/bin/python3: line 7: `����
                                        0� H__PAGEZERO�__TEXT@@__text__TEXT;�__stubs__TEX>�
           __cstring__TEXT�>��>__unwind_info__TEXT�?X�?�__DATA_CONST@@@@__got__DATA_CONST@�@�__DATA�@__bss__DATA�H__LINKEDIT����M4���3���0���0
                                                              PP�% 
                                                                   /usr/lib/dyldY*(�;��g�g�2 
     x

      /opt/homebrew/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/Python
                8d'/usr/lib/libSystem.B.dylib&��)�� ��H����_��W��O��{������ �'X�C���`5�� �
          @������������������������T��J�_8� �_�qA��T�   ��*@8_���i � @�� ��<���R�� " ��3����5�! �����R�����0 Ձ` ը���` ��p ��R�R�� �BT�^ յ �����@99� Ձ] ��������9�\ ����R�Ri� �Tc������� �0 աZ �"�R{�t��
                                               ��C�� @��C���������_���!0 � �RN�����O��{������W���=��45�� �r�����#���!�RN�1T�@���T��RI���)��35�{B��OA�����_��
                                                                            � X@�p �A�R"�R(� �R#���{����
��@���'�{�����   �@�R    � �R��{����a

Trying to check the version with python3 --version returns the same thing

The error appears to happen randomly, it was not happening for a while (after installing python3.10 and then later python3.11 again), and then randomly started happening again one day


% od -tx1 /opt/homebrew/bin/python3 | head -n 5
0000000    2f  2f  20  2d  2d  2d  2d  2d  2d  2d  2d  2d  2d  2d  2d  2d
0000020    2d  2d  2d  2d  2d  2d  2d  2d  2d  2d  2d  2d  2d  2d  2d  2d
*
0000100    2d  2d  2d  2d  2d  2d  2d  2d  2d  2d  2d  2d  2d  2d  2d  0a
0000120    0a  2f  2f  20  50  4c  45  41  53  45  20  44  4f  20  4e  4f

% file /opt/homebrew/bin/python3
/opt/homebrew/bin/python3: data


from Homebrew installed python on mac returns weird response including "line 1: //: is a directory" & "line 7: syntax error near unexpected token `('"

No comments:

Post a Comment