jasonwjones / essbasepy

essbasepy is a MaxL Python module that provides Pythonic access to Oracle Essbase via MaxL. It is similar to the Perl module Essbase.pm.
27 stars 15 forks source link

connect() results in 'OSError: exception: access violation reading' #6

Open kfeaginsiii opened 7 years ago

kfeaginsiii commented 7 years ago

Howdy all. I am trying to connect using python 3 & essbase.py 11.1.2012.51 Code: import Essbase esb = Essbase.Essbase() esb.connect(user='XXX',password='XXX',host='XXX') Error:


OSError Traceback (most recent call last)

in () ----> 1 esb.connect(user='XXX',password='XXX',host='XXX') C:\Program Files\Anaconda3\lib\site-packages\Essbase.py in connect(self, user, password, host) 197 self.sid = c_ushort(0) 198 self.ssnInit = maxl_ssninit_t() --> 199 self.sts = self.maxl.MaxLSessionCreate(c_char_p(host.encode('utf-8')), >c_char_p(user.encode('utf-8')), c_char_p(password.encode('utf-8')), byref(self.ssnInit), byref(self.sid)) 200 self.user = user 201 self.numFlds = 0 OSError: exception: access violation reading 0x000000000000000C

I have tested essmsh and able to connect via that method, so my path variables should be correct. Any pointers where I need to look to debug? Thanks.

nurzen commented 7 years ago

The Version of essbasepy you are using is not ready for python 3. Try the newest Version from github.

regiscabaret commented 7 years ago

For us, it works fine with Python 3. We had that error when the ESSBASEPATH was pointing to the wrong location of essmxlu.dll. Try with ESSBASEPATH=%MIDDLEWAREHOME%\EPMSystem11R1\common\EssbaseRTC-64\11.1.2.0

cino189 commented 7 years ago

I had the same issue and i solved it by using puython 64bit rather than 32. Apparently if essbase server is 64bit python must be as well. The variables also need to be set to the 64bit essbase client. I confirm it is working for me with python 3 as well.

ghost commented 7 years ago

I'm getting this error too now...

self.sts = self.maxl.MaxLSessionCreate(c_char_p(host.encode('utf-8')), c_char_p(user.encode('utf-8')), c_char_p(password.encode('utf-8')), byref(self.ssnInit), byref(self.sid)) WindowsError: exception: access violation reading 0x0000000C

I am running python 2.7.5 32 bit. Doing the things in this thread haven't worked... :frowning_face:

ghost commented 7 years ago

When I switch to \common\EssbaseRTC-64\ I get this error: WindowsError: [Error 193] %1 is not a valid Win32 application; so, I am pretty sure that my environment variables are correct. Not sure where to start on figuring out this error.

regiscabaret commented 7 years ago

What is your full ESSBASE_HOME?

Sent from my iPhone

On 12 Oct 2017, at 2:15 AM, mwz293 notifications@github.com wrote:

When I switch to \common\EssbaseRTC-64\ I get this error: WindowsError: [Error 193] %1 is not a valid Win32 application; so, I am pretty sure that my environment variables are correct. Not sure where to start on figuring out this error.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

ghost commented 7 years ago

I don't have an ESSBASE_HOME; I have a EPM_ORACLE_HOME and ESSBASEPATH variable, though... Do I need as ESSBASE_HOME Variable?

EPM_ORACLE_HOME path is C:\Oracle\Middleware\EPMSystem11R1 ESSBASEPATH path is %MIDDLEWAREHOME%\EPMSystem11R1\common\EssbaseRTC-64\11.1.2.0

ghost commented 7 years ago

Also just tried the envVariables as below and no dice:

EPM_ORACLE_HOME = C:\Oracle\Middleware\EPMSystem11R1 ESSBASEPATH = %EPM_ORACLE_HOME%\common\EssbaseRTC\11.1.2.0\

nurzen commented 7 years ago

Hello,

i have the following enviroment

ESSBASEPATH = C:\Oracle\Middleware\EPMSystem11R1\common\EssbaseRTC-64\11.1.2.0 PATH = C:\Oracle\Middleware\EPMSystem11R1\common\EssbaseRTC-64\11.1.2.0\bin;C:\Oracle\Middleware\EPMSystem11R1\bin

Maybe your PATH is not complete.

Greets Kevin

P.S. Also make sure you run python 3

ghost commented 7 years ago

I replaced my paths with exactly those directories (took out the -64 since I am running 32 bit python)... no dice. Let me download python 64 and try again.

Also, could there be an issue with running the script through an Anaconda installation?

Will also try with python 3

Thanks!

nurzen commented 7 years ago

i dont know cause i am not using Anaconda.

ghost commented 7 years ago

Are you just running through command line?

nurzen commented 7 years ago

No, i have an eclipse environment with pyton 3.5.1

ghost commented 7 years ago

Looks like the switch to python 3 with 64-bit fixed this error... now I have a new problem

Error - 1241202 - The most recent MaxL statement did not produce any output.

nurzen commented 7 years ago

try this https://github.com/jasonwjones/essbasepy/issues/3

ghost commented 7 years ago

thanks...switched over to that issue. Cheer!

ghost commented 7 years ago

As a follow up to all of my comments here, I found out my coworker was running a prior version of essbasepy. When I used his Essbase.py file, everything worked. The difference: MAXL_MDXCELLSTRSZ = 1024 and the newest version of essbasepy MAXL_MDXCELLSTRSZ = 1024 + 3.

jasonwjones commented 7 years ago

So just to confirm: the older code of MAXL_MDXCELLSTRSZ = 1024 works with Python 3 and 64-bit? What version of Essbase? The +3 fix was put in months ago but perhaps it's only applicable for certain Essbase versions and/or combinations of Essbase/Python?

ghost commented 7 years ago

That's correct: the older code with MAXL_MDXCELLSTRSZ = 1024 works with Essbase = 11.1.2.0 and Python = 3.6.2 64-bit

nurzen commented 7 years ago

Yeah i remember making that change, here the description MAXL_MDXCELLSTRSZ in maxldefs.h is 1024+3 not 1024, fixes that Axis1 is not displayed correct when MDX is executed. Look at your maxldefs.h the change happened with Essbase Version 11.1.2.4

jasonwjones commented 7 years ago

So it looks like perhaps we should dynamically set that variable based on the version? Does anyone know where the Essbase version can be reliably sourced from dynamically?

ghost commented 7 years ago

I'm not familiar with doing that in Essbase; however, I would think there is some way to execute a query to pull that information.

jasonwjones commented 7 years ago

Well actually I didn't mean querying dynamically, just that if the Python file is used with a given Essbase header file or something, then maybe the version is defined in there that we could use. I'll have to take a look at it.

nurzen commented 7 years ago

We could accomplish this task by query the version number from the DLL. That would need new dependencies as the win32api is needed. An example can be found here

nurzen commented 7 years ago

I found another way only depending on the re module which is part of the python standard library. example. The example runs only on python 2.x i will update it to run on python 3.

Bachatero commented 6 years ago

Hi everyone, I'm getting the exact same error on my Windows 7 no matter which Python version I use (tried 2.7.5, 3.6.4 and 3.5.4rc1 - all 64bit)

Essbase Version: 11.1.2012.0514

I believe my ESSBASEPATH, ARBORPATH and PATH vars are set correctly, please see below. Also my essmsh.exe utility runs just fine. I've followed your discussion but I do not seem to get through.

Am I missing something, please? Your help would be much appreciated.

Thank you. Marcel

import Essbase esb = Essbase.Essbase() Using Maxl DLL in C:\oracle\Middleware\EPMSystem11R1\common\EssbaseRTC-64\11.1.2.0\bin\essmaxlu.dll esb.connect("myusername", "mypassword", "essbasehost") Traceback (most recent call last): File "", line 1, in File "C:\Users\jvargam5\Downloads\essbasepy-master\essbasepy-master\Essbase.py", line 224, in connect self.sts = self.maxl.MaxLSessionCreate(c_char_p(host.encode('utf-8')), c_char_p(user.encode('utf-8')), c_char_p(password.encode('utf-8')), byref(self.ssnIni t), byref(self.sid)) OSError: exception: access violation reading 0x000000000000000C

ESSBASEPATH C:\oracle\Middleware\EPMSystem11R1\common\EssbaseRTC-64\11.1.2.0 ARBORPATH C:\oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseClient

taylorfturner commented 6 years ago

@Bachatero to what is your PATH variable set? Also since you are windows, are you setting your environment variables to System Variables or User Variables?

Bachatero commented 6 years ago

hi, this is what I'm doing prior to running python.exe from powershell:

set-Item Env:ESSBASEPATH "C:\oracle\Middleware\EPMSystem11R1\common\EssbaseRTC-64\11.1.2.0" set-Item Env:ARBORPATH "C:\oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseClient" $env:Path += ";C:\oracle\Middleware\EPMSystem11R1\common\EssbaseRTC-64\11.1.2.0; C:\oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseClient"

I'm sorry I'm new to Windows, I assume these are User variables. I'm not an admin of my Windows, I guess I would not be able to configure the System ones. It seems like though that at least PATH is setup correctly while essmaxlu.dll is resolved when esb = Essbase.Essbase() is run.

Thank you for your input.

taylorfturner commented 6 years ago

So running the esb = Essbase.Essbase() is successful? If you type just esb what is returned?

Bachatero commented 6 years ago

yes, that one is successfull. It prints out "Using Maxl DLL ..." . When typing esb afterwards it returns <Essbase.Essbase object at 0x000000000272DF28> Thank you

import Essbase esb = Essbase.Essbase() Using Maxl DLL in C:\oracle\Middleware\EPMSystem11R1\common\EssbaseRTC-64\11.1.2.0\bin\essmaxlu.dll esb <Essbase.Essbase object at 0x000000000272DF28>

taylorfturner commented 6 years ago

Is your MAXL_MDXCELLSTRSZ variable in the Essbase.py file set to 1024 or 1024 + 3?

Bachatero commented 6 years ago

Hi, I've tried both settings, always reinstalling the egg but none of them works. I always get the same error. "OSError: exception: access violation reading 0x000000000000000C" Thank you.

-- orig MAXL_MDXCELLSTRSZ = 1024 + 3 MAXL_MDXCELLSTRSZ = 1024 ... if b"11.1.2.4" in (getFileVerInfo(__maxldll)): -- orig MAXL_MDXCELLSTRSZ = 1024 + 3 MAXL_MDXCELLSTRSZ = 1024

nurzen commented 6 years ago

See https://github.com/jasonwjones/essbasepy/issues/6#issuecomment-336109791 and check your PATH again.

The MDXCELLSTRSZ Setting is only used if you are using the MDX feature. It has nothing to do with the connection.

Bachatero commented 6 years ago

OMG, you are right, my PATH was not correct :-(
Removing a space between C:...\11.1.2.0\bin; and C:...\EPMSystem11R1\bin from my PATH variable did the trick.

This is what I had:

"C:\oracle\Middleware\EPMSystem11R1\common\EssbaseRTC-64\11.1.2.0\bin; C:\oracle\Middleware\EPMSystem11R1\bin"

and this is what I have now:

"C:\oracle\Middleware\EPMSystem11R1\common\EssbaseRTC-64\11.1.2.0\bin;C:\oracle\Middleware\EPMSystem11R1\bin"

Guys, I cannot thank you enough.

Thank you taylorturneriv and thank you nurzen !!!

jasonwjones commented 6 years ago

Nice job, as always. In somewhat related news, Oracle has made clear that the Perl module is being phased out, which I think means that the Essbasepy module will stop working after 11.1.2.4, but who knows.

regiscabaret commented 6 years ago

Hi Jason,

They’re phasing out the Perl module but not the API and MaxL, right? So why would essbasepy stop working?

Regis Cabaret --

On March 13, 2018 at 00:59:09, Jason Jones (notifications@github.com) wrote:

Nice job, as always. In somewhat related news, Oracle has made clear that the Perl module is being phased out, which I think means that the Essbasepy module will stop working after 11.1.2.4, but who knows.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jasonwjones/essbasepy/issues/6#issuecomment-372383943, or mute the thread https://github.com/notifications/unsubscribe-auth/ADP5ufccpfWs6V85UkUX_TxdCWMXOInGks5tdqlbgaJpZM4LUPZG .

jasonwjones commented 6 years ago

Well, that's where things a little more fuzzy... at least as it pertains to their could offerings (OAC) they don't support MaxL via the old interpreter. I think they made the decision that MaxL was inherently insecure in its communication protocol. My impression is that how they are enabling MaxL support for the cloud products is that if you want to run a MaxL script it just securely transports the script's contents to the remote server and then has the remote server execute it locally.

So, it's possible that the forthcoming on-premises versions of Essbase will be able to support Essbasepy via the current mechanism it uses, but it also seems quite possible to me that some of the engineering changes they make will prevent it from working or at least narrow the use-cases where it's possible to use. But we'll see, I suppose.

VinayKabadi commented 4 years ago

I am using the EPM 11.1.2.4 in Cloud environment and latest Essbase.py code from the git here. Python 64 bit .

But I still get the access violation error. Could you please help.... I have put my code in

import Essbase import os import string import sys import time

os.environ['PATH'] = "E:/oracle/Middleware/EPMSystem11R1/common/EssbaseRTC-64/11.1.2.0/bin;E:/Oracle/Middleware/EPMSystem11R1/bin" os.environ["ESSBASEPATH"] = "E:/oracle/Middleware/EPMSystem11R1/products/Essbase/EssbaseServer"

esb = Essbase.Essbase() esb.connect("user", "password")#local host is server


Using Maxl DLL in E:/oracle/Middleware/EPMSystem11R1/common/EssbaseRTC-64/11.1.2.0/bin\essmaxlu.dll Traceback (most recent call last): File ".\test.py", line 20, in esb.connect("user", "password") File "E:\Software\WPy-3661_HFM\python-3.6.6.amd64\lib\site-packages\Essbase.py", line 220, in connect self.sts = self.maxl.MaxLSessionCreate(c_char_p(host.encode('utf-8')), c_char_p(user.encode('utf-8')), c_char_p(pass word.encode('utf-8')), byref(self.ssnInit), byref(self.sid)) OSError: exception: access violation reading 0x000000000000000C

nurzen commented 4 years ago

try adding the path E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseClient\bin\ to your PATH Variable sometimes its not enough to put only the EssbaseRTC in there. Therefor you need to install EssbaseClient Package

VinayKabadi commented 4 years ago

Essbase Client was already installed and there were also some paths for client.

I added last 3 lines in path variable after you mentioned but still no luck.

Path: E:\Oracle\Middleware\dbclient64\bin E:\Oracle\Middleware\dbclient32\bin %SystemRoot%\system32 %SystemRoot% %SystemRoot%\System32\Wbem %SYSTEMROOT%\System32\WindowsPowerShell\v1.0 C:\Program Files (x86)\Amazon\cfn-bootstrap E:\Oracle\Middleware\ohs\bin E:\Oracle\Middleware\ohs\opmn\bin E:\Oracle\Middleware\ohs\opmn\lib E:\Oracle\Middleware\ohs\perl\bin E:\Oracle\Middleware\EPMSystem11R1\common\ODBC-64\Merant\7.1\Drivers E:\Oracle\Middleware\EPMSystem11R1\common\SAP\bin E:\Oracle\Middleware\EPMSystem11R1\products\FinancialManagement\Common\32bit E:\Oracle\Middleware\EPMSystem11R1\products\FinancialManagement\Client\32bit E:\Oracle\Middleware\EPMSystem11R1\products\FinancialManagement\Common E:\Oracle\Middleware\EPMSystem11R1\products\FinancialManagement\Client E:\Software\WPy-3661_HFM\python-3.6.6.amd64 E:\oracle\Middleware\EPMSystem11R1\bin E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseClient E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseClient\bin\ E:\oracle\Middleware\EPMSystem11R1\common\EssbaseRTC-64\11.1.2.0\bin E:\Oracle\Middleware\EPMSystem11R1\bin

ESSBASE_PATH : E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer EPM_ORACLE_HOME : E:\Oracle\Middleware\EPMSystem11R1

nurzen commented 4 years ago

Could you remove the EssbaseRTC from your PATH variable?

VinayKabadi commented 4 years ago

I removed the "E:\oracle\Middleware\EPMSystem11R1\common\EssbaseRTC-64\11.1.2.0\bin" from environment path variables but still no luck... same errors

I have put my code below in case you want to advise some path change here too

os.environ['PATH'] = "E:/oracle/Middleware/EPMSystem11R1/common/EssbaseRTC-64/11.1.2.0/bin;E:/Oracle/Middleware/EPMSystem11R1/bin"

os.environ['PATH'] = "E:/Oracle/Middleware/EPMSystem11R1/products/Essbase/EssbaseClient/bin" os.environ["ESSBASEPATH"] = "E:/oracle/Middleware/EPMSystem11R1/products/Essbase/EssbaseServer"

esb = Essbase.Essbase() esb.connect("user", "password")


Using Maxl DLL in E:/Oracle/Middleware/EPMSystem11R1/products/Essbase/EssbaseClient/bin\essmaxlu.dll Traceback (most recent call last): File ".\test.py", line 15, in esb.connect("user", "password") File "E:\Software\WPy-3661_HFM\python-3.6.6.amd64\lib\site-packages\Essbase.py", line 220, in connect self.sts = self.maxl.MaxLSessionCreate(c_char_p(host.encode('utf-8')), c_char_p(user.encode('utf-8')), c_char_p(pass word.encode('utf-8')), byref(self.ssnInit), byref(self.sid)) OSError: exception: access violation reading 0x000000000000000C