Skip to content

AttributeError: 'NoneType' object has no attribute 'func' #395

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

Closed
nick-0307 opened this issue Jun 27, 2020 · 10 comments
Closed

AttributeError: 'NoneType' object has no attribute 'func' #395

nick-0307 opened this issue Jun 27, 2020 · 10 comments

Comments

@nick-0307
Copy link

When I import multiprocessing, there is an error saying that:
File "main.py", line 5, in
File "multiprocessing.py", line 3, in
File "select.py", line 14, in
AttributeError: 'NoneType' object has no attribute 'func'

Would you please help me solve this problem?

@kitplummer
Copy link

I get the same with the base64 module:

>>> %Run -c $EDITOR_CONTENT
Traceback (most recent call last):
  File "<stdin>", line 7, in <module>
  File "/lib/base64.py", line 9, in <module>
  File "/lib/re.py", line 11, in <module>
AttributeError: 'NoneType' object has no attribute 'func'

@andrewleech
Copy link
Contributor

In both cases here the ffi modules for select and re respectively have been installed, but they can't find the referenced dynamic libraries.

@kitplummer if you see re.py", line 11, in

pcre_compile = pcre.func("p", "pcre_compile", "sipps")
it's clear pcre is None meaning the ffi command earlier couldn't find it
pcre = ffilib.open("libpcre")

@andrewleech
Copy link
Contributor

@jimmo would it make most sense for ffilib.open() raise an exception if it can't find the library?

@kitplummer
Copy link

@andrewleech - thanks, eventually dug in enough to find that being the issue.

I'm working with a Raspberry Pico W, which apparently doesn't have the lib. :) Working around it now, but that might be worth adding to make it obviously clear.

@andrewleech
Copy link
Contributor

Ah yes, the ffi based libs only work on Linux.

How did you install these libraries out of interest?

This repo is in the process of being reorganised a bit with the recent manifest file charges, working towards making library compatibility and installation easier and more reliable.

@kitplummer
Copy link

I installed with upip.

@kitplummer
Copy link

For posterity, I was trying to use urllib.parse for urlencode purposes - which pulls in micropython-re-pcre (and the ffilib dep) by default.

@andrewleech
Copy link
Contributor

Ah thanks, that context definitely helps! urllib.parse is definitely something I can see as useful on rpi-w / networked boards, it'd be worth updating it to work with the built-in re module.

@kitplummer
Copy link

Should've mentioned, the quick-fix for me was to simply delete the re.py and ffilib.py files from the Pico's lib/ subdir - and using the built-in stuff.

@jonnor
Copy link

jonnor commented Aug 25, 2024

There seems to have been a fix/clarification provided. Proposing to close this issue.

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

5 participants