mottosso / bleeding-rez

Rez - Reproducible software environments for Windows, Linux and MacOS
GNU Lesser General Public License v3.0
72 stars 10 forks source link

NameError: name 'WindowsError' is not defined #96

Closed tweak-wtf closed 4 years ago

tweak-wtf commented 4 years ago

I run bleeding-rez 2.40.4 in a dedicated conda environment on ubuntu. I'm trying to bind packages to a custom packages directory that is on a network share. When running rez-bind --quickstart -i /mnt/<PATH_TO_SHARE> i get:

NameError: name 'WindowsError' is not defined

I want to build and deploy packages on ubuntu since building is kinda quirky on windows but users resolving rezenvs are on windows.

mottosso commented 4 years ago

That's interesting. Does it give you a file and line number? Try replacing any reference to WindowsError with OSError.

tweak-wtf commented 4 years ago

yeah it's the serialise.py in the rez installation on line 74. When replacing with with OSError i get the following stacktrace.

I added some debugging prints for myself. It seems that it has problem writing package.py but the contents the AtomicWriter wants to write are present on disk.

(rez) root@res:/usr/local/dev_td/rez_tests/bleeding-rez# rez-bind -i /mnt/repository/rez/packages platform
searching /usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/site-packages/rez/bind...
creating package 'platform' in /mnt/repository/rez/packages...
cache_filepath: /tmp/rez_write_5d3ytmcd/package.py
filepath: /mnt/repository/rez/packages/platform/linux/package.py
content: # -*- coding: utf-8 -*-

name = 'platform'

version = 'linux'

timestamp = 1592908027

format_version = 2

Traceback (most recent call last):
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/site-packages/rez/serialise.py", line 75, in open_file_for_write
    f.write(content)
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/site-packages/rez/vendor/atomicwrites/__init__.py", line 154, in _open
    self.commit(f)
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/site-packages/rez/vendor/atomicwrites/__init__.py", line 185, in commit
    replace_atomic(f.name, self._path)
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/site-packages/rez/vendor/atomicwrites/__init__.py", line 92, in replace_atomic
    return _replace_atomic(src, dst)
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/site-packages/rez/vendor/atomicwrites/__init__.py", line 50, in _replace_atomic
    _sync_directory(os.path.normpath(os.path.dirname(dst)))
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/site-packages/rez/vendor/atomicwrites/__init__.py", line 44, in _sync_directory
    _proper_fsync(fd)
OSError: [Errno 22] Invalid argument

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/dev_td/miniconda/install/envs/rez/bin/rez-bind", line 8, in <module>
    sys.exit(rez_bind())
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/site-packages/rez/cli/_main.py", line 201, in rez_bind
    return run("bind")
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/site-packages/rez/cli/_main.py", line 153, in run
    returncode = run_cmd()
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/site-packages/rez/cli/_main.py", line 145, in run_cmd
    return opts.func(opts, opts.parser, extra_arg_groups)
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/site-packages/rez/cli/bind.py", line 99, in command
    bind_package(name,
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/site-packages/rez/package_bind.py", line 109, in bind_package
    variants_ = _bind_package(name_,
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/site-packages/rez/package_bind.py", line 174, in _bind_package
    variants = bindfunc(path=install_path,
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/site-packages/rez/bind/platform.py", line 16, in bind
    pkg.version = version
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/site-packages/rez/package_maker__.py", line 207, in make_package
    variant_ = variant.install(path)
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/site-packages/rez/packages_.py", line 400, in install
    resource = repo.install_variant(self.resource,
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/site-packages/rezplugins/package_repository/filesystem.py", line 625, in install_variant
    variant = _create_variant()
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/site-packages/rezplugins/package_repository/filesystem.py", line 615, in _create_variant
    return self._create_variant(
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/site-packages/rezplugins/package_repository/filesystem.py", line 1077, in _create_variant
    dump_package_data(package_data, buf=f, format_=package_format)
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/usr/local/dev_td/miniconda/install/envs/rez/lib/python3.8/site-packages/rez/serialise.py", line 86, in open_file_for_write
    raise OSError("%s: '%s'" % (e, filepath))
OSError: [Errno 22] Invalid argument: '/mnt/repository/rez/packages/platform/linux/package.py'

Edit: update log output, better explanation

mottosso commented 4 years ago

Hm, looks like an issue with the network mount and that atomic package. Is this mounted in a Docker container? Give this a try in vanilla-rez and see if the same occurs. The packages it builds for you work with either one.

tweak-wtf commented 4 years ago

No this is a simple synology share... I figured it out by replacing the drive letter with the DNS name of the server. This works just fine, so you may close this issue :)

mottosso commented 4 years ago

Cool, thanks for the update. 👍