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

AttributeError: module 'inspect' has no attribute 'getargspec' #1425

Open
rikhtehgaran opened this issue Jul 28, 2023 · 1 comment
Open

AttributeError: module 'inspect' has no attribute 'getargspec' #1425

rikhtehgaran opened this issue Jul 28, 2023 · 1 comment

Comments

@rikhtehgaran
Copy link

OS= win10
Python = 3.11.4
bottle = 0.12.25
bottle-sqlite = 0.2.0

it's my code:

from bottle import Bottle,install, template,TEMPLATE_PATH
from bottle_sqlite import SQLitePlugin

app = Bottle()

sqlite_plugin = SQLitePlugin(dbfile='my.db')
app.install(sqlite_plugin)

@app.route('/show1/<post_id:int>')
def show(db, post_id):
    c = db.execute('SELECT title, content FROM posts WHERE id = ?', (post_id,))
    row = c.fetchone()
    return template('show_post', title=row['title'], text=row['content'])

@app.route('/show2/<post_id:int>',skip=[sqlite_plugin])
def show(db, post_id):
    c = db.execute('SELECT title, content FROM posts WHERE id = ?', (post_id,))
    row = c.fetchone()
    return template('show_post', title=">>>> "+row['title'], text=row['content'])

@app.route('/hello')
def hello():
    return "<h1 style='color:blue'>Hello There!</h1>"

if __name__ == "__main__":
    app.run(host='0.0.0.0',port=8001)

Error:

Bottle v0.12.25 server starting up (using WSGIRefServer())...
Listening on http://0.0.0.0:8001/
Hit Ctrl-C to quit.

Traceback (most recent call last):
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\bottle.py", line 876, in _handle
    return route.call(**args)
           ^^^^^^^^^^
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\bottle.py", line 201, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
                                               ^^^^^^^^^^^^^^
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\bottle.py", line 504, in call
    return self._make_callback()
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\bottle.py", line 540, in _make_callback
    callback = plugin.apply(callback, context)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\bottle_sqlite.py", line 114, in apply
    argspec = inspect.getargspec(_callback)
              ^^^^^^^^^^^^^^^^^^
AttributeError: module 'inspect' has no attribute 'getargspec'
192.168.3.19 - - [28/Jul/2023 03:57:12] "GET /hello HTTP/1.1" 500 749

Selection_049

@FriedrichFroebel
Copy link

As you can see from the traceback, this is an issue in the bottle_sqlite plugin and should be reported there. Nevertheless, the repository over there already has three unmerged PRs covering this topic, with the oldest one being from 2018: bottlepy/bottle-sqlite#23

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