admin管理员组

文章数量:1332361

trying to read plist in macOS sequoia. I did find but it doesn't install

How can I use python plists package?

pip3 install plists

Gives the following error:

Defaulting to user installation because normal site-packages is not writeable
Collecting plists
  Using cached plists-0.0.4.tar.gz (7.4 kB)
    ERROR: Command errored out with exit status 1:
     command: /Library/Developer/CommandLineTools/usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_4670f12a38cc4539a382c3ec2a0ed312/setup.py'"'"'; __file__='"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_4670f12a38cc4539a382c3ec2a0ed312/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-pip-egg-info-iufqpu7j
         cwd: /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_4670f12a38cc4539a382c3ec2a0ed312/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_4670f12a38cc4539a382c3ec2a0ed312/setup.py", line 80
        print "PDIR: ", pdir(), os.listdir(pdir())
              ^
    SyntaxError: invalid syntax
    ----------------------------------------
WARNING: Discarding .0.4.tar.gz#sha256=d48b2390c27d957cf54791001f679f1c96d2652b599a85a3d9d2cc4567c02ce0 (from /). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached plists-0.0.3.tar.gz (6.9 kB)
    ERROR: Command errored out with exit status 1:
     command: /Library/Developer/CommandLineTools/usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_b5366a04f87f4cc0be570288a1a967b6/setup.py'"'"'; __file__='"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_b5366a04f87f4cc0be570288a1a967b6/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-pip-egg-info-qqjk06qw
         cwd: /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_b5366a04f87f4cc0be570288a1a967b6/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_b5366a04f87f4cc0be570288a1a967b6/setup.py", line 80
        print "PDIR: ", pdir(), os.listdir(pdir())
              ^
    SyntaxError: invalid syntax
    ----------------------------------------
WARNING: Discarding .0.3.tar.gz#sha256=c3ac16d5b6262552ac5da8ac410fa7a85e918e11ff708cf5b4958f240619029b (from /). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached plists-0.0.2.tar.gz (6.9 kB)
    ERROR: Command errored out with exit status 1:
     command: /Library/Developer/CommandLineTools/usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_accf278426034dce9e1b20c280eb6e51/setup.py'"'"'; __file__='"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_accf278426034dce9e1b20c280eb6e51/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-pip-egg-info-y01b3lan
         cwd: /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_accf278426034dce9e1b20c280eb6e51/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_accf278426034dce9e1b20c280eb6e51/setup.py", line 80
        print "PDIR: ", pdir(), os.listdir(pdir())
              ^
    SyntaxError: invalid syntax
    ----------------------------------------
WARNING: Discarding .0.2.tar.gz#sha256=ed39b1dad1b0de1dfc4853e70c39bd7a14e5e3b7b86ad76c22754d49833976fd (from /). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached plists-0.0.1.tar.gz (6.2 kB)
    ERROR: Command errored out with exit status 1:
     command: /Library/Developer/CommandLineTools/usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_6072274ea7ea4f6bafbe428f95e5feb1/setup.py'"'"'; __file__='"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_6072274ea7ea4f6bafbe428f95e5feb1/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-pip-egg-info-8esq59jv
         cwd: /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_6072274ea7ea4f6bafbe428f95e5feb1/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_6072274ea7ea4f6bafbe428f95e5feb1/setup.py", line 80
        print "PDIR: ", pdir(), os.listdir(pdir())
              ^
    SyntaxError: invalid syntax
    ----------------------------------------
WARNING: Discarding .0.1.tar.gz#sha256=3c452ad85861ada94f3199658c0fadd860a3c74388346e9c58ff74132807e893 (from /). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement plists (from versions: 0.0.3.macosx-10.10-x86_64, 0.0.4.macosx-10.10-x86_64, 0.0.1, 0.0.2, 0.0.3, 0.0.4)
ERROR: No matching distribution found for plists
WARNING: You are using pip version 21.2.4; however, version 24.3.1 is available.
You should consider upgrading via the '/Library/Developer/CommandLineTools/usr/bin/python3 -m pip install --upgrade pip' command.

trying to read plist in macOS sequoia. I did find https://pypi./project/plists/#description but it doesn't install

How can I use python plists package?

pip3 install plists

Gives the following error:

Defaulting to user installation because normal site-packages is not writeable
Collecting plists
  Using cached plists-0.0.4.tar.gz (7.4 kB)
    ERROR: Command errored out with exit status 1:
     command: /Library/Developer/CommandLineTools/usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_4670f12a38cc4539a382c3ec2a0ed312/setup.py'"'"'; __file__='"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_4670f12a38cc4539a382c3ec2a0ed312/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-pip-egg-info-iufqpu7j
         cwd: /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_4670f12a38cc4539a382c3ec2a0ed312/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_4670f12a38cc4539a382c3ec2a0ed312/setup.py", line 80
        print "PDIR: ", pdir(), os.listdir(pdir())
              ^
    SyntaxError: invalid syntax
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted./packages/71/1b/24d3f3885744b41e4d58774bce89b3a20966960cd41c9d3d787485e01e1d/plists-0.0.4.tar.gz#sha256=d48b2390c27d957cf54791001f679f1c96d2652b599a85a3d9d2cc4567c02ce0 (from https://pypi./simple/plists/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached plists-0.0.3.tar.gz (6.9 kB)
    ERROR: Command errored out with exit status 1:
     command: /Library/Developer/CommandLineTools/usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_b5366a04f87f4cc0be570288a1a967b6/setup.py'"'"'; __file__='"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_b5366a04f87f4cc0be570288a1a967b6/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-pip-egg-info-qqjk06qw
         cwd: /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_b5366a04f87f4cc0be570288a1a967b6/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_b5366a04f87f4cc0be570288a1a967b6/setup.py", line 80
        print "PDIR: ", pdir(), os.listdir(pdir())
              ^
    SyntaxError: invalid syntax
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted./packages/f6/bf/d7e74c38a6d8d4993ac2631fc327c3439e06e7d01ebf54f86202393e548f/plists-0.0.3.tar.gz#sha256=c3ac16d5b6262552ac5da8ac410fa7a85e918e11ff708cf5b4958f240619029b (from https://pypi./simple/plists/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached plists-0.0.2.tar.gz (6.9 kB)
    ERROR: Command errored out with exit status 1:
     command: /Library/Developer/CommandLineTools/usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_accf278426034dce9e1b20c280eb6e51/setup.py'"'"'; __file__='"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_accf278426034dce9e1b20c280eb6e51/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-pip-egg-info-y01b3lan
         cwd: /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_accf278426034dce9e1b20c280eb6e51/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_accf278426034dce9e1b20c280eb6e51/setup.py", line 80
        print "PDIR: ", pdir(), os.listdir(pdir())
              ^
    SyntaxError: invalid syntax
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted./packages/1f/38/e451a4895d12d241f2bca8061a2d5c4d376e2e90739d892977a1266e227f/plists-0.0.2.tar.gz#sha256=ed39b1dad1b0de1dfc4853e70c39bd7a14e5e3b7b86ad76c22754d49833976fd (from https://pypi./simple/plists/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached plists-0.0.1.tar.gz (6.2 kB)
    ERROR: Command errored out with exit status 1:
     command: /Library/Developer/CommandLineTools/usr/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_6072274ea7ea4f6bafbe428f95e5feb1/setup.py'"'"'; __file__='"'"'/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_6072274ea7ea4f6bafbe428f95e5feb1/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-pip-egg-info-8esq59jv
         cwd: /private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_6072274ea7ea4f6bafbe428f95e5feb1/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/9j/s_r_lpgs2tj1v838wj4h716c0000gn/T/pip-install-eh0uq6op/plists_6072274ea7ea4f6bafbe428f95e5feb1/setup.py", line 80
        print "PDIR: ", pdir(), os.listdir(pdir())
              ^
    SyntaxError: invalid syntax
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted./packages/2b/67/18ade2a5d79733595d53a0ae174bdf11d28ac2f649db68b2377148291ad8/plists-0.0.1.tar.gz#sha256=3c452ad85861ada94f3199658c0fadd860a3c74388346e9c58ff74132807e893 (from https://pypi./simple/plists/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement plists (from versions: 0.0.3.macosx-10.10-x86_64, 0.0.4.macosx-10.10-x86_64, 0.0.1, 0.0.2, 0.0.3, 0.0.4)
ERROR: No matching distribution found for plists
WARNING: You are using pip version 21.2.4; however, version 24.3.1 is available.
You should consider upgrading via the '/Library/Developer/CommandLineTools/usr/bin/python3 -m pip install --upgrade pip' command.
Share Improve this question asked Nov 21, 2024 at 2:27 LacerLacer 5,96812 gold badges37 silver badges52 bronze badges 3
  • did you check this? stackoverflow/questions/20082935/… And please can you type pip3 --version then post your output – antzshrek Commented Nov 21, 2024 at 2:33
  • pip3 is installed by default. command: pip3 --version result: pip 21.2.4 from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/pip (python 3.9) – Lacer Commented Nov 21, 2024 at 2:51
  • print "PDIR: ", pdir(), os.listdir(pdir()) is Python2 syntax. Probably the library wasn't updated since years and is not compatible with Python3. – Maurice Meyer Commented Nov 21, 2024 at 19:12
Add a comment  | 

2 Answers 2

Reset to default 0

It looks like your issue might be coming from the version of pip3 you have 21.2.4, I suggest you update it to version 24.3.1

ERROR: Could not find a version that satisfies the requirement plists (from versions: 0.0.3.macosx-10.10-x86_64, 0.0.4.macosx-10.10-x86_64, 0.0.1, 0.0.2, 0.0.3, 0.0.4)
ERROR: No matching distribution found for plists

“My assumption here” is that you have your Python library, not in Homebrew. Therefore, I’ll advise you to take the virtual environment route

cd into the venv path where you have your python3, which I suppose should be here

cd /Library/Developer/CommandLineTools/usr/bin

then take the steps below

Step 1

sudo python3.13 -m venv path/to/venv

Step 2

source path/to/venv/bin/activate

Step 3

sudo python3.13 -m pip install --upgrade pip or pip install --upgrade pip

After which you can go ahead and install you plists package

pip3 install plists

This should get you up to speed

Looks like this package is already merged into python3 - https://docs.python./3/library/plistlib.html

import plistlib
file_name = "/Library/Preferences/com.apple.TimeMachine.plist"
with open(file_name, 'rb') as infile:
    plist = plistlib.load(infile)
print(plist["LastConfigurationTraceDate"])

本文标签: pythonmacOS Sequoia reading plistStack Overflow