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

yaml-to-latex.py error: AttributeError: 'str' object has no attribute 'name' #10

Closed
weinman opened this issue Apr 16, 2020 · 10 comments
Closed

Comments

@weinman
Copy link

weinman commented Apr 16, 2020

I am trying to use the convenient script for generating the metadata.tex file, but I get an error.

Host Platforms: macOS 10.14.6 and Ubuntu 18.04
Python: 3.7 (both cases)
PyYAML-5.3.1 pyaml-20.4.0

Here is the command invoked: ./yaml-to-latex.py -i metadata.yaml -o metadata.tex

and the error:

Traceback (most recent call last):
  File "./yaml-to-latex.py", line 88, in <module>
    content = generate_latex_metadata(filename_in, article)
  File "./yaml-to-latex.py", line 49, in generate_latex_metadata
    "".format(filename=filename, _=article, abstract=abstract))
AttributeError: 'str' object has no attribute 'name'

(Although I don't think it's the source of the problem, I note it looks like the version on Overleaf differs from the current version of the template. Whereas I already burned over an hour trying to get the template to work on a local system (an failed) and opted instead to go to Overleaf, this seems like an unfortunate place to have outdated code.)

Pointers welcome! The overhead to submission so far has been quite steep.

@weinman
Copy link
Author

weinman commented Apr 16, 2020

Update: The proximal cause was a typo somewhere in my own yaml file edit, though I'm not sure where (I reverted and am now making line by line edits of the original, which I later determined to have successfully worked—something I should have tried originally!).

I suppose the lesson is better error checking and reporting in the python script might be helpful.

@weinman weinman closed this as completed Apr 16, 2020
@rougier
Copy link
Member

rougier commented Apr 22, 2020

I agree. Did you find what was the typo (might be useful for debug)?

@weinman
Copy link
Author

weinman commented Apr 25, 2020

I am fairly certain I'd forgotten the comma between the author Id and the asterisk indicating the corresponding author.

Writing

 authors:
  - name: Jerod Weinman
    affiliations: 1*

instead of

 authors:
  - name: Jerod Weinman
    affiliations: 1,*

produces the same error

@rougier
Copy link
Member

rougier commented Apr 27, 2020

Ok thanks. I need to make this script a bit more robust.

@ev-br
Copy link
Contributor

ev-br commented May 1, 2020

As a datapoint: same error if there's a space between a comma and an asterisk

    affiliations: 1, *

Not sure if related: there's a warning (I'm still on python 3.5, not sure if it matters)

$ make
./yaml-to-latex.py -i metadata.yaml -o metadata.tex
/home/br/sweethome/proj/10yr_repro/paper/article.py:171: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  document = yaml.load(data)
latexmk -pdf -pdflatex="xelatex -interaction=nonstopmode" -use-make article.tex
Latexmk: This is Latexmk, John Collins, 1 January 2015, version: 4.41.

@weinman
Copy link
Author

weinman commented May 1, 2020

I got the same warning, but regardless of whether there was a space. I assume this is a general deprecation warning for something used in the script wrt to the client (i.e., you and me) version of the PyYAML library used.

@ev-br
Copy link
Contributor

ev-br commented May 1, 2020

Also, if this script is being worked on, the pyyaml requirement would be good to document somewhere.

@rougier
Copy link
Member

rougier commented May 3, 2020

@ev-br Good point. I need to work on this script. It may have to wait for the end of the challenge because we now have a lof of entry to review.

@ev-br
Copy link
Contributor

ev-br commented May 3, 2020

I can volunteer (bandwidth permitting etc), also definitely after finishing up my piece for the challenge.

@rougier
Copy link
Member

rougier commented May 4, 2020

@ev-br 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

No branches or pull requests

3 participants