question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error using searches counts-only with twarc2 from command line

See original GitHub issue

Via: https://twittercommunity.com/t/error-using-searches-counts-only-with-twarc2-from-command-line/168793

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
SamHamescommented, Apr 1, 2022

I do have a partial fix for the original issue, but haven’t had a chance to properly test it yet.

I think the question about error handling needs to be considered separately - I’d rather fail early and loudly where all the context is available. Also the logic is already more convoluted than I’d like, so I’d prefer to defer changes to when we have a better idea about #608

Related though, I have been thinking about an approach to resuming long running processes, which might make loud failure more palatable - on error you could fix the input file, then rerun the same command with a --resume option, maybe?

1reaction
SamHamescommented, Mar 25, 2022

I will investigate later today if I get a chance.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error using searches counts-only with twarc2 from command line
Hello, I am trying to retrieve the twitter counts from command line but I get this error message: do you have any clue...
Read more >
twarc2 (en) - twarc
twarc2 is a command line tool and Python library for archiving Twitter JSON ... The stream command will use Twitter's API tweets/search/stream endpoint...
Read more >
twarc2 search without configure on Windows throws JSON ...
The sample requests i made on cmd.exe are: twarc2 search endsars twarc2 search '#endsars' --archive it then returns the error message: ...
Read more >
Even Easier Twitter API Searching with Twarc - Research - QUT
Using the new searches command in Twarc as of version 2.6.0, ... twarc2 searches --counts-only auspol_test.csv auspol_test_counts.csv.
Read more >
Code - Tweet Extraction from Command Line with Twarc2
I just found the easiest (and the maximalist!) way of getting tweet data using Twitter API v2. And the monthly cap is 10...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found