Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: expected string or bytes-like object #8

Closed
Amosnomor opened this issue Nov 29, 2022 · 3 comments
Closed

TypeError: expected string or bytes-like object #8

Amosnomor opened this issue Nov 29, 2022 · 3 comments

Comments

@Amosnomor
Copy link

$ python3 bitwarden.py bitwarden_export.json
Traceback (most recent call last):
  File "bitwarden.py", line 72, in <module>
    duplicates = dups_uris(items, func=domains)
  File "/usr/local/src/bitwarden_find_duplicates/dupfinder.py", line 55, in dups_uris
    for uri in func(item):
  File "bitwarden.py", line 66, in domains
    return set(
  File "bitwarden.py", line 67, in <genexpr>
    filter(None, (transform(uri.get("uri")) for uri in entry.get("uris", [])))
  File "bitwarden.py", line 61, in transform
    match = re.match(r"(\w+:\/\/)?([\w.]+)(\/?.*)", url)
  File "/usr/lib/python3.8/re.py", line 191, in match
    return _compile(pattern, flags).match(string)
TypeError: expected string or bytes-like object

Python 3.8.10
Ubuntu Linux 20.04.5

bitwarden_export.json is well formed, and not encrypted.

@elias123tre
Copy link
Owner

I wasn't able to recreate the problem on my own machine but I have modified the function from your stack-trace to possibly fix the issue. Please try again after pulling the latest version from the repo.

@Amosnomor
Copy link
Author

Amosnomor commented Dec 1, 2022

Thank you. It is working, and also works when I rollback your last commit.

Retrying this I realized that there was a key point missing in the issue description. I was running with networking disabled. So this probably caused some unhandled problem with launching the browser and loading vue.global.prod.js and/or tailwind.min.css from unpkg.com.

Running with networking enabled, albeit on a smaller contrived bitwarden export, works fine.

Unfortunately my tin foil hat prevents me from running these external resources on my real data. I'll probably borrow your approach and recast this as a local script that directly outputs a text report.

@elias123tre
Copy link
Owner

Great that you got it solved! Your comment about pulling vue and tailwind from the network are relevant and as this script handles sensitive data, I should probably aim to remove the need for a network connection entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants