T_SFLU_nx¶
wield.control.SFLU.test.T_SFLU_nx
This is a pytest module needing documentation
Functions
most basic checks about how networkx is used to great tikz output. |
|
Show a graph reduction using networkx+tikz |
|
Most basic checks about how networkx is used |
|
Details
- T_networkx_SFLU_FP()[source][github]¶
most basic checks about how networkx is used to great tikz output.
Reductions aren’t performed much.
code
docstring
""" most basic checks about how networkx is used to great tikz output. Reductions aren't performed much. """
1def T_networkx_SFLU_FP(): 2 3 sflu = SFLU.SFLU(edges_FP, graph=True) 4 5 print('nodes') 6 print(sflu.graph_nodes_repr()) 7 8 sflu.graph_nodes_posY(-50, *[ 9 'b1_o', 10 'b2_i', 11 'a2_o', 12 'a2_i', 13 'b1_i', 14 'b2_o', 15 'a1_o', 16 'a1_i' 17 ]) 18 sflu.graph_nodes_posY(50, *[ 19 'a2_i', 20 'b1_i', 21 'b2_o', 22 'a1_o', 23 ]) 24 sflu.graph_nodes_posX(0, *['a2_o', 'a2_i']) 25 sflu.graph_nodes_posX(50, *['a1_o', 'a1_i']) 26 sflu.graph_nodes_posX(150, *['b1_o', 'b1_i']) 27 sflu.graph_nodes_posX(200, *['b2_i', 'b2_o']) 28 dprint(nx.get_node_attributes(sflu.G, 'pos')) 29 30 G = sflu.G.copy() 31 32 nx2tikz.dump_pdf( 33 G, 34 fname = tjoin('testG.pdf'), 35 texname = tjoin('testG.tex'), 36 preamble = preamble, 37 scale='1pt', 38 ) 39 pass
pytest information
This code is wrapped in a pytest function using conventions detailed in Pytest Conventions. The full name of this test, as known by the documentation, is:
wield.control.SFLU.test.T_SFLU_nx.T_networkx_SFLU_FPThe full name is useful when building documentation, to link a reference to this page using
:func:`name`, or directly include it with an autofunction directive. The collapse nodes below show every instance of the test run. There may only be one, but if the test was run multiple times through pytest parametrizations, the list can be longer.T_networkx_SFLU_FP
output
nodes ['a2_i', 'a2_o', 'a1_o', 'a1_i', 'b1_i', 'b1_o', 'b2_o', 'b2_i'] Captured stderr call {'a2_i': (0, 50), 'a2_o': (0, -50), 'a1_o': (50, 50), 'a1_i': (50, -50), 'b1_i': (150, 50), 'b1_o': (150, -50), 'b2_o': (200, 50), 'b2_i': (200, -50)} captured errors: def T_networkx_SFLU_FP(): """ most basic checks about how networkx is used to great tikz output. Reductions aren't performed much. """ sflu = SFLU.SFLU(edges_FP, graph=True) print('nodes') print(sflu.graph_nodes_repr()) sflu.graph_nodes_posY(-50, *[ 'b1_o', 'b2_i', 'a2_o', 'a2_i', 'b1_i', 'b2_o', 'a1_o', 'a1_i' ]) sflu.graph_nodes_posY(50, *[ 'a2_i', 'b1_i', 'b2_o', 'a1_o', ]) sflu.graph_nodes_posX(0, *['a2_o', 'a2_i']) sflu.graph_nodes_posX(50, *['a1_o', 'a1_i']) sflu.graph_nodes_posX(150, *['b1_o', 'b1_i']) sflu.graph_nodes_posX(200, *['b2_i', 'b2_o']) dprint(nx.get_node_attributes(sflu.G, 'pos')) G = sflu.G.copy() > nx2tikz.dump_pdf( G, fname = tjoin('testG.pdf'), texname = tjoin('testG.tex'), preamble = preamble, scale='1pt', ) ../../src/wield/control/SFLU/test/T_SFLU_nx.py:107: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../src/wield/control/SFLU/nx2tikz.py:230: in dump_pdf subprocess.run(opt, check=True, capture_output=True) /opt/conda/lib/python3.12/subprocess.py:548: in run with Popen(*popenargs, **kwargs) as process: /opt/conda/lib/python3.12/subprocess.py:1026: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <Popen: returncode: 255 args: ['pdflatex', '-interaction=batchmode', '-outpu...> args = ['pdflatex', '-interaction=batchmode', '-output-directory=/builds/wield-control/docs/maketests/test_results/T_SFLU_nx....kx_SFLU_FP/tmp6an7fh2c', '/builds/wield-control/docs/maketests/test_results/T_SFLU_nx.py/T_networkx_SFLU_FP/testG.tex'] executable = b'pdflatex', preexec_fn = None, close_fds = True, pass_fds = () cwd = None, env = None, startupinfo = None, creationflags = 0, shell = False p2cread = -1, p2cwrite = -1, c2pread = 6, c2pwrite = 8, errread = 9 errwrite = 10, restore_signals = True, gid = None, gids = None, uid = None umask = -1, start_new_session = False, process_group = -1 def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, gid, gids, uid, umask, start_new_session, process_group): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session and process_group == -1 and gid is None and gids is None and uid is None and umask < 0): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, process_group, gid, gids, uid, umask, preexec_fn, _USE_VFORK) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) if err_msg == "noexec:chdir": err_msg = "" # The error must be from chdir(cwd). err_filename = cwd elif err_msg == "noexec": err_msg = "" err_filename = None else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) if err_filename is not None: > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'pdflatex' /opt/conda/lib/python3.12/subprocess.py:1955: FileNotFoundError
- T_networkx_SFLU_FP2()[source][github]¶
Show a graph reduction using networkx+tikz
code
docstring
""" Show a graph reduction using networkx+tikz """
1def T_networkx_SFLU_FP2(): 2 3 sflu = SFLU.SFLU(edges_FP, graph=True) 4 sflu.graph_nodes_pos({ 5 'a2_i': (0, 50), 6 'a2_o': (0, -50), 7 'a1_o': (50, 50), 8 'a1_i': (50, -50), 9 'b1_i': (150, 50), 10 'b1_o': (150, -50), 11 'b2_o': (200, 50), 12 'b2_i': (200, -50) 13 }) 14 15 print('nodes') 16 print(sflu.graph_nodes_repr()) 17 G1 = sflu.G.copy() 18 sflu.reduce("a1_o") 19 sflu.graph_nodes_pos({ 20 'L.a1_o': (-50, -100), 21 # 'U.a1_o': (250, -100), 22 }) 23 print(sflu.graph_nodes_repr()) 24 G2 = sflu.G.copy() 25 sflu.reduce("b1_i") 26 sflu.graph_nodes_pos({ 27 'L.b1_i': (-50, -120), 28 'U.b1_i': (250, -120), 29 }) 30 G3 = sflu.G.copy() 31 sflu.reduce("a1_i") 32 sflu.graph_nodes_pos({ 33 # 'L.a1_i': (-50, -140), 34 'U.a1_i': (250, -140), 35 }) 36 G4 = sflu.G.copy() 37 sflu.reduce("b1_o") 38 sflu.graph_nodes_pos({ 39 'L.b1_o': (-50, -160), 40 'U.b1_o': (250, -160), 41 }) 42 G5 = sflu.G.copy() 43 nx2tikz.dump_pdf( 44 [G1, G2, G3, G4, G5], 45 fname = tjoin('testG.pdf'), 46 texname = tjoin('testG.tex'), 47 preamble = preamble, 48 scale='1pt', 49 ) 50 51 import yaml 52 print("DONE? ", sflu.nodes) 53 oplist = [] 54 for op in sflu.oplistE: 55 n, targ, args = op 56 args2 = [] 57 for a in args: 58 if isinstance(a, tuple): 59 a = tuple(a) 60 args2.append(a) 61 odict = dict(op=n, targ=tuple(targ)) 62 if args2: 63 odict['args'] = args2 64 oplist.append(odict) 65 66 print(yaml.safe_dump([oplist], default_flow_style=None)) 67 pass
pytest information
This code is wrapped in a pytest function using conventions detailed in Pytest Conventions. The full name of this test, as known by the documentation, is:
wield.control.SFLU.test.T_SFLU_nx.T_networkx_SFLU_FP2The full name is useful when building documentation, to link a reference to this page using
:func:`name`, or directly include it with an autofunction directive. The collapse nodes below show every instance of the test run. There may only be one, but if the test was run multiple times through pytest parametrizations, the list can be longer.T_networkx_SFLU_FP2
output
nodes ['a2_i', 'a2_o', 'a1_o', 'a1_i', 'b1_i', 'b1_o', 'b2_o', 'b2_i'] ['a2_i', 'a2_o', 'a1_i', 'b1_i', 'b1_o', 'b2_o', 'b2_i', 'L.a1_o'] captured errors: def T_networkx_SFLU_FP2(): """ Show a graph reduction using networkx+tikz """ sflu = SFLU.SFLU(edges_FP, graph=True) sflu.graph_nodes_pos({ 'a2_i': (0, 50), 'a2_o': (0, -50), 'a1_o': (50, 50), 'a1_i': (50, -50), 'b1_i': (150, 50), 'b1_o': (150, -50), 'b2_o': (200, 50), 'b2_i': (200, -50) }) print('nodes') print(sflu.graph_nodes_repr()) G1 = sflu.G.copy() sflu.reduce("a1_o") sflu.graph_nodes_pos({ 'L.a1_o': (-50, -100), # 'U.a1_o': (250, -100), }) print(sflu.graph_nodes_repr()) G2 = sflu.G.copy() sflu.reduce("b1_i") sflu.graph_nodes_pos({ 'L.b1_i': (-50, -120), 'U.b1_i': (250, -120), }) G3 = sflu.G.copy() sflu.reduce("a1_i") sflu.graph_nodes_pos({ # 'L.a1_i': (-50, -140), 'U.a1_i': (250, -140), }) G4 = sflu.G.copy() sflu.reduce("b1_o") sflu.graph_nodes_pos({ 'L.b1_o': (-50, -160), 'U.b1_o': (250, -160), }) G5 = sflu.G.copy() > nx2tikz.dump_pdf( [G1, G2, G3, G4, G5], fname = tjoin('testG.pdf'), texname = tjoin('testG.tex'), preamble = preamble, scale='1pt', ) ../../src/wield/control/SFLU/test/T_SFLU_nx.py:160: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../src/wield/control/SFLU/nx2tikz.py:230: in dump_pdf subprocess.run(opt, check=True, capture_output=True) /opt/conda/lib/python3.12/subprocess.py:548: in run with Popen(*popenargs, **kwargs) as process: /opt/conda/lib/python3.12/subprocess.py:1026: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <Popen: returncode: 255 args: ['pdflatex', '-interaction=batchmode', '-outpu...> args = ['pdflatex', '-interaction=batchmode', '-output-directory=/builds/wield-control/docs/maketests/test_results/T_SFLU_nx...._SFLU_FP2/tmp49vk0db2', '/builds/wield-control/docs/maketests/test_results/T_SFLU_nx.py/T_networkx_SFLU_FP2/testG.tex'] executable = b'pdflatex', preexec_fn = None, close_fds = True, pass_fds = () cwd = None, env = None, startupinfo = None, creationflags = 0, shell = False p2cread = -1, p2cwrite = -1, c2pread = 6, c2pwrite = 8, errread = 9 errwrite = 10, restore_signals = True, gid = None, gids = None, uid = None umask = -1, start_new_session = False, process_group = -1 def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, gid, gids, uid, umask, start_new_session, process_group): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session and process_group == -1 and gid is None and gids is None and uid is None and umask < 0): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, process_group, gid, gids, uid, umask, preexec_fn, _USE_VFORK) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) if err_msg == "noexec:chdir": err_msg = "" # The error must be from chdir(cwd). err_filename = cwd elif err_msg == "noexec": err_msg = "" err_filename = None else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) if err_filename is not None: > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'pdflatex' /opt/conda/lib/python3.12/subprocess.py:1955: FileNotFoundError
- T_networkx_basic()[source][github]¶
Most basic checks about how networkx is used
code
docstring
""" Most basic checks about how networkx is used """
1def T_networkx_basic(): 2 3 G = nx.DiGraph() 4 G.add_edges_from([(k1.replace('_', ''), k2.replace('_', '')) for k1, k2 in FP_edges.keys()]) 5 print(G.nodes()) 6 axB = mplfigB() 7 pos = nx.nx_pydot.graphviz_layout(G, prog = 'dot') 8 nx.set_node_attributes(G, pos, 'pos') 9 print(G.nodes(data=True)) 10 nx.draw_networkx(G, arrows=True, pos = nx.get_node_attributes(G, 'pos'), ax = axB.ax0) 11 axB.save(tjoin('test')) 12 13 nx2tikz.dump_tex( 14 G, 15 fname = tjoin('test.tex'), 16 ) 17 pass
pytest information
This code is wrapped in a pytest function using conventions detailed in Pytest Conventions. The full name of this test, as known by the documentation, is:
wield.control.SFLU.test.T_SFLU_nx.T_networkx_basicThe full name is useful when building documentation, to link a reference to this page using
:func:`name`, or directly include it with an autofunction directive. The collapse nodes below show every instance of the test run. There may only be one, but if the test was run multiple times through pytest parametrizations, the list can be longer.T_networkx_basic
output
['a2o', 'a2i', 'a1o', 'a1i', 'b1o', 'b1i', 'b2o', 'b2i'] [('a2o', {'pos': (27.0, 378.0)}), ('a2i', {'pos': (27.0, 18.0)}), ('a1o', {'pos': (55.0, 90.0)}), ('a1i', {'pos': (55.0, 306.0)}), ('b1o', {'pos': (101.0, 234.0)}), ('b1i', {'pos': (101.0, 162.0)}), ('b2o', {'pos': (173.0, 234.0)}), ('b2i', {'pos': (173.0, 162.0)})]
- T_networkx_lg()[source][github]¶
code
docstring
""" """
1def T_networkx_lg(): 2 3 G = nx.DiGraph() 4 G.add_edges_from(edges.keys()) 5 print(G.nodes()) 6 axB = mplfigB() 7 #pos = nx.nx_pydot.graphviz_layout(G, prog = 'dot') 8 nx.set_node_attributes(G, locs, 'pos') 9 nx.set_node_attributes( 10 G, 11 {}, 12 'pin' 13 ) 14 nx.set_node_attributes( 15 G, 16 { 17 "SmE": "$S$", 18 "SrO": "$R$" , 19 "XmE": "$X$" , 20 "YmE": "$Y$" , 21 }, 'label' 22 ) 23 print(G.nodes(data=True)) 24 nx.draw_networkx(G, arrows=True, pos = nx.get_node_attributes(G, 'pos'), ax = axB.ax0) 25 nx.set_edge_attributes(G, edges, 'edge_text') 26 axB.save(tjoin('test')) 27 28 nx2tikz.dump_tex( 29 [G, G,], 30 fname = tjoin('test.tex'), 31 preamble = preamble, 32 ) 33 nx2tikz.dump_pdf( 34 [G, G,], 35 fname = tjoin('testG.pdf'), 36 preamble = preamble, 37 ) 38 pass
pytest information
This code is wrapped in a pytest function using conventions detailed in Pytest Conventions. The full name of this test, as known by the documentation, is:
wield.control.SFLU.test.T_SFLU_nx.T_networkx_lgThe full name is useful when building documentation, to link a reference to this page using
:func:`name`, or directly include it with an autofunction directive. The collapse nodes below show every instance of the test run. There may only be one, but if the test was run multiple times through pytest parametrizations, the list can be longer.T_networkx_lg
output
['BsPi', 'BsXo', 'BsXi', 'BsPo', 'BsYi', 'BsSo', 'BsSi', 'BsYo', 'Pi', 'Po', 'Yi', 'Yo', 'Yi2', 'Yo2', 'eYi', 'eYo', 'eYi2', 'eYo2', 'Xi', 'Xo', 'Xi2', 'Xo2', 'SmE', 'Si2', 'So2', 'SrO', 'XmE', 'eXo', 'YmE', 'eXi', 'eXi2', 'eXo2', 'Si', 'So'] [('BsPi', {'pos': (0, 5)}), ('BsXo', {'pos': (20, 5)}), ('BsXi', {'pos': (20, -5)}), ('BsPo', {'pos': (0, -5)}), ('BsYi', {'pos': (15, 10)}), ('BsSo', {'pos': (15, -10)}), ('BsSi', {'pos': (5, -10)}), ('BsYo', {'pos': (5, 10)}), ('Pi', {'pos': (-5, -5)}), ('Po', {'pos': (-5, 5)}), ('Yi', {'pos': (5, 15)}), ('Yo', {'pos': (15, 15)}), ('Yi2', {'pos': (15, 20)}), ('Yo2', {'pos': (5, 20)}), ('eYi', {'pos': (5, 30)}), ('eYo', {'pos': (15, 30)}), ('eYi2', {'pos': (15, 35)}), ('eYo2', {'pos': (5, 35)}), ('Xi', {'pos': (25, 5)}), ('Xo', {'pos': (25, -5)}), ('Xi2', {'pos': (30, -5)}), ('Xo2', {'pos': (30, 5)}), ('SmE', {'pos': (5, -25), 'label': '$S$'}), ('Si2', {'pos': (5, -20)}), ('So2', {'pos': (15, -20)}), ('SrO', {'pos': (15, -25), 'label': '$R$'}), ('XmE', {'pos': (40, -10), 'label': '$X$'}), ('eXo', {'pos': (40, -5)}), ('YmE', {'pos': (20, 30), 'label': '$Y$'}), ('eXi', {'pos': (40, 5)}), ('eXi2', {'pos': (45, -5)}), ('eXo2', {'pos': (45, 5)}), ('Si', {'pos': (15, -15)}), ('So', {'pos': (5, -15)})] captured errors: def T_networkx_lg(): """ """ G = nx.DiGraph() G.add_edges_from(edges.keys()) print(G.nodes()) axB = mplfigB() #pos = nx.nx_pydot.graphviz_layout(G, prog = 'dot') nx.set_node_attributes(G, locs, 'pos') nx.set_node_attributes( G, {}, 'pin' ) nx.set_node_attributes( G, { "SmE": "$S$", "SrO": "$R$" , "XmE": "$X$" , "YmE": "$Y$" , }, 'label' ) print(G.nodes(data=True)) nx.draw_networkx(G, arrows=True, pos = nx.get_node_attributes(G, 'pos'), ax = axB.ax0) nx.set_edge_attributes(G, edges, 'edge_text') axB.save(tjoin('test')) nx2tikz.dump_tex( [G, G,], fname = tjoin('test.tex'), preamble = preamble, ) > nx2tikz.dump_pdf( [G, G,], fname = tjoin('testG.pdf'), preamble = preamble, ) ../../src/wield/control/SFLU/test/T_SFLU_nx.py:329: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../src/wield/control/SFLU/nx2tikz.py:230: in dump_pdf subprocess.run(opt, check=True, capture_output=True) /opt/conda/lib/python3.12/subprocess.py:548: in run with Popen(*popenargs, **kwargs) as process: /opt/conda/lib/python3.12/subprocess.py:1026: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <Popen: returncode: 255 args: ['pdflatex', '-interaction=batchmode', '-outpu...> args = ['pdflatex', '-interaction=batchmode', '-output-directory=/builds/wield-control/docs/maketests/test_results/T_SFLU_nx...._lg/tmpgkmfqf18', '/builds/wield-control/docs/maketests/test_results/T_SFLU_nx.py/T_networkx_lg/tmpgkmfqf18/testG.tex'] executable = b'pdflatex', preexec_fn = None, close_fds = True, pass_fds = () cwd = None, env = None, startupinfo = None, creationflags = 0, shell = False p2cread = -1, p2cwrite = -1, c2pread = 6, c2pwrite = 8, errread = 9 errwrite = 10, restore_signals = True, gid = None, gids = None, uid = None umask = -1, start_new_session = False, process_group = -1 def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, gid, gids, uid, umask, start_new_session, process_group): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session and process_group == -1 and gid is None and gids is None and uid is None and umask < 0): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, process_group, gid, gids, uid, umask, preexec_fn, _USE_VFORK) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) if err_msg == "noexec:chdir": err_msg = "" # The error must be from chdir(cwd). err_filename = cwd elif err_msg == "noexec": err_msg = "" err_filename = None else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) if err_filename is not None: > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'pdflatex' /opt/conda/lib/python3.12/subprocess.py:1955: FileNotFoundError