Problem with diferences in executinion

Samuel Schulenburg samschul at pacbell.net
Mon Jul 22 18:30:20 EDT 2002


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]



More information about the Python-list mailing list