mherrmann / mherrmann/fman

Error copying file on windows

Open
#470 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug windows
Dominant language
Python
Stars
275
Forks
16
PR merge metrics
No merged PRs in 30d

Description

When copying a folder I get the following error:


Traceback (most recent call last):
  File "fman\impl\fs_cache.py", line 36, in query
KeyError: 'stat'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "fman\impl\plugins\command_registry.py", line 106, in _execute_command
  File "C:\Users\Gilbert\AppData\Local\fman\Versions\1.1.7\Plugins\Core\core\commands\__init__.py", line 472, in __call__
    self._call(files, dest_dir, src_dir, dest_name)
  File "C:\Users\Gilbert\AppData\Local\fman\Versions\1.1.7\Plugins\Core\core\commands\__init__.py", line 626, in _call
    submit_task(CopyFiles(files, dest_dir, src_dir, dest_name))
  File "fman\__init__.py", line 319, in submit_task
  File "C:\Users\Gilbert\AppData\Local\fman\Versions\1.1.7\Plugins\Core\core\fileoperations.py", line 41, in __call__
    if not self._gather_files():
  File "C:\Users\Gilbert\AppData\Local\fman\Versions\1.1.7\Plugins\Core\core\fileoperations.py", line 91, in _gather_files
    self._enqueue(self._prepare_transfer(src, dest))
  File "C:\Users\Gilbert\AppData\Local\fman\Versions\1.1.7\Plugins\Core\core\fileoperations.py", line 155, in _enqueue
    for task in self._iter(tasks):
  File "C:\Users\Gilbert\AppData\Local\fman\Versions\1.1.7\Plugins\Core\core\fileoperations.py", line 211, in _iter
    for item in iterable:
  File "C:\Users\Gilbert\AppData\Local\fman\Versions\1.1.7\Plugins\Core\core\fs\local\__init__.py", line 178, in _prepare_copy
    join(src_url, name), join(dst_url, name), measure_size
  File "C:\Users\Gilbert\AppData\Local\fman\Versions\1.1.7\Plugins\Core\core\fs\local\__init__.py", line 178, in _prepare_copy
    join(src_url, name), join(dst_url, name), measure_size
  File "C:\Users\Gilbert\AppData\Local\fman\Versions\1.1.7\Plugins\Core\core\fs\local\__init__.py", line 169, in _prepare_copy
    src_is_dir = self.is_dir(src_path)
  File "C:\Users\Gilbert\AppData\Local\fman\Versions\1.1.7\Plugins\Core\core\fs\local\__init__.py", line 41, in is_dir
    return S_ISDIR(self.stat(existing_path).st_mode)
  File "fman\fs.py", line 201, in wrapper
  File "fman\impl\fs_cache.py", line 12, in query
  File "fman\impl\fs_cache.py", line 38, in query
  File "fman\fs.py", line 201, in <lambda>
  File "C:\Users\Gilbert\AppData\Local\fman\Versions\1.1.7\Plugins\Core\core\fs\local\__init__.py", line 44, in stat
    return os.stat(self._url_to_os_path(path))
OSError: [WinError 1920] The file cannot be accessed by the system: 'C:\\test\\test\\venv\\bin\\python'

The folder being copied was created by the python venv module i.e. python3 -m venv venv in the windows subsystem for linux. The file the causes a problem appears to be a symbolic link:

# ls -la  venv/bin/
total 12
drwxrwxrwx 1 root root  512 Aug  8 13:26 .
drwxrwxrwx 1 root root  512 Aug  8 13:26 ..
-rwxrwxrwx 1 root root 2132 Aug  8 13:26 activate
-rwxrwxrwx 1 root root 1248 Aug  8 13:26 activate.csh
-rwxrwxrwx 1 root root 2384 Aug  8 13:26 activate.fish
-rwxrwxrwx 1 root root  245 Aug  8 13:25 easy_install
-rwxrwxrwx 1 root root  245 Aug  8 13:25 easy_install-3.4
-rwxrwxrwx 1 root root  217 Aug  8 13:26 pip
-rwxrwxrwx 1 root root  217 Aug  8 13:26 pip3
-rwxrwxrwx 1 root root  217 Aug  8 13:26 pip3.4
lrwxrwxrwx 1 root root    7 Aug  8 13:25 python -> python3
lrwxrwxrwx 1 root root   16 Aug  8 13:25 python3 -> /usr/bin/python3

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in core/fs/local/init.py at _prepare_copy(), is_dir(), and stat(), then inspect fman/impl/fs_cache.py around query(). Reproduce the failure by copying a Python venv created in Windows Subsystem for Linux, including its symbolic links. Done means copying that folder no longer raises the reported WinError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.