Skip to content

TypeError: LockedJSONData.__init__() got an unexpected keyword argument 'lock_file' ; regression between 3.15.1 and 3.15.3  #346

@wyattscarpenter

Description

@wyattscarpenter

Some code over in derrod/legendary#654 seems to be initting LockedJSONData with a keyword argument lock_file, which doesn't work in 3.15.3 but does work in 3.15.1 (I didn't try 3.15.2 because it is yanked).

It may be the result of some other error along the way:

C:\Users\wyatt>legendary list
[cli] INFO: Logging in...
Exception ignored in: <function BaseFileLock.__del__ at 0x000001DD246668E0>
Traceback (most recent call last):
  File "C:\Users\wyatt\AppData\Local\Programs\Python\Python312\Lib\site-packages\filelock\_api.py", line 400, in __del__
    self.release(force=True)
  File "C:\Users\wyatt\AppData\Local\Programs\Python\Python312\Lib\site-packages\filelock\_api.py", line 361, in release
    if self.is_locked:
       ^^^^^^^^^^^^^^
  File "C:\Users\wyatt\AppData\Local\Programs\Python\Python312\Lib\site-packages\filelock\_api.py", line 267, in is_locked
    return self._context.lock_file_fd is not None
           ^^^^^^^^^^^^^
AttributeError: 'LockedJSONData' object has no attribute '_context'
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\wyatt\AppData\Local\Programs\Python\Python312\Scripts\legendary.exe\__main__.py", line 7, in <module>
  File "C:\Users\wyatt\AppData\Local\Programs\Python\Python312\Lib\site-packages\legendary\cli.py", line 3060, in main
    cli.list_games(args)
  File "C:\Users\wyatt\AppData\Local\Programs\Python\Python312\Lib\site-packages\legendary\cli.py", line 191, in list_games
    if not self.core.login():
           ^^^^^^^^^^^^^^^^^
  File "C:\Users\wyatt\AppData\Local\Programs\Python\Python312\Lib\site-packages\legendary\core.py", line 253, in login
    with self.lgd.userdata_lock as lock:
  File "C:\Users\wyatt\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "C:\Users\wyatt\AppData\Local\Programs\Python\Python312\Lib\site-packages\legendary\lfs\lgndry.py", line 152, in userdata_lock
    with LockedJSONData(os.path.join(self.path, 'user.json')) as lock:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\wyatt\AppData\Local\Programs\Python\Python312\Lib\site-packages\filelock\_api.py", line 137, in __call__
    instance = super().__call__(**init_params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: LockedJSONData.__init__() got an unexpected keyword argument 'lock_file'

I'm using Python 3.12.3 and Windows 10.

I don't really know enough about either project to figure out what's going on, but though you might want to know. Good luck!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions