[Python] Unable to convert BIM360 Derivative

Discussão em 'Python' iniciado por Stack, Junho 5, 2025.

  1. Stack

    Stack Membro Participativo

    I've created a python app with the intention of downloading the svf file converted to gltf and sqlLite properties file from BIM360. I'm using the svf-utils library. The app gets the necessary data, such as the derivative urn, from BIM360 via the api. I'm attempting to run the svf2-to-gltf.cmd via a sub process in the python app. This is the snippet of code I'm running

    env = os.environ.copy()
    env['APS_CLIENT_ID'] = os.getenv('APS_CLIENT_ID')
    env['APS_CLIENT_SECRET'] = os.getenv('APS_CLIENT_SECRET')

    # Quote the path because of spaces
    output_path_quoted = f'"{output_path}"'
    svf2_Path = r'C:\Users\.....\AppData\Roaming\npm\svf2-to-gltf.cmd'
    urn = derivative_uri['uri']
    command = f'{svf2_Path} {urn} -- --output {output_path_quoted} --verbose'

    try:
    result = subprocess.run(command, env=env, text=True, capture_output=True, shell=True, check=True)
    logger.debug(f'\tSuccess {result.stdout}')
    except subprocess.CalledProcessError as e:
    logger.error(f'\tFailed to download SVF file from APS: {e.stderr}')


    And I'm getting the following error: APS - ERROR - Failed to download SVF file from APS: Request failed with status code 403

    When I try running the same code with svf-to-gltf.cmd I get the following error:

    APS - ERROR - Failed to download SVF file from APS: C:\Users\.....\AppData\Roaming\npm\node_modules\svf-utils\bin\svf-to-gltf.js:111
    await convertRemote(urn, guid, folder, options);
    ^^^^^

    SyntaxError: await is only valid in async functions and the top level bodies of modules
    at wrapSafe (node:internal/modules/cjs/loader:1662:18)
    at Module._compile (node:internal/modules/cjs/loader:1704:20)
    at Object..js (node:internal/modules/cjs/loader:1895:10)
    at Module.load (node:internal/modules/cjs/loader:1465:32)
    at Function._load (node:internal/modules/cjs/loader:1282:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
    at node:internal/main/run_main_module:36:49

    Node.js v22.16.0


    I've made sure to set the appropriate scopes in the auth for the app: account:read data:read bucket:read viewables:read The grant type is: client_credentials

    Any insights into what I may be doing wrong would be greatly appreciated. Cheers,

    Continue reading...

Compartilhe esta Página