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

Improve error message when PLC project name misspelled #92

Open
klauer opened this issue Mar 2, 2023 · 0 comments
Open

Improve error message when PLC project name misspelled #92

klauer opened this issue Mar 2, 2023 · 0 comments

Comments

@klauer
Copy link
Contributor

klauer commented Mar 2, 2023

Vincent found that having his PLC project named incorrectly meant that the startup script didn't get created and this weird exception was thrown:

Traceback (most recent call last):
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.6.0/bin/pytmc", line 10, in <module>
    sys.exit(main())
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.6.0/lib/python3.9/site-packages/pytmc/bin/pytmc.py", line 91, in main
    func(**kwargs)
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.6.0/lib/python3.9/site-packages/pytmc/bin/template.py", line 742, in main
    raise stashed_exception
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.6.0/lib/python3.9/site-packages/pytmc/bin/template.py", line 735, in main
    rendered = render_template(template_text, template_args)
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.6.0/lib/python3.9/site-packages/pytmc/bin/template.py", line 621, in render_template
    return env.get_template('template').render(context)
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.6.0/lib/python3.9/site-packages/jinja2/environment.py", line 1291, in render
    self.environment.handle_exception()
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.6.0/lib/python3.9/site-packages/jinja2/environment.py", line 925, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 8, in top-level template code
  File "/cds/group/pcds/pyps/conda/py39/envs/pcds-5.6.0/lib/python3.9/site-packages/jinja2/environment.py", line 474, in getattr
    return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'None' has no attribute 'filename'
make[1]: *** [st.cmd] Error 1
make[1]: Leaving directory `/cds/group/pcds/epics-dev/espov/ioc/mfx/lcls-plc-mfx-motion/iocBoot/ioc-mfx-motion'
make: *** [build] Error 2

This could be improved in the template by checking for a None plc and reporting an error/exiting somehow

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

1 participant