Exemplo n.º 1
0
def getExtraMarsTestKernels():
    getKernel(MarsKernels.merExt10_url)
    getKernel(MarsKernels.merExt11_url)
    getKernel(MarsKernels.merIau2000_url)
    getKernel(MarsKernels.merFK_url)
    six_print("About to Download 'mro_psp1.bsp' which is over 170MB...", flush=True)
    getKernel(MarsKernels.mroPspOne_url)
    six_print("About to Download 'mro_psp22.bsp' which is over 105MB...", flush=True)
    getKernel(MarsKernels.mroPspTwentyTwo_url)
Exemplo n.º 2
0
def writeTestMetaKernel():
    # Update the paths!
    with open(os.path.join(cwd, "exampleKernels.txt"), 'w') as kernelFile:
        kernelFile.write('\\begindata\n')
        kernelFile.write('KERNELS_TO_LOAD = (\n')
        for kernel in CoreKernels.standardKernelList:
            kernelFile.write('\'{0}\'\n'.format(os.path.join(cwd, kernel)))
        kernelFile.write(')\n')
        kernelFile.write('\\begintext')
    six_print('\nDone writing test meta kernel.', flush=True)
Exemplo n.º 3
0
def writeTestMetaKernel():
    # Update the paths!
    with open(os.path.join(cwd, "exampleKernels.txt"), 'w') as kernelFile:
        kernelFile.write('\\begindata\n')
        kernelFile.write('KERNELS_TO_LOAD = (\n')
        for kernel in CoreKernels.standardKernelList:
            kernelFile.write('\'{0}\'\n'.format(os.path.join(cwd, kernel)))
        kernelFile.write(')\n')
        kernelFile.write('\\begintext')
    six_print('\nDone writing test meta kernel.', flush=True)
Exemplo n.º 4
0
def attemptDownload(url, kernelName, targetFileName, num_attempts):
    current_attempt = 0
    while current_attempt < num_attempts:
        try:
            six_print("Attempting to Download kernel: {}".format(kernelName),
                      flush=True)
            current_kernel = urllib.request.urlopen(url, timeout=10)
            with open(targetFileName, "wb") as kernel:
                kernel.write(current_kernel.read())
            six_print("Downloaded kernel: {}".format(kernelName), flush=True)
            break
        # N.B. .HTTPError inherits from .URLError, so [except:....HTTPError]
        #      must be listed before [except:....URLError], otherwise the
        #      .HTTPError exception cannot be caught
        except urllib.error.HTTPError as h:
            print(
                "Some http error when downloading kernel {}, error: ".format(
                    kernelName), h, ", trying again after a bit.")
        except urllib.error.URLError:
            six_print(
                "Download of kernel: {} failed with URLError, trying again after a bit."
                .format(kernelName),
                flush=True)
        current_attempt += 1
        six_print("\t Attempting to Download kernel again...", flush=True)
        time.sleep(2 + current_attempt)
    if current_attempt >= num_attempts:
        raise BaseException(
            "Error Downloading kernel: {}, check if kernel exists at url: {}".
            format(kernelName, url))
Exemplo n.º 5
0
def attemptDownload(url, kernelName, targetFileName, num_attempts):
    current_attempt = 0
    while current_attempt < num_attempts:
        try:
            six_print("Attempting to Download kernel: {}".format(kernelName), flush=True)
            current_kernel = urllib.request.urlopen(url, timeout=10)
            with open(targetFileName, "wb") as kernel:
                kernel.write(current_kernel.read())
            six_print("Downloaded kernel: {}".format(kernelName), flush=True)
            break
        # N.B. .HTTPError inherits from .URLError, so [except:....HTTPError]
        #      must be listed before [except:....URLError], otherwise the
        #      .HTTPError exception cannot be caught
        except urllib.error.HTTPError as h:
            print("Some http error when downloading kernel {}, error: ".format(kernelName), h, ", trying again after a bit.")
        except urllib.error.URLError:
            six_print("Download of kernel: {} failed with URLError, trying again after a bit.".format(kernelName), flush=True)
        current_attempt += 1
        six_print("\t Attempting to Download kernel again...", flush=True)
        time.sleep(2 + current_attempt)
    if current_attempt >= num_attempts:
        raise BaseException("Error Downloading kernel: {}, check if kernel exists at url: {}".format(kernelName, url))
Exemplo n.º 6
0
def getStandardKernels():
    six_print("\tChecking for kernels...\n", flush=True)
    getKernel(CoreKernels.pck_url)
    getKernel(CoreKernels.spk_url)
    getKernel(CoreKernels.gm_pck_url)
    getKernel(CoreKernels.lsk_url)
Exemplo n.º 7
0
def getStandardKernels():
    six_print("\tChecking for kernels...\n", flush=True)
    getKernel(CoreKernels.pck_url)
    getKernel(CoreKernels.spk_url)
    getKernel(CoreKernels.gm_pck_url)
    getKernel(CoreKernels.lsk_url)