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

Can't deploy after pasting into ipython console #20

Open
glamp opened this issue Nov 18, 2016 · 1 comment
Open

Can't deploy after pasting into ipython console #20

glamp opened this issue Nov 18, 2016 · 1 comment
Assignees
Labels

Comments

@glamp
Copy link
Contributor

glamp commented Nov 18, 2016

>>> from yhat import Yhat, YhatModel, preprocess
>>> class HelloWorld(YhatModel):
...     @preprocess(in_type=dict, out_type=dict)
...     def execute(self, data):
...         me = data['name']
...         greeting = "Hello %s!" % me
...         return { "greeting": greeting }
... 
>>> yh.deploy("HelloWorld", HelloWorld, globals())
Are you sure you want to deploy? (y/N): y
extracting model
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/yhat/api.py", line 436, in deploy
    bundle = self._extract_model(name, model, session, verbose=verbose, autodetect=autodetect, is_tensorflow=is_tensorflow)
  File "/usr/local/lib/python2.7/site-packages/yhat/api.py", line 342, in _extract_model
    bundle = save_function(model, session)
  File "/usr/local/lib/python2.7/site-packages/yhat/deployment/save_session.py", line 402, in save_function
    imports, source_code, pickles, modules = _spider_function(function, session)
  File "/usr/local/lib/python2.7/site-packages/yhat/deployment/save_session.py", line 289, in _spider_function
    source += _get_source(function) + '\n'
  File "/usr/local/lib/python2.7/site-packages/yhat/deployment/save_session.py", line 80, in _get_source
    return reindent(_get_source_no_reindent(func))
  File "/usr/local/lib/python2.7/site-packages/yhat/deployment/save_session.py", line 97, in _get_source_no_reindent
    wrapped_source = "\n" + reindent(wrapped_source) + "\n"
  File "/usr/local/lib/python2.7/site-packages/yhat/deployment/save_session.py", line 30, in reindent
    r.run()
  File "/usr/local/lib/python2.7/site-packages/yhat/deployment/reindenter.py", line 148, in run
    for _token in tokens:
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tokenize.py", line 374, in generate_tokens
    ("<tokenize>", lnum, pos, line))
  File "<tokenize>", line 2
    def execute(self, data):
    ^
IndentationError: unindent does not match any outer indentation level
@glamp glamp added the bug label Nov 18, 2016
@glamp glamp self-assigned this Nov 28, 2016
@glamp
Copy link
Contributor Author

glamp commented Dec 5, 2016

better warning in v1.9.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant