ibmdbanalytics/ibmdbpy

Cannot get started

GraemeHutcheon opened this issue · 7 comments

I started getting this error - it did work - refreshed the installation and loaded the newest version but keep getting this on my MAC with Anaconda

/Users/v2graeme/anaconda/lib/python3.5/site-packages/ibmdbpy/base.py in init(self, dsn, uid, pwd, autocommit, verbose)
206
207 here = os.path.abspath(os.path.dirname(file))
--> 208 if not jpype.isJVMStarted():
209 classpath = os.getenv('CLASSPATH','')
210 jarpath = ''

UnboundLocalError: local variable 'jpype' referenced before assignment

What am I doing wrong ?

Hi,

Thank you for notifying the bug.

We did some changes a few days ago in this function. In case this is a regression bug, going back to your previous version (I assume 0.1.0b22) should solve it (just to wait for a patch...).
To do so : pip install ibmdbpy==0.1.0b22

However, this bug is rather unexpected.

  • Do you have jaydebeapi installed ? (it is not set as a strict dependency but mandatory for JDBC)
  • Do you import other packages that may need the JVM ?

Thanks so much - it was the missing - jaydebeapi

oops

Great !
Normally this case should be caught and an exception thrown a few lines before (try - except block at line 200) to let the user know what is wrong. I will have a look at it. Maybe the error can have another type than "ImportError".

I am also having this problem (I am using python 2.7):

---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
<ipython-input-1-9a57b88e9385> in <module>()
     12 # Create connection to remote db2 database
     13 connection_string='jdbc:db2://'+dsn_hostname+':'+dsn_port+'/'+dsn_database+':user='+dsn_uid+';password='+dsn_pwd+";"
---> 14 idadb=IdaDataBase(dsn=connection_string)

/Users/panc/anaconda/lib/python2.7/site-packages/ibmdbpy/base.pyc in __init__(self, dsn, uid, pwd, autocommit, verbose)
    205             here = path.abspath(path.dirname(__file__))
    206
--> 207             if not jpype.isJVMStarted():
    208
    209

UnboundLocalError: local variable 'jpype' referenced before assignment

I installed jaydebeapi as pip install jaydebeapi

For installing ibmdbpy, I clone the repo and installed as python setup.py install

I also tried the older version pip install ibmdbpy==0.1.0b22, but I still get this error.

hi,
that looks like you are missing jpype. Can you please verify that JPype1 (0.6.2) is installed? Usually this is installed as dependency with jaydebeapi.

The following shows that JPype1 is installed

$ pip show JPype1
Name: JPype1
Version: 0.6.2
Summary: A Python to Java bridge.
Home-page: https://github.com/originell/jpype/
Author: Luis Nell
Author-email: cooperate@originell.org
License: License :: OSI Approved :: Apache Software License
Location: /Users/panc/anaconda/lib/python2.7/site-packages
Requires:

But still have the issue.

ok, I fixed our error handling, can you please upgrade to ibmdbpy (0.1.3.post9) and retry, so we know if it actually is an ImportError or if something else is going wrong. Thanks