essbasepy icon indicating copy to clipboard operation
essbasepy copied to clipboard

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

Open kfeaginsiii opened this issue 8 years ago • 42 comments

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.

kfeaginsiii avatar Dec 22 '16 18:12 kfeaginsiii

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

nurzen avatar Jan 04 '17 06:01 nurzen

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

regiscabaret avatar Mar 14 '17 23:03 regiscabaret

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.

cino189 avatar Aug 02 '17 13:08 cino189

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 avatar Oct 11 '17 14:10 ghost

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.

ghost avatar Oct 11 '17 18:10 ghost

What is your full ESSBASE_HOME?

Sent from my iPhone

On 12 Oct 2017, at 2:15 AM, mwz293 [email protected] 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.

regiscabaret avatar Oct 11 '17 22:10 regiscabaret

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 avatar Oct 12 '17 11:10 ghost

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\

ghost avatar Oct 12 '17 12:10 ghost

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

nurzen avatar Oct 12 '17 12:10 nurzen

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!

ghost avatar Oct 12 '17 12:10 ghost

i dont know cause i am not using Anaconda.

nurzen avatar Oct 12 '17 12:10 nurzen

Are you just running through command line?

ghost avatar Oct 12 '17 12:10 ghost

No, i have an eclipse environment with pyton 3.5.1

nurzen avatar Oct 12 '17 12:10 nurzen

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.

ghost avatar Oct 12 '17 12:10 ghost

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

nurzen avatar Oct 12 '17 12:10 nurzen

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

ghost avatar Oct 12 '17 13:10 ghost

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.

ghost avatar Oct 13 '17 15:10 ghost

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?

jasonwjones avatar Oct 13 '17 20:10 jasonwjones

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

ghost avatar Oct 16 '17 12:10 ghost

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

nurzen avatar Oct 16 '17 12:10 nurzen

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?

jasonwjones avatar Oct 17 '17 15:10 jasonwjones

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.

ghost avatar Oct 17 '17 18:10 ghost

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.

jasonwjones avatar Oct 17 '17 18:10 jasonwjones

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 avatar Oct 18 '17 05:10 nurzen

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.

nurzen avatar Oct 18 '17 05:10 nurzen

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

Bachatero avatar Mar 08 '18 12:03 Bachatero

@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?

taylorfturner avatar Mar 08 '18 23:03 taylorfturner

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.

Bachatero avatar Mar 09 '18 08:03 Bachatero

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

taylorfturner avatar Mar 09 '18 13:03 taylorfturner

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>

Bachatero avatar Mar 09 '18 15:03 Bachatero