"The system cannot move the file to a different disk drive"

I’ve stumbled upon a bug seemingly related to the use of the os.replace function and the import: move option, as using the copy option instead fixes the bug.

Note that the same config was working correctly with a previous install which ran on Python 3.7.

Here is the full bug:

Traceback (most recent call last):
  File "C:\Users\hydro\anaconda3\lib\site-packages\beets\util\__init__.py", line 496, in move
    os.replace(path, dest)
OSError: [WinError 17] The system cannot move the file to a different disk drive: '\\\\?\\C:\\Users\\hydro\\AppData\\Local\\Temp\\tmp02lvwxx1.flac' -> '\\\\?\\M:\\Musique lossless\\Ancient Methods\\2021 - The Jericho Remixes\\01 Swordplay (Hypnoskull vocal remix).flac'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\hydro\anaconda3\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\hydro\anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\hydro\anaconda3\Scripts\beet.exe\__main__.py", line 7, in <module>
  File "C:\Users\hydro\anaconda3\lib\site-packages\beets\ui\__init__.py", line 1285, in main
    _raw_main(args)
  File "C:\Users\hydro\anaconda3\lib\site-packages\beets\ui\__init__.py", line 1272, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "C:\Users\hydro\anaconda3\lib\site-packages\beets\ui\commands.py", line 973, in import_func
    import_files(lib, paths, query)
  File "C:\Users\hydro\anaconda3\lib\site-packages\beets\ui\commands.py", line 943, in import_files
    session.run()
  File "C:\Users\hydro\anaconda3\lib\site-packages\beets\importer.py", line 340, in run
    pl.run_parallel(QUEUE_SIZE)
  File "C:\Users\hydro\anaconda3\lib\site-packages\beets\util\pipeline.py", line 446, in run_parallel
    raise exc_info[1].with_traceback(exc_info[2])
  File "C:\Users\hydro\anaconda3\lib\site-packages\beets\util\pipeline.py", line 358, in run
    self.coro.send(msg)
  File "C:\Users\hydro\anaconda3\lib\site-packages\beets\util\pipeline.py", line 170, in coro
    task = func(*(args + (task,)))
  File "C:\Users\hydro\anaconda3\lib\site-packages\beets\importer.py", line 1566, in manipulate_files
    task.manipulate_files(
  File "C:\Users\hydro\anaconda3\lib\site-packages\beets\importer.py", line 757, in manipulate_files
    item.move(operation)
  File "C:\Users\hydro\anaconda3\lib\site-packages\beets\library.py", line 922, in move
    self.move_file(dest, operation)
  File "C:\Users\hydro\anaconda3\lib\site-packages\beets\library.py", line 821, in move_file

Thanks—could you please file a bug on GitHub? The traceback seems to be cut off, so I don’t see exactly what went wrong, but this is probably a regression introduced in this PR:

Done

Thank you for the instructions. Should I close or delete this topic?

Hi

I have the same issue as described with the current version.
My files are stored on a NAS and i am using windows on an other PC to execute beets. When i move files on the system disk of my PC it works well but when the files are on another disk I have the error. I can not move all my library on the system disk.
Can you tell me how to solve the issue please ?

Please note that i found another thread on the same topic : Unable to download album art using fetchart

Log :

D:\test_beets\38 Dub Band\1999 - Volume 1 [ALBUM] (MP3) (15 items)
Tagging:
    38 Dub Band - Volume 1
URL:
    https://musicbrainz.org/release/9218260f-fd19-4591-a1a0-e8939bea591a
(Similarity: 100.0%) (CD, 1999, FR, Olympic Records, 08977-2)
Traceback (most recent call last):
  File "c:\users\shoobx\appdata\local\programs\python\python36\lib\site-packages\beets\util\__init__.py", line 496, in move
    os.replace(path, dest)
OSError: [WinError 17] Impossible de déplacer le fichier vers un lecteur de disque différent: '\\\\?\\D:\\test_beets\\38 Dub Band\\1999 - Volume 1 [ALBUM] (MP3)\\01-01 - I and I Blues (96kbps).mp3' -> '\\\\?\\C:\\Users\\ShoobX\\Music\\MUSIC_LIBRARY\\38 Dub Band\\1999 - Volume 1 [ALBUM] (MP3)\\01-01 - I and I Blues (96kbps).mp3'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\ShoobX\AppData\Local\Programs\Python\Python36\Scripts\beet-script.py", line 11, in <module>
    load_entry_point('beets==1.6.0', 'console_scripts', 'beet')()
  File "c:\users\shoobx\appdata\local\programs\python\python36\lib\site-packages\beets\ui\__init__.py", line 1285, in main
    _raw_main(args)
  File "c:\users\shoobx\appdata\local\programs\python\python36\lib\site-packages\beets\ui\__init__.py", line 1272, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "c:\users\shoobx\appdata\local\programs\python\python36\lib\site-packages\beets\ui\commands.py", line 973, in import_func
    import_files(lib, paths, query)
  File "c:\users\shoobx\appdata\local\programs\python\python36\lib\site-packages\beets\ui\commands.py", line 943, in import_files
    session.run()
  File "c:\users\shoobx\appdata\local\programs\python\python36\lib\site-packages\beets\importer.py", line 340, in run
    pl.run_parallel(QUEUE_SIZE)
  File "c:\users\shoobx\appdata\local\programs\python\python36\lib\site-packages\beets\util\pipeline.py", line 446, in run_parallel
    raise exc_info[1].with_traceback(exc_info[2])
  File "c:\users\shoobx\appdata\local\programs\python\python36\lib\site-packages\beets\util\pipeline.py", line 358, in run
    self.coro.send(msg)
  File "c:\users\shoobx\appdata\local\programs\python\python36\lib\site-packages\beets\util\pipeline.py", line 170, in coro
    task = func(*(args + (task,)))
  File "c:\users\shoobx\appdata\local\programs\python\python36\lib\site-packages\beets\importer.py", line 1569, in manipulate_files
    session=session,
  File "c:\users\shoobx\appdata\local\programs\python\python36\lib\site-packages\beets\importer.py", line 757, in manipulate_files
    item.move(operation)
  File "c:\users\shoobx\appdata\local\programs\python\python36\lib\site-packages\beets\library.py", line 922, in move
    self.move_file(dest, operation)
  File "c:\users\shoobx\appdata\local\programs\python\python36\lib\site-packages\beets\library.py", line 821, in move_file
    util.move(self.path, dest)
  File "c:\users\shoobx\appdata\local\programs\python\python36\lib\site-packages\beets\util\__init__.py", line 499, in move
    prefix=py3_path(b'.' + os.path.basename(dest)),
TypeError: can't concat bytes to str

Config file :

directory: D:\PERSO\MUSIC_LIBRARY
library: D:\PERSO\MUSIC_LIBRARY\library.db

plugins: the scrub lastgenre discogs spotify embedart fetchart


import:
    move: yes
#  

ui:
    color: yes
#    

per_disc_numbering: yes

threaded: yes    

paths:
    default: %the{$albumartist}/$original_year - $album%aunique{} [%upper{$albumtype}] (%upper{$format})/$disc-$track - $title ($bitrate)
    singleton: "$artist/$title"
    comp: "#Compilations/%the{$albumartist}/$original_year-$original_month - $album%aunique{} [%upper{$albumtype}] (%upper{$format})/$disc-$track - $title ($bitrate)"
#

fetchart:
   # minwidth: 400
   # enforce_ratio: 10px
   # sources: filesystem itunes amazon albumart coverart
#
embedart:
    auto: yes
#

lyrics:
    fallback: ''
# 

discogs:
    user_token: JPvQmIAMdIdUjvMXwWQGWdMLseIhaCUwzJxKwoLb
#

That looks like a different issue, I’ve commented on Unable to download album art using fetchart with some more information.