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

Unable to only update the template of a project #46

Open
binhonglee opened this issue Sep 11, 2017 · 5 comments
Open

Unable to only update the template of a project #46

binhonglee opened this issue Sep 11, 2017 · 5 comments

Comments

@binhonglee
Copy link

OS: Ubuntu 14.04 (through Vagrant)
Version: 2.4.4

Running the following command as recommended in README.md

pbs update_project --template /tmp/template.html

Throws this error

Usage: pbs update_project [OPTIONS]

Error: no such option: --template

I tried this instead

pbs update_project --task-presenter --template /tmp/template.html

but was thrown another error

Usage: pbs update_project [OPTIONS]

Error: Got unexpected extra argument (/tmp/template.html)

If I do

pbs update_project --task-presenter /tmp/

This is the error (still shown the same error after creating a "long_description.md" file in the "/tmp/" folder)

Traceback (most recent call last):
  File "/vagrant/pybossa/env/bin/pbs", line 11, in <module>
    sys.exit(cli())
  File "/vagrant/pybossa/env/local/lib/python2.7/site-packages/click/core.py", line 488, in __call__
    return self.main(*args, **kwargs)
  File "/vagrant/pybossa/env/local/lib/python2.7/site-packages/click/core.py", line 474, in main
    self.invoke(ctx)
  File "/vagrant/pybossa/env/local/lib/python2.7/site-packages/click/core.py", line 775, in invoke
    return self.invoke_subcommand(ctx, cmd, cmd_name, ctx.args[1:])
  File "/vagrant/pybossa/env/local/lib/python2.7/site-packages/click/core.py", line 784, in invoke_subcommand
    return cmd.invoke(cmd_ctx)
  File "/vagrant/pybossa/env/local/lib/python2.7/site-packages/click/core.py", line 676, in invoke
    ctx.invoke(self.callback, **ctx.params)
  File "/vagrant/pybossa/env/local/lib/python2.7/site-packages/click/core.py", line 325, in invoke
    return callback(*args, **kwargs)
  File "/vagrant/pybossa/env/local/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/vagrant/pybossa/env/local/lib/python2.7/site-packages/click/core.py", line 325, in invoke
    return callback(*args, **kwargs)
  File "/vagrant/pybossa/env/local/lib/python2.7/site-packages/pbs.py", line 149, in update_project
    long_description, tutorial)
  File "/vagrant/pybossa/env/local/lib/python2.7/site-packages/helpers.py", line 113, in _update_project
    with open(long_description, 'r') as f:
IOError: [Errno 2] No such file or directory: u'long_description.md'

And if I navigate to "/tmp/" to run pbs update_project, pbs update_project --task-presenter or pbs update_project --project /path/to/project.json
I get the same error message

Usage: pbs [OPTIONS] COMMAND [ARGS]...

Error: Invalid value for "--project": Could not open file: project.json: No such file or directory

Bonus: Running pbs version in a folder without a "project.json" file throws an error. Not sure if this is intended

Usage: pbs [OPTIONS] COMMAND [ARGS]...

Error: Invalid value for "--project": Could not open file: project.json: No such file or directory
@teleyinex
Copy link
Member

Hi,

If you run:

pbs update_project --help

You will get the following message:

Usage: pbs update_project [OPTIONS]

  Update project templates and information.

Options:
  --task-presenter TEXT    The project task presenter file
  --results TEXT           The project results file
  --long-description TEXT  The project long description file (Markdown)
  --tutorial TEXT          The project tutorial file
  --watch / --no-watch     Watch for changes in the current folder and update
                           the project
  --help                   Show this message and exit.

In your comment, it looks like you added -task-presenter --presenter for updating the template. That part is not needed, can you try without it? It should work.

@binhonglee
Copy link
Author

Hi @teleyinex, sorry for the delayed response. As mentioned above,

If I do

pbs update_project --task-presenter /tmp/

This is the error (still shown the same error after creating a "long_description.md" file in the "/tmp/" folder)

Traceback (most recent call last):
  File "/vagrant/pybossa/env/bin/pbs", line 11, in <module>
    sys.exit(cli())
  File "/vagrant/pybossa/env/local/lib/python2.7/site-packages/click/core.py", line 488, in __call__
    return self.main(*args, **kwargs)
  File "/vagrant/pybossa/env/local/lib/python2.7/site-packages/click/core.py", line 474, in main
    self.invoke(ctx)
  File "/vagrant/pybossa/env/local/lib/python2.7/site-packages/click/core.py", line 775, in invoke
    return self.invoke_subcommand(ctx, cmd, cmd_name, ctx.args[1:])
  File "/vagrant/pybossa/env/local/lib/python2.7/site-packages/click/core.py", line 784, in invoke_subcommand
    return cmd.invoke(cmd_ctx)
  File "/vagrant/pybossa/env/local/lib/python2.7/site-packages/click/core.py", line 676, in invoke
    ctx.invoke(self.callback, **ctx.params)
  File "/vagrant/pybossa/env/local/lib/python2.7/site-packages/click/core.py", line 325, in invoke
    return callback(*args, **kwargs)
  File "/vagrant/pybossa/env/local/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/vagrant/pybossa/env/local/lib/python2.7/site-packages/click/core.py", line 325, in invoke
    return callback(*args, **kwargs)
  File "/vagrant/pybossa/env/local/lib/python2.7/site-packages/pbs.py", line 149, in update_project
    long_description, tutorial)
  File "/vagrant/pybossa/env/local/lib/python2.7/site-packages/helpers.py", line 113, in _update_project
    with open(long_description, 'r') as f:
IOError: [Errno 2] No such file or directory: u'long_description.md'

I just realized I did not document this but I also tried doing

pbs update_project --task-presenter /tmp/custom_task_presenter.html

and was thrown the same exact error stack as above.

@teleyinex
Copy link
Member

Hi,

Yes, the issue is that the file long_description.md is not in your folder, from where you run the command and therefore it triggers this error. We should fix with an empty string. Thanks for reporting!

As a workaround for you: create a long_description.md file in the folder and it should work.

@binhonglee
Copy link
Author

Hi @teleyinex,

As I found out, not only do you need long_description.md but also results.html and tutorial.html all in the folder where the command is run but the task presenter itself does not need to be in that folder.

Something like this:

$ cd folderThatHasEverythingButTaskPresenter
$ ls
long_description.md    results.html    tutorial.html
$ ls /someOtherFolder/
task_presenter.html
$ pbs update_project --task-presenter /someOtherFolder/task_presenter.html

@teleyinex
Copy link
Member

Yes, we always use a copy of one of our templates, and that's the issue. We should create them or use an internal value to avoid this issue! Thanks for finding this bug.

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

2 participants