0

I am an amateur at python eve. In the process of running some demo api for the same I get value error. I am running this code in ipython desktop app.

from flask import jsonify
from eve import Eve
app = Eve()

@app.route('/average/<user>')
def compute_average(user):
    return jsonify({user:47})

if __name__=='__main__':
      app.run(debug=True)

On running this code I get the following error:

ValueError                                Traceback (most recent call last)
C:\Users\***\Documents\Python Scripts\test.py in <module>()
  1 from flask import jsonify
  2 from eve import Eve
  ----> 3 app = Eve()
  4
  5 @app.route('/average/<user>')

  C:\Users\***\Anaconda2\lib\site-packages\eve\flaskapp.pyc in __init__(self, import_name, settings, validator, data, auth, redis, url_converters, json_encoder, media, **kwargs)
  158         self.settings = settings
  159
  --> 160         self.load_config()
  161         self.validate_domain_struct()
  162

  C:\Users\***\Anaconda2\lib\site-packages\eve\flaskapp.pyc in load_config(self)
  275
  276             try:
  --> 277                 self.config.from_pyfile(pyfile)
  278             except:
  279                 raise

  C:\Users\***\Anaconda2\lib\site-packages\flask\config.pyc in from_pyfile(self, filename, silent)
  128         try:
  129             with open(filename, mode='rb') as config_file:
  --> 130                 exec(compile(config_file.read(), filename, 'exec'), d.__dict__)
  131         except IOError as e:
  132             if silent and e.errno in (

  C:\Users\***\Anaconda2\lib\site-packages\bokeh\settings.py in <module>()
  9 from os.path import join, abspath, isdir
  10
  ---> 11 from .util.paths import ROOT_DIR, bokehjsdir
  12
  13

  ValueError: Attempted relative import in non-package

I find that this problem occurs everytime I shutdown the system. I find that the I have to re-install eve and then this error occurs. Previously conda install <all packages> worked. But Since they've already been installed, becomes redundant on redoing.

How do I solve this problem for eternity?

This [link] suggests some solution that I didn't get... So looking for clue regarding the same... Any help is appreciated.

Eswar
  • 1,201
  • 19
  • 45

0 Answers0