(lib_file = None)
| 16 | # Try to load the library libFile |
| 17 | # If libFile is not specified, we try to locate and load SPLINTER |
| 18 | def load(lib_file = None): |
| 19 | global __handle |
| 20 | if __handle is not None: |
| 21 | out("SPLINTER is already loaded!") |
| 22 | out("If you wish to unload it you must first call unload.") |
| 23 | else: |
| 24 | if lib_file is None: |
| 25 | lib_file = __locate_splinter() |
| 26 | if lib_file is None: |
| 27 | raise Exception("Unable to automatically locate SPLINTER.\nYou can load it manually by doing splinter.load(\"/path/to/SPLINTER.so\")") |
| 28 | |
| 29 | try: |
| 30 | __handle = cdll.LoadLibrary(lib_file) |
| 31 | __init() |
| 32 | out("Loaded SPLINTER from " + str(lib_file) + "!") |
| 33 | |
| 34 | except Exception as e: |
| 35 | out("Error:") |
| 36 | out("Either you are trying to load a library with another architecture (32 bit/64 bit) than the Python you are using, ", True) |
| 37 | out("or the file you are trying to load (" + lib_file + ") could not be found.") |
| 38 | out("For reference your Python is " + str(8*sizeof(c_void_p)) + "bit.") |
| 39 | out("Here is the error message:") |
| 40 | out(e) |
| 41 | __handle = None |
| 42 | |
| 43 | |
| 44 | def is_loaded(): |
no test coverage detected