3

I have a computer that has a C and D drive, where PyCharm, Python and the source code are installed on the D drive. I'm using Pipenv with PIPENV_VENV_IN_PROJECT set to enabled so that also ends up in the D drive. Despite all this, when running with code coverage enabled, I get this error:

Destroying test database for alias 'default'...
Traceback (most recent call last):
  File "D:\Development\PyCharm\PyCharm 2019.1.1\helpers\coverage_runner\run_coverage.py", line 54, in <module>
    main()
  File "D:\Business\projectx\.venv\lib\site-packages\coverage\cmdline.py", line 770, in main
    status = CoverageScript().command_line(argv)
  File "D:\Business\projectx\.venv\lib\site-packages\coverage\cmdline.py", line 489, in command_line
    return self.do_run(options, args)
  File "D:\Business\projectx\.venv\lib\site-packages\coverage\cmdline.py", line 657, in do_run
    self.coverage.save()
  File "D:\Business\projectx\.venv\lib\site-packages\coverage\control.py", line 529, in save
    data = self.get_data()
  File "D:\Business\projectx\.venv\lib\site-packages\coverage\control.py", line 583, in get_data
    if self._collector and self._collector.flush_data():
  File "D:\Business\projectx\.venv\lib\site-packages\coverage\collector.py", line 425, in flush_data
    self.covdata.add_lines(abs_file_dict(self.data))
  File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 236, in add_lines
    self._choose_lines_or_arcs(lines=True)
  File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 279, in _choose_lines_or_arcs
    with self._connect() as con:
  File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 160, in _connect
    self._create_db()
  File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 117, in _create_db
    with self._db:
  File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 525, in __enter__
    self.connect()
  File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 510, in connect
    filename = os.path.relpath(self.filename)
  File "D:\Business\projectx\.venv\lib\ntpath.py", line 562, in relpath
    path_drive, start_drive))
ValueError: path is on mount 'C:', start on mount 'D:'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Development\PyCharm\PyCharm 2019.1.1\helpers\coverage_runner\run_coverage.py", line 58, in <module>
    main(["xml", "-o", coverage_file + ".xml", "--ignore-errors"])
  File "D:\Business\projectx\.venv\lib\site-packages\coverage\cmdline.py", line 770, in main
    status = CoverageScript().command_line(argv)
  File "D:\Business\projectx\.venv\lib\site-packages\coverage\cmdline.py", line 511, in command_line
    self.coverage.load()
  File "D:\Business\projectx\.venv\lib\site-packages\coverage\control.py", line 336, in load
    self._data.read()
  File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 409, in read
    with self._connect():       # TODO: doesn't look right
  File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 160, in _connect
    self._create_db()
  File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 117, in _create_db
    with self._db:
  File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 525, in __enter__
    self.connect()
  File "D:\Business\projectx\.venv\lib\site-packages\coverage\sqldata.py", line 510, in connect
    filename = os.path.relpath(self.filename)
  File "D:\Business\projectx\.venv\lib\ntpath.py", line 562, in relpath
    path_drive, start_drive))
ValueError: path is on mount 'C:', start on mount 'D:'

Any ideas why?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
  • 1
    `os.path.relpath` requires `path` and `start` to be on the same drive, where a drive is either A: - Z: or a UNC "\\server\share". The default value of `start` is the process current working directory. The author of this package failed to account for this problem. You could change the working directory. Or maybe mount drive D: in a folder on the C: drive. For example: `mkdir C:\Mount\D` `&` `mountvol C:\Mount\D Volume{GUID}`. You can get the "Volume{GUID}" name for drive D: by running `mountvol` without options. Then create a new virtual environment using the new mountpoint. – Eryk Sun May 08 '19 at 05:22

0 Answers0