BAT adds drive letter in destination field when running in Windows #70655

Closed
opened 2019-10-09 00:18:59 +02:00 by Jeroen Bakker · 3 comments
Member
class MyTransferrer(pack.transfer.FileTransferer):
    def __init__(self, client):
        super().__init__()
        self.client = client

    def run(self) -> None:
        for src, dst, act in self.iter_queue():
            print(dst)

the last line will output C:\cube.blender but I was expecting cube.blend as this was the project root. Note that cube.blend is not located in C:\ but in C:\Users\Jeroen\Downloads\cube.blend

DEBUG:render_polargrid.wheels:Unable to import blender_asset_tracer directly, will try wheel: No module named 'blender_asset_tracer'
DEBUG:render_polargrid.wheels:Loaded blender_asset_tracer from C:\Users\Jeroen\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\render_polargrid\wheels\blender_asset_tracer-1.1.1-py3-none-any.whl\blender_asset_tracer\__init__.py
DEBUG:asyncio:Using selector: SelectSelector
DEBUG:asyncio:Using proactor: IocpProactor
INFO:render_polargrid.data_wm:Starting
DEBUG:render_polargrid.data_wm:Setting up a new task <coroutine object PGFetchPoolsOperator.async_execute at 0x0000011FC19544C8>, so any existing task must be stopped
DEBUG:render_polargrid.data_wm:Stopping async task
DEBUG:render_polargrid.data_wm:No async task, trivially stopped
DEBUG:render_polargrid.data_wm:Created new task <Task pending coro=<PGFetchPoolsOperator.async_execute() running at C:\Users\Jeroen\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\render_polargrid\data_wm.py:103>>
DEBUG:render_polargrid.async_loop:Starting asyncio loop
DEBUG:render_polargrid.async_loop:Result of starting modal operator is {'RUNNING_MODAL'}
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): farm001.polargrid.space:80
DEBUG:urllib3.connectionpool:http://farm001.polargrid.space:80 "GET /api/user/server_pools/ HTTP/1.1" 200 765
DEBUG:render_polargrid.data_wm:Stopping async task
INFO:render_polargrid.data_wm:Signalling that we want to cancel anything that's running.
DEBUG:render_polargrid.async_loop:no more scheduled tasks, stopping after this kick.
DEBUG:render_polargrid.async_loop.AsyncLoopModalOperator:Stopped asyncio loop kicking
Info: Total files 0 | Changed 0 | Failed 0
INFO:render_polargrid.async_loop.AsyncModalOperatorMixin:Starting
DEBUG:render_polargrid.async_loop.AsyncModalOperatorMixin:Setting up a new task <coroutine object PGRenderOperator.async_execute at 0x0000011FC19544C8>, so any existing task must be stopped
DEBUG:render_polargrid.async_loop.AsyncModalOperatorMixin:Stopping async task
DEBUG:render_polargrid.async_loop.AsyncModalOperatorMixin:No async task, trivially stopped
DEBUG:render_polargrid.async_loop.AsyncModalOperatorMixin:Created new task <Task pending coro=<PGRenderOperator.async_execute() running at C:\Users\Jeroen\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\render_polargrid\space_properties.py:134>>
DEBUG:render_polargrid.async_loop:Starting asyncio loop
DEBUG:render_polargrid.async_loop:Result of starting modal operator is {'RUNNING_MODAL'}
INFO:render_polargrid.space_properties:Saving copy to temporary file C:\Users\Jeroen\Downloads\cube.polar
DEBUG:render_polargrid.data_scene:No project root is set or could be determined. Use current blend file as project root
DEBUG:render_polargrid.data_scene:No project root is set or could be determined. Use current blend file as project root
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): farm001.polargrid.space:80
DEBUG:urllib3.connectionpool:http://farm001.polargrid.space:80 "POST /api/scenes/ HTTP/1.1" 200 2
DEBUG:render_polargrid.polargrid_upload:awaiting strategise
INFO:render_polargrid.polargrid_upload:Starting BAT Pack operation
INFO:blender_asset_tracer.trace:opening: C:\Users\Jeroen\Downloads\cube.polar
DEBUG:blender_asset_tracer.blendfile.open_cached:Opening non-cached C:\Users\Jeroen\Downloads\cube.polar
DEBUG:blender_asset_tracer.blendfile:compressed blendfile detected: C:\Users\Jeroen\Downloads\cube.polar
DEBUG:blender_asset_tracer.blendfile.header:reading blend-file-header C:\Users\Jeroen\AppData\Local\Temp\tmptfxuf50q
DEBUG:blender_asset_tracer.blendfile.BlendFile:building DNA catalog
DEBUG:blender_asset_tracer.blendfile.BlendFile:building #4254 names
DEBUG:blender_asset_tracer.blendfile.BlendFile:building #751 types
DEBUG:blender_asset_tracer.blendfile.BlendFile:building #751 type-lengths
DEBUG:blender_asset_tracer.blendfile:building #645 structures
INFO:render_polargrid.polargrid_upload:Inspecting cube.polar
INFO:blender_asset_tracer.trace.file2blocks:inspecting: C:\Users\Jeroen\Downloads\cube.polar
DEBUG:blender_asset_tracer.trace.file2blocks:Queueing all blocks from file C:\Users\Jeroen\Downloads\cube.polar
DEBUG:blender_asset_tracer.trace.blocks2assets:No reader implemented for block type 'WS'
DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Scene (SC), size=6392 at 0x11fb21ca668>
DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Object (OB), size=1416 at 0x11fb21cf318>
DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Object (OB), size=1416 at 0x11fb21cf8b8>
DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Object (OB), size=1416 at 0x11fb21cfe58>
DEBUG:blender_asset_tracer.trace.blocks2assets:No reader implemented for block type 'CA'
DEBUG:blender_asset_tracer.trace.blocks2assets:No reader implemented for block type 'LA'
DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Mesh (ME), size=1576 at 0x11fb22468d8>
DEBUG:blender_asset_tracer.trace.blocks2assets:No reader implemented for block type 'MA'
DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Image (IM), size=1440 at 0x11fb220c7a8>
DEBUG:render_polargrid.polargrid_upload:awaiting execute
DEBUG:blender_asset_tracer.pack:Writing info to C:\Users\Jeroen\AppData\Local\Temp\bat-9zrfjstl-batpack\pack-info.txt
INFO:render_polargrid.polargrid_upload:transfer { src=C:\Users\Jeroen\AppData\Local\Temp\bat-9zrfjstl-batpack\pack-info.txt, dst=C:\pack-info.txt, act=Action.MOVE }
DEBUG:blender_asset_tracer.pack:Executing 1 copy actions
DEBUG:render_polargrid.polargrid_client:calculate_file_hash { path: C:\Users\Jeroen\AppData\Local\Temp\bat-9zrfjstl-batpack\pack-info.txt }
DEBUG:blender_asset_tracer.pack:Queueing copy of C:\Users\Jeroen\Downloads\cube.polar
INFO:render_polargrid.polargrid_client:filehash { hash: cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e }
INFO:render_polargrid.polargrid_upload:Transferring pack-info.txt
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): farm001.polargrid.space:80
DEBUG:urllib3.connectionpool:http://farm001.polargrid.space:80 "HEAD /api/files/ HTTP/1.1" 404 0
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): farm001.polargrid.space:80
DEBUG:render_polargrid.polargrid_upload:remove file { src=C:\Users\Jeroen\AppData\Local\Temp\bat-9zrfjstl-batpack\pack-info.txt }
INFO:render_polargrid.polargrid_upload:transfer { src=C:\Users\Jeroen\Downloads\cube.polar, dst=C:\cube.polar, act=Action.COPY }
INFO:render_polargrid.polargrid_upload:Transferring cube.polar
DEBUG:render_polargrid.polargrid_client:calculate_file_hash { path: C:\Users\Jeroen\Downloads\cube.polar }
INFO:render_polargrid.polargrid_client:filehash { hash: f23daefdef1064e5597978d2818bdd7cf490640e9eb70cf090d4036151b7a17f84360a6e45cdea233ab13841ca5b594625cf16cd9c74ec9380706decd52e1777 }
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): farm001.polargrid.space:80
DEBUG:urllib3.connectionpool:http://farm001.polargrid.space:80 "HEAD /api/files/ HTTP/1.1" 404 0
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): farm001.polargrid.space:80
INFO:render_polargrid.polargrid_upload:Pack of cube.polar done
DEBUG:render_polargrid.polargrid_upload:done
DEBUG:render_polargrid.data_scene:No project root is set or could be determined. Use current blend file as project root
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): farm001.polargrid.space:80
DEBUG:urllib3.connectionpool:http://farm001.polargrid.space:80 "POST /api/scenes/ HTTP/1.1" 200 2
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): farm001.polargrid.space:80
DEBUG:urllib3.connectionpool:http://farm001.polargrid.space:80 "POST /api/jobs/ HTTP/1.1" 200 706
DEBUG:render_polargrid.async_loop:all 2 tasks are done, fetching results and stopping after this kick.
DEBUG:render_polargrid.async_loop:   task #0: result=None
DEBUG:render_polargrid.async_loop:   task #1: result={'FINISHED'}
DEBUG:render_polargrid.async_loop.AsyncLoopModalOperator:Stopped asyncio loop kicking

After using the next function to clean up the dst field I receive the path I expected.

def cleanup_destination_path(dst: pathlib.Path):
    """
    Version 1.1.1 of BAT adds a drive letter to the dst field of a transfer
    action. This method will remove this as we expect the file to be in the
    root of the project.
    """
    if dst.drive:
        dst = dst.relative_to(*dst.parts[:1])
    return dst

This could also be a limitation of the WindowsPath class in python. Just I didn't expected the drive letter to be present.

``` class MyTransferrer(pack.transfer.FileTransferer): def __init__(self, client): super().__init__() self.client = client def run(self) -> None: for src, dst, act in self.iter_queue(): print(dst) ``` the last line will output `C:\cube.blender` but I was expecting `cube.blend` as this was the project root. Note that cube.blend is not located in `C:\` but in `C:\Users\Jeroen\Downloads\cube.blend` ``` DEBUG:render_polargrid.wheels:Unable to import blender_asset_tracer directly, will try wheel: No module named 'blender_asset_tracer' DEBUG:render_polargrid.wheels:Loaded blender_asset_tracer from C:\Users\Jeroen\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\render_polargrid\wheels\blender_asset_tracer-1.1.1-py3-none-any.whl\blender_asset_tracer\__init__.py DEBUG:asyncio:Using selector: SelectSelector DEBUG:asyncio:Using proactor: IocpProactor INFO:render_polargrid.data_wm:Starting DEBUG:render_polargrid.data_wm:Setting up a new task <coroutine object PGFetchPoolsOperator.async_execute at 0x0000011FC19544C8>, so any existing task must be stopped DEBUG:render_polargrid.data_wm:Stopping async task DEBUG:render_polargrid.data_wm:No async task, trivially stopped DEBUG:render_polargrid.data_wm:Created new task <Task pending coro=<PGFetchPoolsOperator.async_execute() running at C:\Users\Jeroen\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\render_polargrid\data_wm.py:103>> DEBUG:render_polargrid.async_loop:Starting asyncio loop DEBUG:render_polargrid.async_loop:Result of starting modal operator is {'RUNNING_MODAL'} DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): farm001.polargrid.space:80 DEBUG:urllib3.connectionpool:http://farm001.polargrid.space:80 "GET /api/user/server_pools/ HTTP/1.1" 200 765 DEBUG:render_polargrid.data_wm:Stopping async task INFO:render_polargrid.data_wm:Signalling that we want to cancel anything that's running. DEBUG:render_polargrid.async_loop:no more scheduled tasks, stopping after this kick. DEBUG:render_polargrid.async_loop.AsyncLoopModalOperator:Stopped asyncio loop kicking Info: Total files 0 | Changed 0 | Failed 0 INFO:render_polargrid.async_loop.AsyncModalOperatorMixin:Starting DEBUG:render_polargrid.async_loop.AsyncModalOperatorMixin:Setting up a new task <coroutine object PGRenderOperator.async_execute at 0x0000011FC19544C8>, so any existing task must be stopped DEBUG:render_polargrid.async_loop.AsyncModalOperatorMixin:Stopping async task DEBUG:render_polargrid.async_loop.AsyncModalOperatorMixin:No async task, trivially stopped DEBUG:render_polargrid.async_loop.AsyncModalOperatorMixin:Created new task <Task pending coro=<PGRenderOperator.async_execute() running at C:\Users\Jeroen\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\render_polargrid\space_properties.py:134>> DEBUG:render_polargrid.async_loop:Starting asyncio loop DEBUG:render_polargrid.async_loop:Result of starting modal operator is {'RUNNING_MODAL'} INFO:render_polargrid.space_properties:Saving copy to temporary file C:\Users\Jeroen\Downloads\cube.polar DEBUG:render_polargrid.data_scene:No project root is set or could be determined. Use current blend file as project root DEBUG:render_polargrid.data_scene:No project root is set or could be determined. Use current blend file as project root DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): farm001.polargrid.space:80 DEBUG:urllib3.connectionpool:http://farm001.polargrid.space:80 "POST /api/scenes/ HTTP/1.1" 200 2 DEBUG:render_polargrid.polargrid_upload:awaiting strategise INFO:render_polargrid.polargrid_upload:Starting BAT Pack operation INFO:blender_asset_tracer.trace:opening: C:\Users\Jeroen\Downloads\cube.polar DEBUG:blender_asset_tracer.blendfile.open_cached:Opening non-cached C:\Users\Jeroen\Downloads\cube.polar DEBUG:blender_asset_tracer.blendfile:compressed blendfile detected: C:\Users\Jeroen\Downloads\cube.polar DEBUG:blender_asset_tracer.blendfile.header:reading blend-file-header C:\Users\Jeroen\AppData\Local\Temp\tmptfxuf50q DEBUG:blender_asset_tracer.blendfile.BlendFile:building DNA catalog DEBUG:blender_asset_tracer.blendfile.BlendFile:building #4254 names DEBUG:blender_asset_tracer.blendfile.BlendFile:building #751 types DEBUG:blender_asset_tracer.blendfile.BlendFile:building #751 type-lengths DEBUG:blender_asset_tracer.blendfile:building #645 structures INFO:render_polargrid.polargrid_upload:Inspecting cube.polar INFO:blender_asset_tracer.trace.file2blocks:inspecting: C:\Users\Jeroen\Downloads\cube.polar DEBUG:blender_asset_tracer.trace.file2blocks:Queueing all blocks from file C:\Users\Jeroen\Downloads\cube.polar DEBUG:blender_asset_tracer.trace.blocks2assets:No reader implemented for block type 'WS' DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Scene (SC), size=6392 at 0x11fb21ca668> DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Object (OB), size=1416 at 0x11fb21cf318> DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Object (OB), size=1416 at 0x11fb21cf8b8> DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Object (OB), size=1416 at 0x11fb21cfe58> DEBUG:blender_asset_tracer.trace.blocks2assets:No reader implemented for block type 'CA' DEBUG:blender_asset_tracer.trace.blocks2assets:No reader implemented for block type 'LA' DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Mesh (ME), size=1576 at 0x11fb22468d8> DEBUG:blender_asset_tracer.trace.blocks2assets:No reader implemented for block type 'MA' DEBUG:blender_asset_tracer.trace.blocks2assets:Tracing block <BlendFileBlock.Image (IM), size=1440 at 0x11fb220c7a8> DEBUG:render_polargrid.polargrid_upload:awaiting execute DEBUG:blender_asset_tracer.pack:Writing info to C:\Users\Jeroen\AppData\Local\Temp\bat-9zrfjstl-batpack\pack-info.txt INFO:render_polargrid.polargrid_upload:transfer { src=C:\Users\Jeroen\AppData\Local\Temp\bat-9zrfjstl-batpack\pack-info.txt, dst=C:\pack-info.txt, act=Action.MOVE } DEBUG:blender_asset_tracer.pack:Executing 1 copy actions DEBUG:render_polargrid.polargrid_client:calculate_file_hash { path: C:\Users\Jeroen\AppData\Local\Temp\bat-9zrfjstl-batpack\pack-info.txt } DEBUG:blender_asset_tracer.pack:Queueing copy of C:\Users\Jeroen\Downloads\cube.polar INFO:render_polargrid.polargrid_client:filehash { hash: cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e } INFO:render_polargrid.polargrid_upload:Transferring pack-info.txt DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): farm001.polargrid.space:80 DEBUG:urllib3.connectionpool:http://farm001.polargrid.space:80 "HEAD /api/files/ HTTP/1.1" 404 0 DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): farm001.polargrid.space:80 DEBUG:render_polargrid.polargrid_upload:remove file { src=C:\Users\Jeroen\AppData\Local\Temp\bat-9zrfjstl-batpack\pack-info.txt } INFO:render_polargrid.polargrid_upload:transfer { src=C:\Users\Jeroen\Downloads\cube.polar, dst=C:\cube.polar, act=Action.COPY } INFO:render_polargrid.polargrid_upload:Transferring cube.polar DEBUG:render_polargrid.polargrid_client:calculate_file_hash { path: C:\Users\Jeroen\Downloads\cube.polar } INFO:render_polargrid.polargrid_client:filehash { hash: f23daefdef1064e5597978d2818bdd7cf490640e9eb70cf090d4036151b7a17f84360a6e45cdea233ab13841ca5b594625cf16cd9c74ec9380706decd52e1777 } DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): farm001.polargrid.space:80 DEBUG:urllib3.connectionpool:http://farm001.polargrid.space:80 "HEAD /api/files/ HTTP/1.1" 404 0 DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): farm001.polargrid.space:80 INFO:render_polargrid.polargrid_upload:Pack of cube.polar done DEBUG:render_polargrid.polargrid_upload:done DEBUG:render_polargrid.data_scene:No project root is set or could be determined. Use current blend file as project root DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): farm001.polargrid.space:80 DEBUG:urllib3.connectionpool:http://farm001.polargrid.space:80 "POST /api/scenes/ HTTP/1.1" 200 2 DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): farm001.polargrid.space:80 DEBUG:urllib3.connectionpool:http://farm001.polargrid.space:80 "POST /api/jobs/ HTTP/1.1" 200 706 DEBUG:render_polargrid.async_loop:all 2 tasks are done, fetching results and stopping after this kick. DEBUG:render_polargrid.async_loop: task #0: result=None DEBUG:render_polargrid.async_loop: task #1: result={'FINISHED'} DEBUG:render_polargrid.async_loop.AsyncLoopModalOperator:Stopped asyncio loop kicking ``` After using the next function to clean up the dst field I receive the path I expected. ``` def cleanup_destination_path(dst: pathlib.Path): """ Version 1.1.1 of BAT adds a drive letter to the dst field of a transfer action. This method will remove this as we expect the file to be in the root of the project. """ if dst.drive: dst = dst.relative_to(*dst.parts[:1]) return dst ``` This could also be a limitation of the WindowsPath class in python. Just I didn't expected the drive letter to be present.
Jeroen Bakker self-assigned this 2019-10-09 00:18:59 +02:00
Author
Member

Added subscriber: @Jeroen-Bakker

Added subscriber: @Jeroen-Bakker
Jeroen Bakker was unassigned by Dalai Felinto 2019-12-23 13:47:40 +01:00

This issue was referenced by e4bf2e8e35

This issue was referenced by e4bf2e8e35a82331b5f9fec96bf296dafee6e446

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sybren A. Stüvel self-assigned this 2020-03-17 17:18:28 +01:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-asset-tracer#70655
No description provided.