Error setup powerline for bash shell on Yosemite - osx-yosemite

I would like to use powerline with bash (not zsh if possible) but I have faced some errors, below are steps I have been through
I recently install python using homebrew
I have also executed brew linkapps python
I have installed powerline-statys using pip install powerline-status
I have extended my ~/.bash_profile
if [ -f /usr/local/lib/python2.7/site-packages/powerline/bindings/bash/powerline.sh ]; then
source /usr/local/lib/python2.7/site-packages/powerline/bindings/bash/powerline.sh
fi
I also have installed patched fonts from https://github.com/powerline/fonts using it's install.sh
After Opennig new tab in iTerm2 I have faced this error, I think it's about python but I have no ideas how to fix it, so please help
traceback (most recent call last):
File "/usr/local/bin/powerline-config", line 6, in <module>
from powerline.commands.config import get_argparser
File "/usr/local/lib/python2.7/site-packages/powerline/commands/config.py", line 6, in <module>
import powerline.bindings.config as config
File "/usr/local/lib/python2.7/site-packages/powerline/bindings/config.py", line 19, in <module>
from powerline.commands.main import finish_args
File "/usr/local/lib/python2.7/site-packages/powerline/commands/main.py", line 17, in <module>
encoding = get_preferred_arguments_encoding()
File "/usr/local/lib/python2.7/site-packages/powerline/lib/encoding.py", line 77, in get_preferred_arguments_encoding
locale.getdefaultlocale()[1]
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 543, in getdefaultlocale
return _parse_localename(localename)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 475, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
Traceback (most recent call last):
File "/usr/local/bin/powerline-config", line 6, in <module>
from powerline.commands.config import get_argparser
File "/usr/local/lib/python2.7/site-packages/powerline/commands/config.py", line 6, in <module>
import powerline.bindings.config as config
File "/usr/local/lib/python2.7/site-packages/powerline/bindings/config.py", line 19, in <module>
from powerline.commands.main import finish_args
File "/usr/local/lib/python2.7/site-packages/powerline/commands/main.py", line 17, in <module>
encoding = get_preferred_arguments_encoding()
File "/usr/local/lib/python2.7/site-packages/powerline/lib/encoding.py", line 77, in get_preferred_arguments_encoding
locale.getdefaultlocale()[1]
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 543, in getdefaultlocale
return _parse_localename(localename)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 475, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
My Environment
python --version
Python 2.7.6
brew list python
/usr/local/Cellar/python/2.7.10_2/bin/2to3
/usr/local/Cellar/python/2.7.10_2/bin/2to3-2
/usr/local/Cellar/python/2.7.10_2/bin/2to3-2.7
/usr/local/Cellar/python/2.7.10_2/bin/easy_install
/usr/local/Cellar/python/2.7.10_2/bin/easy_install-2.7
/usr/local/Cellar/python/2.7.10_2/bin/idle
/usr/local/Cellar/python/2.7.10_2/bin/idle2
/usr/local/Cellar/python/2.7.10_2/bin/idle2.7
/usr/local/Cellar/python/2.7.10_2/bin/pip
/usr/local/Cellar/python/2.7.10_2/bin/pip2
/usr/local/Cellar/python/2.7.10_2/bin/pip2.7
/usr/local/Cellar/python/2.7.10_2/bin/pydoc
/usr/local/Cellar/python/2.7.10_2/bin/pydoc2
/usr/local/Cellar/python/2.7.10_2/bin/pydoc2.7
/usr/local/Cellar/python/2.7.10_2/bin/python
/usr/local/Cellar/python/2.7.10_2/bin/python-config
/usr/local/Cellar/python/2.7.10_2/bin/python2
/usr/local/Cellar/python/2.7.10_2/bin/python2-config
/usr/local/Cellar/python/2.7.10_2/bin/python2.7
/usr/local/Cellar/python/2.7.10_2/bin/python2.7-config
/usr/local/Cellar/python/2.7.10_2/bin/pythonw
/usr/local/Cellar/python/2.7.10_2/bin/pythonw2
/usr/local/Cellar/python/2.7.10_2/bin/pythonw2.7
/usr/local/Cellar/python/2.7.10_2/bin/smtpd.py
/usr/local/Cellar/python/2.7.10_2/bin/smtpd2.7.py
/usr/local/Cellar/python/2.7.10_2/bin/smtpd2.py
/usr/local/Cellar/python/2.7.10_2/bin/wheel
/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/ (3761 files)
/usr/local/Cellar/python/2.7.10_2/IDLE.app/Contents/ (8 files)
/usr/local/Cellar/python/2.7.10_2/lib/pkgconfig/ (3 files)
/usr/local/Cellar/python/2.7.10_2/libexec/pip/ (499 files)
/usr/local/Cellar/python/2.7.10_2/libexec/setuptools/ (227 files)
/usr/local/Cellar/python/2.7.10_2/libexec/wheel/ (92 files)
/usr/local/Cellar/python/2.7.10_2/Python Launcher.app/Contents/ (17 files)
/usr/local/Cellar/python/2.7.10_2/share/man/ (3 files)
/usr/local/Cellar/python/2.7.10_2/share/python/ (315 files)

Your python complains about the unknown locale UTF-8. Searching the net gives the following solution. Add these lines to your ~/.bash_profile:
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

Related

How to install DBT CLI on GCP?

I've installed DBT CLI on GCP cloud shell using pip install dbt after that I had added the path to dbt in my .profile file too -
.profile file -
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$HOME/.local/lib/python3.9/site-packages:$PATH"
fi
export $PATH
After the above steps, now when I test the commands like - dbt --version it gives below error -
my_name#cloudshell:~$ dbt --init
Traceback (most recent call last):
File "/home/my_name/.local/bin/dbt", line 5, in <module>
from dbt.main import main
File "/home/my_name/.local/lib/python3.9/site-packages/dbt/main.py", line 11, in <module>
import dbt.version
File "/home/my_name/.local/lib/python3.9/site-packages/dbt/version.py", line 11, in <module>
import dbt.semver
File "/home/my_name/.local/lib/python3.9/site-packages/dbt/semver.py", line 8, in <module>
import dbt.utils
File "/home/my_name/.local/lib/python3.9/site-packages/dbt/utils.py", line 9, in <module>
import jinja2
File "/home/my_name/.local/lib/python3.9/site-packages/jinja2/__init__.py", line 12, in <module>
from .environment import Environment
File "/home/my_name/.local/lib/python3.9/site-packages/jinja2/environment.py", line 25, in <module>
from .defaults import BLOCK_END_STRING
File "/home/my_name/.local/lib/python3.9/site-packages/jinja2/defaults.py", line 3, in <module>
from .filters import FILTERS as DEFAULT_FILTERS # noqa: F401
File "/home/my_name/.local/lib/python3.9/site-packages/jinja2/filters.py", line 13, in <module>
from markupsafe import soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/usr/local/lib/python3.9/dist-packages/markupsafe/__init__.py)
Where have I failed? Can anyone please correct me?
Try pip install dbt-[adapter] (eg dbt-bigquery) which will install the latest version of dbt, rather than the pre-1.0 version you’re getting now (which has become broken due to an issue with a dependency).

Vosk in Windows 10

I need help in using Vosk in Windows 10. I installed python 3.8, then used the pip install vosk command. The Python installation is at C:\Users\kamal\AppData\Local\Programs\Python\Python38 and I can see that vosk is at C:\Users\kamal\AppData\Local\Programs\Python\Python38\Lib\site-packages\vosk. Next, I cloned the vosk git at C:\Users\kamal\vosk-api (kamal is my username). Then, I downloaded the en-us model and placed it in C:\Users\kamal\vosk-api\python\example\model. Next, in cmd, I went to the C:\Users\kamal\vosk-api\python\example directory and ran the command python ./test_srt.py test.wav test.txt. I am getting the following messages:
File "./test_srt.py", line 12, in <module>
model = Model(lang="en-us")
File "C:\Users\kamal\AppData\Local\Programs\Python\Python38\lib\site-packages\vosk\__init__.py", line 50, in __init__
model_path = self.get_model_path(model_name, lang)
File "C:\Users\kamal\AppData\Local\Programs\Python\Python38\lib\site-packages\vosk\__init__.py", line 63, in get_model_path
model_path = self.get_model_by_lang(lang)
File "C:\Users\kamal\AppData\Local\Programs\Python\Python38\lib\site-packages\vosk\__init__.py", line 97, in get_model_by_lang
self.download_model(Path(directory, result_model[0]))
File "C:\Users\kamal\AppData\Local\Programs\Python\Python38\lib\site-packages\vosk\__init__.py", line 102, in download_model
MODEL_DIRS[3].mkdir()
File "C:\Users\kamal\AppData\Local\Programs\Python\Python38\lib\pathlib.py", line 1288, in mkdir
self._accessor.mkdir(self, mode)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\kamal\\.cache\\vosk'
Exception ignored in: <function Model.__del__ at 0x0000022E05867D30>
Traceback (most recent call last):
File "C:\Users\kamal\AppData\Local\Programs\Python\Python38\lib\site-packages\vosk\__init__.py", line 56, in __del__
_c.vosk_model_free(self._handle)
AttributeError: 'Model' object has no attribute '_handle'
What has to be done?

Getting Error while running python3 main.py file

I am getting this error,
/tmp/Python-3.7.5$ python3 main.py
Traceback (most recent call last):
File "main.py", line 3, in <module>
import pandas as pd
File "/home/abc/.local/lib/python3.7/site-packages/pandas/__init__.py", line 51, in <module>
from pandas.core.api import (
File "/home/abc/.local/lib/python3.7/site-packages/pandas/core/api.py", line 31, in <module>
from pandas.core.groupby import Grouper, NamedAgg
File "/home/abc/.local/lib/python3.7/site-packages/pandas/core/groupby/__init__.py", line 1, in <module>
from pandas.core.groupby.generic import DataFrameGroupBy, NamedAgg, SeriesGroupBy
File "/home/abc/.local/lib/python3.7/site-packages/pandas/core/groupby/generic.py", line 65, in <module>
from pandas.core.frame import DataFrame
File "/home/abc/.local/lib/python3.7/site-packages/pandas/core/frame.py", line 119, in <module>
from pandas.core import algorithms, common as com, generic, nanops, ops
File "/home/abc/.local/lib/python3.7/site-packages/pandas/core/generic.py", line 112, in <module>
from pandas.io.formats import format as fmt
File "/home/abc/.local/lib/python3.7/site-packages/pandas/io/formats/format.py", line 77, in <module>
from pandas.io.common import stringify_path
File "/home/abc/.local/lib/python3.7/site-packages/pandas/io/common.py", line 3, in <module>
import bz2
File "/usr/local/lib/python3.7/bz2.py", line 19, in <module>
from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'
what is the solution?
How did you install your Python? If you've manually built it or used the make command, you might be missing the bz2 library headers.
Try the following...
Centos/Fedora/RHEL:
sudo yum install bzip2-devel
Debian and Ubuntu:
sudo apt-get install libbz2-dev
You'll then either need to rebuild your Python installation or to copy the header in your Python folder, with:
sudo cp /usr/lib/python3.7/lib-dynload/_bz2.cpython-38-x86_64-linux-gnu.so /usr/local/lib/python3.7/

Cannot import name 'wrap_module'

Im setting up an odoo community server and after adding and removing an addon, i am getting an error.
I have tried copying the odoo addons files back to the default install ones with no success.
Exception in thread odoo.service.cron.cron0:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/opt/odoo/odoo/odoo/service/server.py", line 244, in target
self.cron_thread(i)
File "/opt/odoo/odoo/odoo/service/server.py", line 218, in cron_thread
from odoo.addons.base.ir.ir_cron import ir_cron
File "/opt/odoo/odoo/odoo/modules/module.py", line 82, in load_module
exec(open(modfile, 'rb').read(), new_mod.__dict__)
File "<string>", line 4, in <module>
File "/opt/odoo/odoo/odoo/addons/base/ir/__init__.py", line 8, in
<module>
from . import ir_actions
File "/opt/odoo/odoo/odoo/addons/base/ir/ir_actions.py", line 8, in
<module>
from odoo.tools import pycompat, wrap_module
ImportError: cannot import name 'wrap_module'
That is the error i am getting, ive tried using pip3 to install pycompat but it still dosnt work.
Make sure you running Odoo on python3,
on terminal python3 path_to_odoo/./odoo-bin
and clear the browser cache and try again.

How to resolve a 'The report "report.custom" already exists!' error while launching OpenERP 7.0

Running Ubuntu 12.04, I try to run OpenERP 7.0, using the latest tarball archive.
wget "http://nightly.openerp.com/7.0/nightly/src/openerp-7.0-latest.tar.gz"
tar -xzf openerp-7.0-latest.tar.gz
# cd extracted directory
./openerp-server —xmlrpc-port=40069 —netrpc-port=40070 —addons-path=openerp/addons,openerp/web/addons
Here is what I get:
Traceback (most recent call last):
File "./openerp-server", line 5, in <module>
openerp.cli.main()
File "/path/to/decrompressed/directory/openerp-7.0-20140113-001013/openerp/cli/__init__.py", line 51, in main
__import__(m)
File "/path/to/decrompressed/directory/openerp-7.0-20140113-001013/openerp/modules/module.py", line 133, in load_module
mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)
File "/path/to/decrompressed/directory/openerp-7.0-20140113-001013/openerp/addons/account_test/__init__.py", line 2, in <module>
import report
File "/path/to/decrompressed/directory/openerp-7.0-20140113-001013/openerp/addons/account_test/report/__init__.py", line 1, in <module>
import account_test_report
File "/path/to/decrompressed/directory/openerp-7.0-20140113-001013/openerp/addons/account_test/report/account_test_report.py", line 25, in <module>
from report import report_sxw
File "/path/to/decrompressed/directory/openerp-7.0-20140113-001013/openerp/report/__init__.py", line 25, in <module>
import custom
File "/path/to/decrompressed/directory/openerp-7.0-20140113-001013/openerp/report/custom.py", line 623, in <module>
report_custom('report.custom')
File "/path/to/decrompressed/directory/openerp-7.0-20140113-001013/openerp/report/custom.py", line 58, in __init__
report_int.__init__(self, name)
File "/path/to/decrompressed/directory/openerp-7.0-20140113-001013/openerp/report/interface.py", line 45, in __init__
assert not self.exists(name), 'The report "%s" already exists!' % name
AssertionError: The report "report.custom" already exists!
I already successfully runned a 6.0 instance on this same machine, this server is not running while I try to launch the 7.0 version though. I don't know if that may be related to the fact I already installed the 6.0 before. Could it be a PostgreSQL problem? I didn't drop the existing 6.0 database.
Running the server without more parameters seems to work:
./openerp-server
2014-01-13 14:26:35,270 1014 INFO ? openerp: OpenERP version 7.0-20140113-001013
…