OpenLabs connector Magento OpenERP 7.0 - python

I'm trying to connect my OpenERP 7.0 to my Magento webSite 1.9.
I'm using the connector developed by openLabs https://github.com/openlabs/magento_integration
I follow the instructions of https://openerp-magento-connector.readthedocs.io/en/develop/introduction.html#installation
But after 3 restores of my OpenERP, I still have an error when I tried to update my modules to get my Magento module.
File "/opt/openerp/davidts/appserver-dts/parts/openerp-7.0-20140124-002431/openerp/addons/base/module/module.py", line 617, in update_list
handler.load_addons()
File "/opt/openerp/davidts/appserver-dts/parts/openerp-7.0-20140124-002431/openerp/addons/web/http.py", line 580, in load_addons
m = import('openerp.addons.' + module)
File "/opt/openerp/davidts/appserver-dts/parts/openerp-7.0-20140124-002431/openerp/modules/module.py", line 133, in load_module
mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)
File "/opt/openerp/davidts/appserver-dts/parts/openerp-7.0-20140124-002431/openerp/addons/magento_integration-develop/init.py", line 9, in
import magento_
File "/opt/openerp/davidts/appserver-dts/parts/openerp-7.0-20140124-002431/openerp/addons/magento_integration-develop/magento_.py", line 17, in
import magento
ImportError: No module named magento
I'm thinking this module isn't stable but when I read on forums, I saw people saying it works.
Some of this people or someone else can explain to me how they did ? Or another solution ? I'm open to multiple ways as it works. (But I haven't the possibility to upgrade my OpenERP in 8.0 or 9.0).
Thanks
EDIT : To #CZoellner
First, thx for your helpful answers
Ok, I solve the problem, my python lib was installed but my openERP installer didn't find it. So I modify the script to add the way of my module in sys.path. This error is resolved.
But now, I have another error seems the first
File "/opt/openerp/davidts/appserver-dts/parts/openerp-7.0-20140124-002431/openerp/addons/magento_integration-develop/init.py", line 10, in
import country
File "/opt/openerp/davidts/appserver-dts/parts/openerp-7.0-20140124-002431/openerp/addons/magento_integration-develop/country.py", line 18, in
import pycountry
ImportError: No module named pycountry
and the sys.path has already the good way
[...
'/usr/local/lib/python2.7/dist-packages/pycountry-1.20-py2.7.egg',
...]
I never develop in python so I certainly missed something

Ok, So I again restoring my snapshot ...
But now, instead using the installer, I downloaded the library manually and install it one by one.
So I install, pycountry lib and magento lib. I update the file "magento_.py" and "pycountry.py" of openLab connector to add the path of my library on sys.path.
Something like that
import sys
sys.path.append("/usr/local/lib/python2.7/dist-packages/pycountry-1.20-py2.7.egg/")
I run the setup of openLabs connector and after I launch update of openERP.
And it finally works ! whew !
Anyway thx for your useful answers !

Related

Heroku app module not found error with pickle module in python I believe

The app runs fine on local but when pushed to heroku I am getting a module not found error surrounding my pickle load. I tried to add the missing module to the requirements.txt but received more errors. Below is the error message:
ModuleNotFoundError: No module named 'numba.serialize'
Traceback:
File "/app/.heroku/python/lib/python3.6/site-packages/streamlit/script_runner.py", line 324, in _run_script
exec(code, module.__dict__)
File "/app/app.py", line 49, in <module>
UMAP = pickle.load((open('data/UMAPwrv.sav', 'rb')))
Does anyone know how to remedy this? Thanks!
I'd suggest you to start using venv for managing Python packages. You can know more about it here.
However, as the documentation clearly states:
These are the lowest-level tools for managing Python packages and are recommended if higher-level tools do not suit your needs.
So, my personal recommendation is using Pipfile.

ModuleNotFoundError: No module named 'binance.client'; 'binance' is not a package

Hey i am new to both Stack Over Flow and Python, but wanting to learn and hoping someone can assist me here.. I am trying to develop a binance trading bot within python. Please see my script below:
from binance.client import Client
class Trader:
def __init__(self, file):
self.connect(file)
""" Creates Binance client """
def connect(self,file):
lines = [line.rstrip('\n') for line in open(file)]
key = lines[0]
secret = lines[1]
self.client = Client(key, secret)
""" Gets all account balances """
def getBalances(self):
prices = self.client.get_withdraw_history()
return prices
filename = 'API credentials.txt'
trader = Trader(filename)
balances = trader.getBalances()
print(balances)
This script is giving me a module not found error please see full details below:
PyDev console: starting.
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)] on win32
runfile('C:/Users/ryanf/PycharmProjects/trading bot/trader.py', wdir='C:/Users/ryanf/PycharmProjects/trading bot')
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Program Files\JetBrains\PyCharm Edu 2020.1.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "C:\Program Files\JetBrains\PyCharm Edu 2020.1.1\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/ryanf/PycharmProjects/trading bot/trader.py", line 1, in <module>
from binance.client import Client
File "C:\Program Files\JetBrains\PyCharm Edu 2020.1.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'binance.client'; 'binance' is not a package
Hoping some one can offer some advice here, it would be very much appreciated.
Make sure you don't have any files named "binance" in the same folder - that's what happened to me.
Would recommend the docs: https://docs.python.org/3/reference/import.html These are very long docs, but here are the "highlights":
See docs on path entry finders. You can import sys; print(sys.path) before any import statement, and also check PYTHONPATH environment variable where you're running the script. If you know where your package or module is located, ensure that that location is listed from the statement above.
See docs on installing libraries/modules -- Assuming you have installed pip, did you run pip install python-binance at any point, and if you run pip list from the command line, is "binance" listed?
If binance is a subdirectory in current directory, you may be missing an __init__.py file -- See docs on packages.
When you change the PYTHONPATH or make other changes, beware of ambiguity; avoid creating multiple sources where a module might be coming from, and name your modules/packages in a way as to avoid shadowing an existing module. See documentation on precedence of search paths
I tried a lot of things already here on google but nothing was useful, then I tired pip install python-binance==0.7.5 instead of pip install python-binance==0.7.9, and I was successful to import " from binance.client import Client.
Beside this, I also renamed my two binance.py files as binance.client.py, and it worked for me.
You can find your binance.py files in your python3 site packages folder. Just go there and search binance.py, you will find it.
In my case the problem was resolved by using:
pip install python-binance
instead of:
pip install binance
Hope it helps someone.
by calling your file binance.py, and then trying to import from binance.client python is looking in your binance.py file.
If you rename your local file then you won't have an issue.
I encountered the same problem and found that it was because I have installed python twice from two different sources (python.org and Microsoft store). By changing the python source in the VS Code, the issue was solved.
I know this is an old question, but i have just encountered it, and here are all possible ways of solving the problem
Look up, if have name any file binance.py - rename it.
you might have installed it from 2 different sources (python2, python3)
You might need to update pip.
In case if you are using conda env, even if u have set your virtual env in that folder - you have to switch python version in conda itself.
Here is where it can be done is VScode

Dreamhost - ImportError: No module named _weakrefset

Dreamhost upgraded a number of servers this weekend, including the one I was on. It broke my configuration, so as recommended I attempted to delete the virtual environment it was running on and attempted to re-set it up. However, when I try to navigate to the site, I get this:
Traceback (most recent call last):
File "/home/thesp/mysite.com/env/lib/python2.7/site-packages/site.py", line 74, in <module>
__boot()
File "/home/thesp/mysite.com/env/lib/python2.7/site-packages/site.py", line 2, in __boot
import sys, os, os.path
File "/home/thesp/lib/python2.7/os.py", line 400, in <module>
import UserDict
File "/home/thesp/lib/python2.7/UserDict.py", line 83, in <module>
import _abcoll
File "/home/thesp/lib/python2.7/_abcoll.py", line 11, in <module>
from abc import ABCMeta, abstractmethod
File "/home/thesp/lib/python2.7/abc.py", line 8, in <module>
from _weakrefset import WeakSet
ImportError: No module named _weakrefset
I've got Python 2.7.8 installed and running, and from shell access, both in and out of my virtual environment when I run Python, I'm pulling up the correct version (which is different from the native version installed, so it's finding my setup). Other posts which reference this error message seem to think it's a problem with not having an upgraded version of virtualenv, but its version is higher than the troublesome version. (I'm running 1.11.6.)
Weirder still, I can shell into Python, type from _weakrefset import WeakSet, and I don't get import errors. I'm running Django 1.6 and I can python manage.py runserver with no errors, but the web server is throwing up before it ever sees Django.
In the traceback, the first two lines are pulling from my virtual environment, but the remaining ones don't seem to be, and I have no idea why, or even if that's relevant.
Any advice on what I should do next? I've about pulled my hair out on this one! I can post any additional information that would help troubleshoot. Thanks!
Well, I feel silly now. I went to the /home/thesp/lib/python2.7/ directory and downloaded _weakrefset.py, like so:
wget http://svn.python.org/projects/python/trunk/Lib/_weakrefset.py
...and now everything seems to be running fine. There was a _weakrefset.pyo file in the directory, so I'm not sure why _weakrefset.py never made it in, but this seems to have done the trick.
Now, that doesn't solve the mystery of why the stack trace switches directories like it does, but it's running now, so I'll take it for now!

python using easy_install ImportError: No module named _md5

I searched a lot and did not find any answer to this problem =(
I have a CentOS 5 as a server, following this How To:
http://wiki.osqa.net/display/docs/RHEL%2C+CentOS+5+Installation+Guide#RHEL%2CCentOS5InstallationGuide-Python
I'm able to install python 2.6 separated from the yum version. But when I run ./easy_install ElementTree I get this strange error:
Traceback (most recent call last):
File "./easy_install", line 9, in <module>
load_entry_point('distribute==0.6.14', 'console_scripts', 'easy_install')()
File "/opt/ActivePython-2.6/lib/python2.6/site-packages/pkg_resources.py", line 305, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/opt/ActivePython-2.6/lib/python2.6/site-packages/pkg_resources.py", line 2244, in load_entry_point
return ep.load()
File "/opt/ActivePython-2.6/lib/python2.6/site-packages/pkg_resources.py", line 1954, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/opt/ActivePython-2.6/lib/python2.6/site-packages/setuptools/command/easy_install.py", line 24, in <module>
from setuptools.package_index import PackageIndex
File "/opt/ActivePython-2.6/lib/python2.6/site-packages/setuptools/package_index.py", line 2, in <module>
import sys, os.path, re, urlparse, urllib2, shutil, random, socket, cStringIO
File "/opt/ActivePython-2.6/lib/python2.6/urllib2.py", line 93, in <module>
import hashlib
File "/opt/ActivePython-2.6/lib/python2.6/hashlib.py", line 136, in <module>
md5 = __get_builtin_constructor('md5')
File "/opt/ActivePython-2.6/lib/python2.6/hashlib.py", line 63, in __get_builtin_constructor
import _md5
ImportError: No module named _md5
I do not understand python and have no idea how to fix this issue, I'm trying to install OSQA to run a phpBB support forum for another country.
Thanks for any help, best regard's.
My guess having had a similar issue on CentOS before, is that the ld path for the new Python isn't set, and it can't find its loadable modules folder.
The 3rd code block on this blog post shows setting an ld path for an opt Python (though it is 2.7): http://toey.tc20.net/2010/08/04/install-python-2-7-gevent-on-centos-5-x86_64/
I would assume that an installer would have done this as part of the install step, but maybe the blog post above will be of some help.
I had the same problem and found that the issue is unrelated to _md5.so, but instead that hashlib is failing to import _hashlib.so within a try block, then getting to a different and normally unused section of code (where the _md5 problem shows up). Try:
import _hashlib.so
I got something like:
ImportError: <PATH>/lib/python2.7/lib-dynload/_hashlib.so: cannot restore segment prot after reloc: Permission denied
I googled that and found http://www.quantumwise.com/forum/index.php?topic=16.0 which says you need to do:
chcon -t texrel_shlib_t <PATH>/lib/python2.7/lib-dynload/_hashlib.so
This worked for me.
Activepython 2.6 seems to have some problem in their latest build. please check for its former release.
I also encounter the same issue like you, I fix it after I add the lib path of python where the module will be installed.
It is really caused by LD_LIBRARY_PATH, please try to add "/opt/ActivePython-2.6/lib" into your LD_LIBRARY_PATH.
setenv LD_LIBRARY_PATH /opt/ActivePython-2.6/lib:$LD_LIBRARY_PATH
Credit to http://johnsofteng.wordpress.com/2009/06/21/python-importerror-no-module-named-_md5/
I met the similar problem on Redhat 6.4, python binary (2.7.x) packages is copied from other already installed system (which is built from source).
The problem is the _hashlib.so, which miss the libssl.so.0.9.8
bash-4.1# ldd /proj/application/tools/python2.7/lib/python2.7/lib-dynload/_hashlib.so
linux-vdso.so.1 => (0x00007fff51d6f000)
libssl.so.0.9.8 => not found
libcrypto.so.0.9.8 => /usr/lib64/libcrypto.so.0.9.8 (0x00007f9a69746000)
libpython2.7.so.1.0 => /proj/application/tools/python2.7/lib/libpython2.7.so.1.0 (0x00007f9a6936b000)
I just install missed package and soft link to the library.
bash-4.1# yum install -y tar openssh-clients
bash-4.1# ln -s /usr/lib64/libssl.so.0.9.8e /usr/lib64/libssl.so.0.9.8
Then the setuptool installation is successful

Jython 2.5.1: "ImportError: No Module named os"

I looked through the other posts and bug reports and couldn't figure out what's causing this. I'm using Jython 2.5.1, in a Java project in Eclipse (Ubuntu 8.10). It has been added to the project as a standalone .jar file (I just replaced the old Jython 2.1 jar with this one).
I'm running a script that uses the threading.py class. At some point the statement "import os" is evaluated from linecache.py and I get this error, which I can't seem to figure out how to fix:
'Execution failed. Traceback (most recent call last):
File "<string>", line 1, in <module>
File "../lib/python/threading.py", line 6, in <module>
import traceback
File "../lib/python/traceback.py", line 3, in <module>
import linecache
File "../lib/python/linecache.py", line 9, in <module>
import os
ImportError: No module named os'
What do you mean with "the jar that comes with the 2.5 download"? Did you extract the contents and use jython.jar or did you run the installer? If you just extracted and didn't run the installer your jython.jar will miss the whole LIB folder.
Can you check if jython.jar contains a LIB folder? (e.g. open jython.jar with 7z or WinZip).
Or try copying the LIB folder in the same folder where jython.jar resides.
Did you try setting these properties. Jython Registry. e.g. via -Dpython.home in the eclipse run configuration.
python.cachedir
python.path
python.home
How is the jar named? If similar to jython-complete.jar try renaming it to jython.jar
Something is wrong at a very deep level, but it's probably easy to fix. You are seeing an error that happens while trying to report some other error.
Probably you have your PYTHONPATH misconfigured. I don't know the details of Jython or Eclipse running Jython, but it looks like you have no standard library available to you.
If you are getting maven, using the dependency jython-standalone instead of jython may help (at least it did for me in a maven project with jython-standalone-2.5.3)

Categories