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: 'ArgumentInfo' object has no attribute 'read' error on launch #63

Closed
castrojo opened this issue Mar 22, 2023 · 3 comments · Fixed by #64
Closed

AttributeError: 'ArgumentInfo' object has no attribute 'read' error on launch #63

castrojo opened this issue Mar 22, 2023 · 3 comments · Fixed by #64

Comments

@castrojo
Copy link
Member

I can't ascertain if this is yafti or an error in my yaml.

❯ yafti /etc/yafti.yml 
Traceback (most recent call last):
  File "/usr/bin/yafti", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/usr/lib/python3.11/site-packages/yafti/__main__.py", line 31, in run
    config = Config.parse_obj(yaml.safe_load(config))
                              ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/site-packages/yaml/__init__.py", line 125, in safe_load
    return load(stream, SafeLoader)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/site-packages/yaml/__init__.py", line 79, in load
    loader = Loader(stream)
             ^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/site-packages/yaml/loader.py", line 34, in __init__
    Reader.__init__(self, stream)
  File "/usr/lib64/python3.11/site-packages/yaml/reader.py", line 85, in __init__
    self.determine_encoding()
  File "/usr/lib64/python3.11/site-packages/yaml/reader.py", line 124, in determine_encoding
    self.update_raw()
  File "/usr/lib64/python3.11/site-packages/yaml/reader.py", line 178, in update_raw
    data = self.stream.read(size)
           ^^^^^^^^^^^^^^^^
AttributeError: 'ArgumentInfo' object has no attribute 'read'
@blake-lucas
Copy link

I'm getting this same error on my image as well. My yaml can be found here. I haven't made changes to the yaml recently and it did use to work a day or two ago.

@castrojo
Copy link
Member Author

debug output:

❯ yafti /etc/yafti.yml --debug
Traceback (most recent call last):
  File "/usr/bin/yafti", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/usr/lib/python3.11/site-packages/yafti/__main__.py", line 31, in run
    config = Config.parse_obj(yaml.safe_load(config))
                              ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/site-packages/yaml/__init__.py", line 125, in safe_load
    return load(stream, SafeLoader)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/site-packages/yaml/__init__.py", line 79, in load
    loader = Loader(stream)
             ^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/site-packages/yaml/loader.py", line 34, in __init__
    Reader.__init__(self, stream)
  File "/usr/lib64/python3.11/site-packages/yaml/reader.py", line 85, in __init__
    self.determine_encoding()
  File "/usr/lib64/python3.11/site-packages/yaml/reader.py", line 124, in determine_encoding
    self.update_raw()
  File "/usr/lib64/python3.11/site-packages/yaml/reader.py", line 178, in update_raw
    data = self.stream.read(size)
           ^^^^^^^^^^^^^^^^
AttributeError: 'ArgumentInfo' object has no attribute 'read'

@marcoceppi
Copy link
Collaborator

Okay, this was an interesting one. I typically use python -m yafti ... to test locally in my virtual environment. So at first I was unable to replicate this. However, when I switched to running yafti bin directly in my venv I was able to replicate it. The PR #64 fixes this but essentially python -m yafti executes the __main__.py file which resulted in the last line executing typer.run(run). The entrypoint for the yafti bin was pointed directly to the yafti.__main__:run method which means when we switched to typer in 0.4.0 the binary wasn't actually executing typer.run which means the command line arguments weren't being parsed. This has been verified working once #64 lands and I'll make sure 0.4.1 goes out tonight

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 a pull request may close this issue.

3 participants