Pylons / pyramid-cookiecutter-starter

A Cookiecutter (project template) for creating a Pyramid starter project with choices for template language (Jinja2, Chameleon, or Mako), persistent backend (none, SQLAlchemy with SQLite, or ZODB), and mapping of URLs to routes (URL dispatch or traversal)
95 stars 53 forks source link

Cannot create new project! #43

Closed mikeckennedy closed 7 years ago

mikeckennedy commented 7 years ago

Hi guys,

I don't know how the system worked its way into this state, but it seems you cannot create a new project, and run it, from this template.

Try these steps:

  1. mkdir web_proj
  2. cd web_proj
  3. python3 -m venv --copies .env
  4. . ./.env/bin/activate
  5. pip install cookiecutter
  6. cookiecutter https://github.com/Pylons/pyramid-cookiecutter-starter branch=1.9-branch (branch is optional, also fails on latest)
  7. Choose defaults (2 for template)
  8. cd pyramid_scaffold
  9. python setup.py develop
  10. pserve development.ini

Error:

... 
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/configparser.py", line 394, in before_get
    self._interpolate_some(parser, option, L, value, section, defaults, 1)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/configparser.py", line 444, in _interpolate_some
    "found: %r" % (rest,))
configparser.InterpolationSyntaxError: Error in file development.ini: '%' must be followed by '%' or '(', found: '%{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'

Any ideas what broke? Did I somehow do something wrong?

Thanks, Michael

mikeckennedy commented 7 years ago

Here is the full traceback:

pserve development.ini 
Traceback (most recent call last):
  File "/Users/screencaster/Desktop/why/.env/bin/pserve", line 11, in <module>
    load_entry_point('pyramid', 'console_scripts', 'pserve')()
  File "/Users/screencaster/Desktop/why/.env/lib/python3.6/site-packages/pyramid-1.9-py3.6.egg/pyramid/scripts/pserve.py", line 32, in main
    return command.run()
  File "/Users/screencaster/Desktop/why/.env/lib/python3.6/site-packages/pyramid-1.9-py3.6.egg/pyramid/scripts/pserve.py", line 170, in run
    self.pserve_file_config(loader, global_conf=config_vars)
  File "/Users/screencaster/Desktop/why/.env/lib/python3.6/site-packages/pyramid-1.9-py3.6.egg/pyramid/scripts/pserve.py", line 133, in pserve_file_config
    settings = loader.get_settings('pserve', global_conf)
  File "/Users/screencaster/Desktop/why/.env/lib/python3.6/site-packages/plaster_pastedeploy-0.4-py3.6.egg/plaster_pastedeploy/__init__.py", line 80, in get_settings
    defaults = parser.defaults()
  File "/Users/screencaster/Desktop/why/.env/lib/python3.6/site-packages/PasteDeploy-1.5.2-py3.6.egg/paste/deploy/loadwsgi.py", line 68, in defaults
    defaults[key] = self.get('DEFAULT', key) or val
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/configparser.py", line 800, in get
    d)
  File "/Users/screencaster/Desktop/why/.env/lib/python3.6/site-packages/PasteDeploy-1.5.2-py3.6.egg/paste/deploy/loadwsgi.py", line 95, in before_get
    value, defaults)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/configparser.py", line 394, in before_get
    self._interpolate_some(parser, option, L, value, section, defaults, 1)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/configparser.py", line 444, in _interpolate_some
    "found: %r" % (rest,))
configparser.InterpolationSyntaxError: Error in file development.ini: '%' must be followed by '%' or '(', found: '%{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
mikeckennedy commented 7 years ago

OK, looks like this is an error on OhMyZSH which was updated today...

But why would an error in the shell settings stop the web server?

stevepiercy commented 7 years ago

Looks like it never started. If you don't use OhMyZSH but some other shell, will it start? I just tried following the recommended procedure.

I skipped steps 3-5 because they are not required if you already have cookiecutter installed in the user space as their docs recommend: pip install --user cookiecutter.

I wonder if activate has something to do with it?

Also the cookiecutter readme and output upon installation recommends the following, instead of steps 9 and 10:


Change directory into your newly created project.
    cd pyramid_scaffold

Create a Python virtual environment.
    python3 -m venv env

Upgrade packaging tools.
    env/bin/pip install --upgrade pip setuptools

Install the project in editable mode with its testing requirements.
    env/bin/pip install -e ".[testing]"

Run your project's tests.
    env/bin/pytest

Run your project.
    env/bin/pserve development.ini
Steves-iMac:pyramid_scaffold stevepiercy$ env/bin/pytest
================================================= test session starts ==================================================
platform darwin -- Python 3.6.1, pytest-3.1.3, py-1.4.34, pluggy-0.4.0
rootdir: /Users/stevepiercy/projects/web_proj/pyramid_scaffold, inifile: pytest.ini
plugins: cov-2.5.1
collected 2 items

pyramid_scaffold/tests.py ..

=============================================== 2 passed in 1.04 seconds ===============================================
Steves-iMac:pyramid_scaffold stevepiercy$ env/bin/pserve development.ini
Starting server in PID 6694.
Serving on http://localhost:6543
Serving on http://localhost:6543
mikeckennedy commented 7 years ago

Hi Steve. Yes, if I use bash it will run fine. But for some reason, a misconfiguration in the git handling for ohmyzsh prevents pserve from running. I closed this because I'm just switching to bash for what I need. But I wonder if pserve course some how more gracefully handle this.

mmerickel commented 7 years ago

Hey guys, this is my fault. I released a version of plaster_pastedeploy last night that's going to break everyone until I fix it (sometime later tonight). If you downgrade to 0.3.2 things should work again.

https://github.com/Pylons/plaster_pastedeploy/issues/9

mikeckennedy commented 7 years ago

Hi Michael. Thanks for the heads up.

mmerickel commented 7 years ago

I pulled 0.4 from pypi so things might work by default right now.

mikeckennedy commented 7 years ago

I bet it will. Thanks.