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

Thread exception in Bottle v0.14-dev #1455

Closed
FrViPofm opened this issue Sep 13, 2024 · 4 comments
Closed

Thread exception in Bottle v0.14-dev #1455

FrViPofm opened this issue Sep 13, 2024 · 4 comments

Comments

@FrViPofm
Copy link

Hi all,
Trying to solve an encoding problem (unable to get forms well encoded),, I have loaded 0.14.dev version.

Now on launching an app in the console, I get the message :

$ ./application.py 
Bottle v0.14-dev server starting up (using WSGIRefServer())...
Listening on http://localhost:8080/
Hit Ctrl-C to quit.

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/home/vincent/Sites/local/Blow/lib/bottle.py", line 4001, in run
    if path[-4:] in ('.pyo', '.pyc'): path = path[:-1]
TypeError: 'NoneType' object is not subscriptable
127.0.0.1 - - [13/Sep/2024 19:57:12] "GET /application/1-TestApp HTTP/1.1" 200 6624

The application seems running.
I suspect that the encoding problem is still not solved. But that's another question.

Python 3.10.12

@defnull
Copy link
Member

defnull commented Sep 13, 2024

You seem to have a module loaded with a __file__ attribute that is None, which is not a valid value for __file__. Can you find out what module that is and why it has an invalid __file__ value?

for name, mod in sys.modules.items():
    if getattr(mod, '__file__', '') is None:
        print(f"Broken module {name} has an invalid __file__")

It's not a bug in bottle, but some other module you have loaded. But a workaround would be really simple, I'll prepare one.

@defnull
Copy link
Member

defnull commented Sep 13, 2024

This seems to be a bug in pip and/or setuptools: pypa/pip#12965

@FrViPofm
Copy link
Author

Wow : Quick answers !
I'm not a big programmer.
My little app ( a kind of glassblower to make generic bottle apps ) has ;

application.py
lib/
|- __init__.py 
|- bottle.py
|- macaron.py
|- models.py
|- settings.py # not used
...

In the __init__.py :

"""
Blah...
"""
__all__=["bottle", "model", "macaron", "settings"]

Maybe something is lacking in my __init__.py ?

@FrViPofm
Copy link
Author

Hi,
Sorry for the bad news...
I've got the last 0.14-dev and now the error is :

$ ./application.py 
Bottle v0.14-dev server starting up (using WSGIRefServer())...
Listening on http://localhost:8080/
Hit Ctrl-C to quit.

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/home/vincent/Sites/local/Glassblower/lib/bottle.py", line 4000, in run
    path = getattr(module, '__file__') or ''
AttributeError: module 'sys' has no attribute '__file__'. Did you mean: '__name__'?

defnull added a commit that referenced this issue Sep 26, 2024
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