Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with windows 3.7 and graphviz #8364

Closed
jsignell opened this issue Nov 8, 2021 · 7 comments
Closed

Issues with windows 3.7 and graphviz #8364

jsignell opened this issue Nov 8, 2021 · 7 comments
Labels

Comments

@jsignell
Copy link
Member

jsignell commented Nov 8, 2021

There are some issues with windows 3.7 and graphviz.

_______________________________ test_visualize ________________________________
[gw3] win32 -- Python 3.7.12 C:\Miniconda3\envs\test-environment\python.exe

tmpdir = local('C:\\Users\\runneradmin\\AppData\\Local\\Temp\\pytest-of-runneradmin\\pytest-0\\popen-gw3\\test_visualize0')

    def test_visualize(tmpdir):
        pytest.importorskip("graphviz")
        da = pytest.importorskip("dask.array")
        fn = str(tmpdir)
        a = da.ones(10, chunks=(5,))
        b = a + 1
        c = a + 2
        d = b + c
>       d.dask.visualize(fn)

dask\tests\test_highgraph.py:21: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
dask\highlevelgraph.py:897: in visualize
    graphviz_to_file(g, filename, format)
dask\dot.py:288: in graphviz_to_file
    data = g.pipe(format=format)
C:\Miniconda3\envs\test-environment\lib\site-packages\graphviz\piping.py:116: in pipe
    return self._pipe_lines(*args, input_encoding=self._encoding, **kwargs)
C:\Miniconda3\envs\test-environment\lib\site-packages\graphviz\backend\piping.py:149: in pipe_lines
    proc = execute.run_check(cmd, capture_output=True, quiet=quiet, **kwargs)
C:\Miniconda3\envs\test-environment\lib\site-packages\graphviz\backend\execute.py:80: in run_check
    popen = subprocess.Popen(cmd, stdin=subprocess.PIPE, **kwargs)
C:\Miniconda3\envs\test-environment\lib\subprocess.py:800: in __init__
    restore_signals, start_new_session)
C:\Miniconda3\envs\test-environment\lib\subprocess.py:1148: in _execute_child
    args = list2cmdline(args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

seq = [WindowsPath('dot'), '-Kdot', '-Tpng']

    def list2cmdline(seq):
        """
        Translate a sequence of arguments into a command line
        string, using the same rules as the MS C runtime:
    
        1) Arguments are delimited by white space, which is either a
           space or a tab.
    
        2) A string surrounded by double quotation marks is
           interpreted as a single argument, regardless of white space
           contained within.  A quoted string can be embedded in an
           argument.
    
        3) A double quotation mark preceded by a backslash is
           interpreted as a literal double quotation mark.
    
        4) Backslashes are interpreted literally, unless they
           immediately precede a double quotation mark.
    
        5) If backslashes immediately precede a double quotation mark,
           every pair of backslashes is interpreted as a literal
           backslash.  If the number of backslashes is odd, the last
           backslash escapes the next double quotation mark as
           described in rule 3.
        """
    
        # See
        # http://msdn.microsoft.com/en-us/library/17w5ykft.aspx
        # or search http://msdn.microsoft.com for
        # "Parsing C++ Command-Line Arguments"
        result = []
        needquote = False
        for arg in seq:
            bs_buf = []
    
            # Add a space to separate this argument from the others
            if result:
                result.append(' ')
    
>           needquote = (" " in arg) or ("\t" in arg) or not arg
E           TypeError: argument of type 'WindowsPath' is not iterable

C:\Miniconda3\envs\test-environment\lib\subprocess.py:555: TypeError

---------- coverage: platform win32, python 3.7.12-final-0 -----------

Originally posted by @jsignell in #8363 (comment)

@jsignell
Copy link
Member Author

jsignell commented Nov 9, 2021

As @boazmohar points out in this comment: #8354 (comment) this might be a Python 3.7 but with pathlib.

@jsignell
Copy link
Member Author

jsignell commented Nov 9, 2021

It looks like this is being tracked on graphviz already: xflr6/graphviz#145 and we can pin to 0.17 to avoid.

@jsignell
Copy link
Member Author

jsignell commented Nov 9, 2021

I'm going to close this one since I pinned python-graphviz in environment-3.7

@jsignell jsignell closed this as completed Nov 9, 2021
@gjoseph92
Copy link
Collaborator

@jsignell thanks for jumping on this fix. Do you have an issue open just to track unpinning this?

@jsignell
Copy link
Member Author

jsignell commented Nov 9, 2021

I'm not sure we ever need to unpin since it's only Python 3.7. But if you think it's important then sure, we can open an issue :)

@jakirkham
Copy link
Member

FWIW the fix went into 0.18.1, which has since been packaged and released. So we can unpin this

@jsignell
Copy link
Member Author

Thanks for mentioning that @jakirkham :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants