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.

TypeError: cannot convert 'NoneType' object to bytes

See original GitHub issue

I’m trying to test out the script, but I get a stack trace and am at a bit of a dead end. Am I missing something here or is this just a bug?

./bloodhound.py -u username -dc HOSTNAME -ns 127.0.0.1
Password: 
WARNING: Could not find a global catalog server. Please specify one with -gc
INFO: Connecting to LDAP server: HOSTNAME
Traceback (most recent call last):
  File "./bloodhound.py", line 5, in <module>
    bloodhound.main()
  File "/home/aaron/BloodHound.py/bloodhound/__init__.py", line 275, in main
    disable_pooling=args.disable_pooling)
  File "/home/aaron/BloodHound.py/bloodhound/__init__.py", line 68, in run
    self.pdc.prefetch_info('objectprops' in collect, 'acl' in collect)
  File "/home/aaron/BloodHound.py/bloodhound/ad/domain.py", line 329, in prefetch_info
    self.get_domains(acl=acls)
  File "/home/aaron/BloodHound.py/bloodhound/ad/domain.py", line 203, in get_domains
    for entry in entries:
  File "/home/aaron/BloodHound.py/bloodhound/ad/domain.py", line 133, in search
    for e in sresult:
  File "/home/aaron/.local/lib/python3.7/site-packages/ldap3/extend/standard/PagedSearch.py", line 64, in paged_search_generator
    None if cookie is True else cookie)
  File "/home/aaron/.local/lib/python3.7/site-packages/ldap3/core/connection.py", line 779, in search
    check_names=self.check_names)
  File "/home/aaron/.local/lib/python3.7/site-packages/ldap3/operation/search.py", line 347, in search_operation
    request['baseObject'] = LDAPDN(search_base)
  File "/usr/lib/python3.7/site-packages/pyasn1/type/univ.py", line 829, in __init__
    base.SimpleAsn1Type.__init__(self, value, **kwargs)
  File "/usr/lib/python3.7/site-packages/pyasn1/type/base.py", line 267, in __init__
    value = self.prettyIn(value)
  File "/usr/lib/python3.7/site-packages/pyasn1/type/univ.py", line 904, in prettyIn
    return bytes(value)
TypeError: cannot convert 'NoneType' object to bytes

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
dirkjanmcommented, Nov 28, 2019

This is a strange error, which I agree should be more descriptive. Let’s keep this issue open so I can track it.

0reactions
ID-Mahonecommented, Nov 18, 2021

I had the same Error and just fixed it. It was just a little typographical error in my code, after i found it everything worked fine again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Dash TypeError: cannot convert 'NoneType' object to ...
As the error message (which you've already looked up, right?) tells you, you're trying to convert something to bytes format, but that something ......
Read more >
Python bytes() - AskPython
Python bytes() is a built-in function which returns a bytes object that is an immutable ... Output. b'' TypeError: cannot convert 'NoneType' object...
Read more >
PySNMP: Cannot convert 'NoneType' object to bytes - Checkmk
The context_name interface uses None as value but PySNMP can't handle the context_name None. As default value it needs "" (empty string).
Read more >
python-dotenv fails to import PRIVATE_KEY from .env file
python -dotenv fails to import PRIVATE_KEY from .env file: "Cannot convert None of type <class 'NoneType'> to bytes".
Read more >
[Example code]-Can't convert 'NoneType' object to str implicitly
If you fail to return, then the result of that function never gets returned all the way back out. Therefore, the result returned...
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