Problem with diferences in executinion
Sam Schulenburg
samschul at pacbell.net
Tue Jul 23 00:58:58 EDT 2002
In article <d7fcf8b4.0207221430.37c26071 at posting.google.com>,
samschul at pacbell.net says...
>
>If I execute the following code snipit from Python it executes the way
>I expected it. If I build a standalone exe with McMillan's installer
>the function call to startscsi() function in MaxPTI's __init__() is
>not in scope.
>
>Maxscsi.py is a file that initializes and loads MaxSCSI.dll which
>contains startscsi(). This DLL and Maxscsi.py have been used in other
>McMillan installer programs without any problems. This is the first
>time I have tried to use a class to instanuate the DLL. The whole idea
>behind this program is the desire to embed Python in an exe with some
>added methods to allow non programmers to write an external script
>file and execute it with the exe with the following call:
>
>"MaxPTI MyTest"
>
>Any Help would be appreciated
>Sam Schulenburg
>
>======================= MaxPTI.py/MaxPTI.exe contains ===============
>
>from Maxscsi import * # import scsi library
>from sys import *
>
>class MaxPTI:
>
> def __init__(self,Headless=0):
> startscsi(1,Headless) # Start scsi initializtion setting
> # Genericflag = 1,and Headless
> initscsi("MaxPTI","physicaldrive",1) # Locate drives
> setshowcdb(0)
> setlogerror(1)
> setpauseonerror(0)
> .....
> .....
> def Function1()
> ....
> ....
>
> def Function2()
> ....
> ....
>
>if __name__ == '__main__':
> a = MaxPTI(1)
> exec("from %s import MyScript"%(argv[1]))
> print 'Start Script'
> MyScript(a)
>=================== End MaxPTI.py ==============
>
>================== MyTest.py ===================
>def MyScript(a):
> print a.DeviceTable
> for i in range(a.DeviceTableLength):
> print a.DeviceTable[i]
> print a.DeviceTable[2][a.pSERIALNUM]
> print a.DeviceTable[2][a.pVENDOR]
It has been requested that I provide a traceback to the above problem. The
following traceback shows that the initial import statment is not being
executed. This differs from what I reported in my first post, where I thought
the problem was in the __init__() method.
J:\Python22\MaxPTI>MaxPTI MyTest
Traceback (most recent call last):
File "<string>", line 18, in ?
File "iu.py", line 274, in importHook
File "iu.py", line 357, in doimport
File "Maxscsi.py", line 483, in ?
from MaxSCSI import * # Import SCSI libraries
File "iu.py", line 274, in importHook
File "iu.py", line 357, in doimport
File "Maxscsi.py", line 497, in ?
startscsi(GenericOk,Headless) # Set log filename and initialize SCSI
NameError: name 'startscsi' is not defined
J:\Python22\MaxPTI>
Sam Schulenburg
More information about the Python-list
mailing list