ImportError during CircleCI test - python-2.7

I tried to find a solution for this problem but I didn't find anything.
======================================================================
ERROR: Failure: ImportError (No module named mock)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 390, in loadTestsFromName
addr.filename, addr.module)
File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 39, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 86, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/home/ubuntu/client/tests/test_gs_interface.py", line 23, in <module>
import unittest, mock, kiss
ImportError: No module named mock
When I make a test with CIrcleCI using default parameters I always get the same ImportError.
I read at the documentation that I must set the configuration manually but I didn't find how to do.
Anybody could tell me how to import a module in the circle.xml configuration file?
Thank you.

Is mock included in your requirements.txt file? Also, do you have a Python version specified in your circle.yml file, as suggested here?

Related

I am getting a module not found error for authlib, I had followed the instructions as written

ModuleNotFoundError
ModuleNotFoundError: No module named 'authlib'
Traceback (most recent call last)
File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 184, in
find_app_by_string
app = call_factory(script_info, attr, args)
File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 119, in call_factory
return app_factory()
File "/app/superset/app.py", line 44, in create_app
raise ex
File "/app/superset/app.py", line 37, in create_app
app_initializer.init_app()
File "/app/superset/initialization/__init__.py", line 616, in init_app
self.init_app_in_ctx()
File "/app/superset/initialization/__init__.py", line 564, in init_app_in_ctx
File "/app/superset/initialization/__init__.py", line 656, in configure_fab
appbuilder.init_app(self.superset_app, db.session)
File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/base.py", line 202, in
init_app
self.sm = self.security_manager_class(self)
File "/usr/local/lib/python3.8/site-
packages/flask_appbuilder/security/sqla/manager.py",
line 54, in __init__
super(SecurityManager, self).__init__(appbuilder)
File "/usr/local/lib/python3.8/site-packages/flask_appbuilder/security/manager.py",
line 263, in __init__
from authlib.integrations.flask_client import OAuth
ModuleNotFoundError: No module named 'authlib'
The debugger caught an exception in your WSGI application. You can now look at the
traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on
the "Traceback" headline. From the text traceback you can also create a paste of it.
For code execution mouse-over the frame you want to debug and click on the console
icon on the right side.
You can execute arbitrary Python code in the stack frames and there are some extra
helpers available for introspection:
dump() shows all variables in the frame
dump(obj) dumps all that's known about the object
This is my directory structure: /home/directory/superset/superset-frontend.
I'm runnning superset in docker and I'm trying to get OAuth working.
I’ve edited the config file and added the OAuth configuration.
One of the lines I added was:
AUTH_TYPE = AUTH_OAUTH
This required me to import the auth types as below:
from flask_appbuilder.security.manager import (
AUTH_OID,
AUTH_REMOTE_USER,
AUTH_DB,
AUTH_LDAP,
AUTH_OAUTH,
)
When I try running npm run dev-server in development mode in superset.
I get the following error:
ModuleNotFoundError
ModuleNotFoundError: No module named 'authlib'

ERAlchemy cannot connect to database

I don't understand the syntax to call the render feature of ERAlchemy (https://pypi.org/project/ERAlchemy see "Usage for Python"). I am using Python 2.7, sqlite3, and PyCharm. I have ERAlchemy, GraphViz, and PyGraphViz installed.
I am trying the following, but it cannot connect to the database:
from eralchemy import render_er
render_er("sqlite:///C:\\Users\\myname\\Documents\\Work\\pythonsqlite.db", 'erd_from_sqlite.png')
And this is the error:
Traceback (most recent call last):
File "C:/Users/myname/Documents/Work/_sql_functions_rev0.py", line 81, in <module>
render_er("sqlite:///C:\\Users\\myname\\Documents\\Work\\pythonsqlite.db", 'erd_from_sqlite.png')
File "C:\Python27\ArcGISx6410.6\lib\site-packages\eralchemy\main.py", line 236, in render_er
intermediary_to_output(tables, relationships, output)
File "C:\Python27\ArcGISx6410.6\lib\site-packages\eralchemy\main.py", line 75, in intermediary_to_schema
graph.draw(path=output, prog='dot', format=extension)
File "C:\Python27\ArcGISx6410.6\lib\site-packages\pygraphviz\agraph.py", line 1474, in draw
data = self._run_prog(prog, args)
File "C:\Python27\ArcGISx6410.6\lib\site-packages\pygraphviz\agraph.py", line 1308, in _run_prog
runprog = r'"%s"' % self._get_prog(prog)
File "C:\Python27\ArcGISx6410.6\lib\site-packages\pygraphviz\agraph.py", line 1295, in _get_prog
raise ValueError("Program %s not found in path." % prog)
ValueError: Program dot not found in path.
Ah! Found the answer here
had to find the folder with "dot.exe" and add it to the environment variables -> system variables -> path

django 1.9.5 testing tutorial

I am new to Django 1.9.5, when trying the tutorial part 5 in the official website.
I followed their instructions and coded the tests.py file found here: https://docs.djangoproject.com/en/1.9/intro/tutorial05/
But when I run it, this is what I got:
ImportError: Failed to import test module: polls.tests
Traceback (most recent call last):
File "C:\Python27\lib\unittest\loader.py", line 254, in _find_tests
module = self._get_module_from_name(name)
File "C:\Python27\lib\unittest\loader.py", line 232, in _get_module_from_name__import__(name)
File "C:\Users\--\Desktop\Django\mysite\polls\tests.py", line 11, in <module>class QuestionMethodTests(TestCase):
File "C:\Users\--\Desktop\Django\mysite\polls\tests.py", line 20, in QuestionMethodTests
self.assertEqual(future_question.was_published_recently(), False)
NameError: name 'self' is not defined
Can any Django experts help me to understand the why is this happening and how do I solve it.
Thank you so much!

Error when starting scrapy project

Any time i try scrapy crawl [name] I get the following error
Traceback (most recent call last):
File "/usr/local/bin/scrapy", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2793, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 673, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 576, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: Scrapy==0.24.5
I'm not sure what it is I'm missing, I've tried following suggestions from other similar questions but nothing is working! Any help would be appreciated.
Managed to figure it out. For some reason the pip install Scrapy was not completely installing so I downloaded the tarball from the website and then followed the instructions here and it now works!

ImportError: No module named phonenumbers in Odoo (OpenERP v8)

I'm trying to intall the asterisk_click2dial module on ODOO and this error comes to me in the log file:
ValueError: Routing: posting a message without model should be with a parent_id (private mesage).
2015-03-09 15:23:38,262 11093 ERROR ? werkzeug: Error on request:
Traceback (most recent call last):
File "/home/odoo/odoo/lib/python2.7/site-packages/werkzeug/serving.py", line 177, in run_wsgi
execute(self.server.app)
File "/home/odoo/odoo/lib/python2.7/site-packages/werkzeug/serving.py", line 165, in execute
application_iter = app(environ, start_response)
File "/opt/odoo/openerp/service/server.py", line 281, in app
return self.app(e, s)
File "/opt/odoo/openerp/service/wsgi_server.py", line 216, in application
return application_unproxied(environ, start_response)
File "/opt/odoo/openerp/service/wsgi_server.py", line 202, in application_unproxied
result = handler(environ, start_response)
File "/opt/odoo/openerp/http.py", line 1274, in __call__
self.load_addons()
File "/opt/odoo/openerp/http.py", line 1293, in load_addons
m = __import__('openerp.addons.' + module)
File "/opt/odoo/openerp/modules/module.py", line 79, in load_module
mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)
File "/opt/odoo/addons/base_phone/__init__.py", line 23, in <module>
from . import wizard
File "/opt/odoo/addons/base_phone/wizard/__init__.py", line 23, in <module>
from . import number_not_found
File "/opt/odoo/addons/base_phone/wizard/number_not_found.py", line 25, in <module>
import phonenumbers
ImportError: No module named phonenumbers
The problem is just that I installed that module (phonenumbers) plus the py-Asterisk module without errors using pip install phonenumbers and pip install py-Asterisk and the error persists.
I noticed I have at least two versions of python installed (2.6 and 2.7) but both modules are installed at the same version from odoo (I can see the modules in the python2.7 cli when, for example, I write phonenumbers or search).
Has anybody any idea what is happening to me? I'd be gratefull for some specific response. Thanks.
Here the connector's page: OpenERP - Asterisk connector
Ok, my bad. During odoo instalation I created a virtual environment under the Odoo system user account which was used solely by the Odoo server so I just need to install these modules under that enviorment. This works for me:
First let’s switch from root to the odoo user, then create a new virtual environment called odoo and activate it:
su - odoo
/usr/local/bin/virtualenv --python=/usr/local/bin/python2.7 odoo
source odoo/bin/activate
(If you have the virtual environment created like me just ignore the second line). Before starting the module installation we need to add the path to the PostgreSQL binaries, otherwise the PsycoPG2 module install will fail (I ignored this one too):
export PATH=/usr/pgsql-9.3/bin:$PATH
Then I can do pip install... Thank you all for your help.