Hello, I am trying to retrieve the twitter counts from command line but I get this error message: do you have any clue on how solving this issue? thanks

C:\Users\User_1>twarc2 searches --archive --counts-only --granularity day --start-time “2020-04-30” --end-time “2020-05-30” query_users.txt countstw.csv
0%|▏ | Processed 4/1500 lines of input file [01:19<8:16:32, 19.91s/it]

Traceback (most recent call last):
File “C:\Users\39333\anaconda3\lib\runpy.py”, line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File “C:\Users\39333\anaconda3\lib\runpy.py”, line 87, in run_code
exec(code, run_globals)
File "C:\Users\39333\anaconda3\Scripts\twarc2.exe_main
.py", line 7, in
File “C:\Users\39333\anaconda3\lib\site-packages\click\core.py”, line 1128, in call
return self.main(*args, **kwargs)
File “C:\Users\39333\anaconda3\lib\site-packages\click\core.py”, line 1053, in main
rv = self.invoke(ctx)
File “C:\Users\39333\anaconda3\lib\site-packages\click\core.py”, line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “C:\Users\39333\anaconda3\lib\site-packages\click\core.py”, line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “C:\Users\39333\anaconda3\lib\site-packages\click\core.py”, line 754, in invoke
return __callback(*args, **kwargs)
File “C:\Users\39333\anaconda3\lib\site-packages\click\decorators.py”, line 38, in new_func
return f(get_current_context().obj, *args, **kwargs)
File “C:\Users\39333\anaconda3\lib\site-packages\twarc\command2.py”, line 1724, in searches
for result in response:
File “C:\Users\39333\anaconda3\lib\site-packages\twarc\client2.py”, line 269, in _search
== last_time_start
UnboundLocalError: local variable ‘last_time_start’ referenced before assignment

Can you provide the query_users.txt for debugging? Feel free to open an issue on Issues · DocNow/twarc · GitHub to attach a file there, or DM me.

What exact version of twarc are you running? pip list command will show it. Is it the latest version? Upgrade with:

pip install --upgrade twarc

yes, it is the latest version 2.10. I will DM you for the file.txt

1 Like

The issue was with a query that used a non existing / invalid user ID:

from:923342569446236000

Following up here: Error using searches counts-only with twarc2 from command line · Issue #615 · DocNow/twarc · GitHub