Skip to content

Conversation

german1608
Copy link
Contributor

@german1608 german1608 commented Nov 17, 2018

Today I was reading about this library and decided to take a look. I go ahead to the introduction to see how to use it. Then I saw the following example:

import aspectlib

@aspectlib.Aspect
def strip_return_value():
    result = yield aspectlib.Proceed
    yield aspectlib.Return(result.strip())

@strip_return_value
def read(name):
    return open(name).read()

When I call the read function, it throws the following exception:

Traceback (most recent call last):
  File "test.aspect.py", line 22, in <module>
    print(read('./test.aspect.py'))
  File "/home/german/env/local/lib/python2.7/site-packages/aspectlib/__init__.py", line 253, in advising_function_wrapper
    advisor = self.advising_function(*args, **kwargs)
TypeError: strip_return_value() takes no arguments (1 given)

The error is because a parameter is missing on the strip_return_value. I added *args, **kwargs just in case.
My runtime is the following:

  • Python 2.7.12 (also happens on 3.5)
  • aspectlib 1.4.2

@ionelmc ionelmc merged commit 7dba765 into ionelmc:master Nov 20, 2018
@ionelmc
Copy link
Owner

ionelmc commented Nov 20, 2018

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants