Open andypiper opened 1 month ago
Looks like this is due to the state not existing yet. Commenting out line 182 where it updates the stats, then causes it to break with:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/andypiper/.fcli/state.json'
Working on understanding what that should look like...
OK, wrote
{"max_id": 0, "max_notification_id": 0, "token": ""}
into the state file and we are off to the races... got prompted to authenticate...
Notification summary: favourite (22), follow (7), reblog (1), mention (10)
Press enter to start review
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/Users/andypiper/Development/third-party/fcli/fcli-client/__main__.py", line 208, in <module>
post_list.plan()
File "/Users/andypiper/Development/third-party/fcli/fcli-client/post_list.py", line 65, in plan
self._files = get_filenames_with_algorithm(algorithm, all_files)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/andypiper/Development/third-party/fcli/fcli-client/post_list.py", line 20, in get_filenames_with_algorithm
with open(algorithm.hqa_filename or hqa_filename(), encoding='utf-8') as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/Users/andypiper/.fcli/high_quality_accounts.txt'
and then
$ touch /Users/andypiper/.fcli/high_quality_accounts.txt
[re-edit __main.py__ to add line 182 back in]
$ python -m fcli-client
Welcome to fcli 1.0.0 - (c) 2023-2024 Phil Cowans
Released under the MIT license, see LICENSE for details
More info at https://github.com/philcowans/fcli
Updating stats ... done.
Authenticating ... done.
Synchronising following list ... done.
Posting queued statuses ... done.
Fetching new posts ... Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/Users/andypiper/Development/third-party/fcli/fcli-client/__main__.py", line 206, in <module>
token = _do_sync()
^^^^^^^^^^
File "/Users/andypiper/Development/third-party/fcli/fcli-client/__main__.py", line 130, in _do_sync
response_id = response["id"]
~~~~~~~~^^^^^^
TypeError: string indices must be integers, not 'str'
... third time lucky on running, but:
Completed sync.
Notification summary: favourite (43), follow (8), mention (19), reblog (10)
Press enter to start review
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/Users/andypiper/Development/third-party/fcli/fcli-client/__main__.py", line 209, in <module>
post_list.plan()
File "/Users/andypiper/Development/third-party/fcli/fcli-client/post_list.py", line 65, in plan
self._files = get_filenames_with_algorithm(algorithm, all_files)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/andypiper/Development/third-party/fcli/fcli-client/post_list.py", line 23, in get_filenames_with_algorithm
files = list(np.random.choice([
^^^^^^^^^^^^^^^^^^
File "numpy/random/mtrand.pyx", line 950, in numpy.random.mtrand.RandomState.choice
ValueError: 'a' cannot be empty unless no samples are taken
Line 23-28 of post_list.py
:
files = list(np.random.choice([
file[0]
for file in all_files
if (file[1].username() not in ['benb', 'HamiltonsLive'])
and (file[1].full_account_name() in hqas)
], size=algorithm.non_lqa_count, replace=False))
This seems very specific to an individual user workflow?
FWIW I get this exact same error.
(I'm setting up and running in the context of a Docker container image, defined via https://github.com/philcowans/fcli/pull/15/files, which has Python 3.12.3)
I've just reproduced the same series of things on Fedora 40 with Python 3.12. Hitting the wall with
Posting queued statuses ... done.
Fetching new posts ... Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/andypiper/Development/third-party/fcli/fcli-client/__main__.py", line 184, in <module>
token = _do_sync()
^^^^^^^^^^
File "/home/andypiper/Development/third-party/fcli/fcli-client/__main__.py", line 122, in _do_sync
response_id = response['id']
~~~~~~~~^^^^^^
TypeError: string indices must be integers, not 'str'
I did a bit of debugging here and I'm not entirely certain whether the ~/.fcli/high_quality_accounts.txt
(and LQA) file needs to exist and be populated first, or how to do so.
I've created all of the directories and files (I think).
Python 3.11 on macOS: