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.

AttributeError: 'function' object has no attribute 'allow_extra_args'

See original GitHub issue

AttributeError: 'function' object has no attribute 'allow_extra_args'

Python version: 3.6 Command: python3 setup.py --command-packages=click_man.commands man_pages

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
stephenfincommented, Aug 7, 2018

This issue is main does not return a click object. You need to modify it like so.

diff --git a/mycli.py b/mycli.py
index 0b87781..fb3afb4 100644
--- a/mycli.py
+++ b/mycli.py
@@ -16,9 +16,7 @@ def test_command():
     """
     click.echo("Hello world")
 
-def main():
-    mycli.add_command(test_command)
-    mycli()
+mycli.add_command(test_command)
 
 if __name__ == '__main__':
-    main()
+    mycli()
diff --git a/setup.py b/setup.py
index 2afc564..20a85e7 100644
--- a/setup.py
+++ b/setup.py
@@ -9,7 +9,7 @@ setup(
     install_requires=['click'],
     entry_points='''
         [console_scripts]
-        my=mycli:main
+        my=mycli:mycli
     ''',
     classifiers=[
         'Natural Language :: English',

This ensures that (a) the add_command function is always called and the command registered and (b) you’re trying to document a click object and not a random function.

0reactions
ElieDeloumeaucommented, Aug 8, 2018

It works! Many thanks 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

'function' object has no attribute 'func_name' and python 3
The function attributes named func_X have been renamed to use the __X__ form, freeing up these names in the function attribute namespace for ......
Read more >
AttributeError: 'function' object has no attribute - Databricks
Problem You are selecting columns from a DataFrame and you get an error message. ERROR: AttributeError: 'function' object has no attribute ...
Read more >
AttributeError: 'function' object has no attribute 'currentframe ...
I have confirmed this bug exists on the main branch of pandas. Reproducible Example. import pandas.io.sql import sqlalchemy dbEngine ...
Read more >
AttributeError: 'function' object has no attribute 'fs' - Part 1 (2020)
Hi all,. I'm trying to apply what I learned in chapter 4. Sofar, I have the following notebook. However, when I run it,...
Read more >
AttributeError: 'function' object has no attribute 'service_context'
Error - AttributeError: 'function' object has no attribute 'service_context'. Hi all,. I am trying out some code on Azure machine learning ...
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