T_SFLU_DRFPMI_build¶
wield.control.SFLU.test.T_SFLU_DRFPMI_build
These tests demonstrate a heierachrical way to build connection graphs for optical systems of mirrors and beamsplitters.
Functions
Show a graph reduction using networkx+tikz |
Details
- T_SFLU_DRFPMI_build_show()[source][github]¶
Show a graph reduction using networkx+tikz
code
docstring
""" Show a graph reduction using networkx+tikz """
1def T_SFLU_DRFPMI_build_show(): 2 3 ifo = optics.GraphElement() 4 ifo.subgraph_add( 5 'prm', optics.LossyBasisMirror(), 6 translation_xy=(-25, 0), 7 rotation_deg=180, 8 ) 9 ifo.subgraph_add( 10 'Xitm', optics.LossyBasisMirror(), 11 translation_xy=(25, 0), 12 rotation_deg=180, 13 ) 14 ifo.subgraph_add( 15 'Xetm', optics.LossyMirror(), 16 translation_xy=(55, 0), 17 rotation_deg=0 18 ) 19 ifo.subgraph_add( 20 'srm', optics.LossyBasisMirror(), 21 translation_xy=(0, -25), 22 rotation_deg=90+180, 23 ) 24 ifo.subgraph_add( 25 'Yitm', optics.LossyBasisMirror(), 26 translation_xy=(0, 25), 27 rotation_deg=90+180, 28 ) 29 ifo.subgraph_add( 30 'Yetm', optics.LossyMirror(), 31 translation_xy=(0, 55), 32 rotation_deg=90, 33 ) 34 ifo.subgraph_add( 35 'bs', optics.BeamSplitter(), 36 translation_xy=(0, 0), 37 rotation_deg=0 38 ) 39 ifo.edges.update({ 40 ("prm.fr.i", "bs.frA.o"): "prc.tau", 41 ("bs.frA.i", "prm.fr.o"): "prc.tau", 42 43 ("srm.fr.i", "bs.bkB.o"): "sec.tau", 44 ("bs.bkB.i", "srm.fr.o"): "sec.tau", 45 46 ("Yitm.bk.i", "bs.frB.o"): 'BSY.tau', 47 ("bs.frB.i", "Yitm.bk.o"): 'BSY.tau', 48 49 ("Xitm.bk.i", "bs.bkA.o"): 'BSX.tau', 50 ("bs.bkA.i", "Xitm.bk.o"): 'BSX.tau', 51 52 ("Xetm.fr.i", "Xitm.fr.o"): "XARM.tau", 53 ("Xitm.fr.i", "Xetm.fr.o"): "XARM.tau", 54 55 ("Yetm.fr.i", "Yitm.fr.o"): "YARM.tau", 56 ("Yitm.fr.i", "Yetm.fr.o"): "YARM.tau", 57 }) 58 ifo['Yetm'].node_angle["fr.o"] = -45 59 ifo['Yitm'].node_angle["bk.o"] = -45 60 ifo['srm'].node_angle["bk.o"] = -45 61 ifo['srm'].edges["bk.i", "bk.i.exc"] = "sec_to" 62 ifo['srm'].edges["bk.o.tp", "bk.o"] = "sec_fr" 63 ifo['srm'].edge_handedness["bk.o.tp", "bk.o"] = "r" 64 65 ifo['srm'].locations["bk.i.exc"] = (15, -10) 66 ifo['srm'].locations["bk.o.tp"] = (15, 10) 67 68 ifo['prm'].edges["bk.i", "bk.i.exc"] = "1" 69 ifo['prm'].edges["bk.o.tp", "bk.o"] = "1" 70 ifo['prm'].node_angle["bk.i.exc"] = +45 71 72 ifo['prm'].locations["bk.i.exc"] = (15, -10) 73 ifo['prm'].locations["bk.o.tp"] = (15, 10) 74 ifo['prm'].edges["fr.i.tp", "fr.i"] = "1" 75 ifo['prm'].locations["fr.i.tp"] = (-5, 12) 76 77 ifo['Xetm'].edges["fr.i.tp", "fr.i"] = "1" 78 ifo['Xetm'].edges["fr.o", "fr.o.exc"] = "1" 79 ifo['Xetm'].locations["fr.i.tp"] = (-5, 15) 80 ifo['Xetm'].locations["fr.o.exc"] = (-5, -15) 81 82 ifo['Yetm'].edges["fr.i.tp", "fr.i"] = "1" 83 ifo['Yetm'].edge_handedness["fr.i.tp", "fr.i"] = "r" 84 ifo['Yetm'].edges["fr.o", "fr.o.exc"] = "1" 85 ifo['Yetm'].locations["fr.i.tp"] = (-5, 15) 86 ifo['Yetm'].locations["fr.o.exc"] = (-5, -15) 87 88 ifo['Xitm'].edges["bk.i.tp", "bk.i"] = "1" 89 ifo['Xitm'].locations["bk.i.tp"] = (5, -12) 90 ifo['Yitm'].edges["bk.i.tp", "bk.i"] = "1" 91 ifo['Yitm'].locations["bk.i.tp"] = (5, -12) 92 93 sflu = SFLU.SFLU( 94 edges=ifo.build_edges(), 95 derivatives=[ 96 'Xetm.fr.r', 97 'Yetm.fr.r', 98 'srm.fr.r', 99 'BSX.tau', 100 'BSY.tau', 101 ], 102 reduce_list=reduce_list, 103 graph=True, 104 ) 105 # match=False allows a reduced input/output set 106 # sflu.graph_nodes_pos(ifo.build_locations(), match=True) 107 ifo.update_sflu(sflu) 108 G1 = sflu.G.copy() 109 110 if True: 111 yamlstr = sflu.convert_self2yamlstr() 112 # print(yamlstr) 113 with open(tjoin('DRFPMI.yaml'), 'w') as F: 114 F.write(yamlstr) 115 sflu = SFLU.SFLU.convert_yamlstr2self(yamlstr) 116 #sflu.graph_nodes_pos(DRFPMI_locs, match=True) 117 118 print('inputs: ', sflu.inputs) 119 print('outputs: ', sflu.outputs) 120 print('nodes: ', sflu.nodes) 121 # dprint('edges: ', sflu.edges) 122 123 print('nodes') 124 #print(sflu.graph_nodes_repr()) 125 #G1 = sflu.G.copy() 126 sflu.graph_reduce_auto_pos(lX=-10, rX=+10, Y=0, dY=-2) 127 sflu.reduce(*reduce_list) 128 assert(not sflu.nodes) 129 sflu.graph_reduce_auto_pos_io(lX=-30, rX=+30, Y=10, dY=-2) 130 G2 = sflu.G.copy() 131 dprint(G1.edges) 132 133 nx2tikz.dump_pdf( 134 [ 135 G1, 136 G2, 137 ], 138 fname = tjoin('testG.pdf'), 139 texname = tjoin('testG.tex'), 140 # preamble = preamble, 141 scale='10pt', 142 )
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_DRFPMI_build.T_SFLU_DRFPMI_build_showThe 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_SFLU_DRFPMI_build_show
output
inputs: {'srm.bkL.i', 'Yetm.bk.i', 'Yetm.fr.o.exc', 'Xetm.bk.i', 'srm.bk.i.exc', 'bs.frB.i.Di', 'srm.fr.o.Di', 'prm.frL.i', 'Yetm.frL.i', 'prm.bkL.i', 'Xitm.frL.i', 'Xetm.bkL.i', 'Xitm.bkL.i', 'Yetm.bkL.i', 'bs.bkA.i.Di', 'Xetm.fr.o.exc', 'Yitm.bk.i.Di', 'Yitm.frL.i', 'Xitm.bk.i.Di', 'Yetm.fr.o.Di', 'srm.frL.i', 'prm.bk.i.exc', 'Xetm.frL.i', 'Xetm.fr.o.Di', 'Yitm.bkL.i'} outputs: {'Xetm.bk.o', 'prm.fr.i.tp', 'Yetm.bk.o', 'Yetm.fr.i.Do', 'bs.frB.o.Do', 'Yitm.bk.i.tp', 'Yetm.fr.i.tp', 'Xetm.fr.i.tp', 'Xitm.bk.i.tp', 'srm.bk.o.tp', 'Xitm.bk.o.Do', 'Yitm.bk.o.Do', 'prm.bk.o.tp', 'srm.fr.i.Do', 'bs.bkA.o.Do', 'Xetm.fr.i.Do'} nodes: {'prm.bk.i', 'Xitm.bk.o', 'Yetm.fr.o', 'prm.fr.o', 'bs.frB.o', 'bs.frB.i', 'Xitm.fr.i', 'Yitm.bk.o', 'bs.bkB.o', 'srm.bk.o', 'prm.bk.o', 'bs.bkA.i', 'prm.fr.i', 'Xitm.fr.o', 'bs.frA.o', 'Yitm.fr.i', 'bs.frA.i', 'Xitm.bk.i', 'Yitm.fr.o', 'srm.fr.i', 'srm.bk.i', 'Yitm.bk.i', 'srm.fr.o', 'bs.bkB.i', 'bs.bkA.o', 'Xetm.fr.o', 'Yetm.fr.i', 'Xetm.fr.i'} nodes Captured stderr call OutEdgeView([('prm.bk.i', 'prm.fr.o'), ('prm.bk.i', 'prm.bk.o'), ('prm.fr.o', 'bs.frA.i'), ('prm.fr.i', 'prm.bk.o'), ('prm.fr.i', 'prm.fr.o'), ('prm.fr.i', 'prm.fr.i.tp'), ('prm.bk.o', 'prm.bk.o.tp'), ('prm.frL.i', 'prm.fr.o'), ('prm.bkL.i', 'prm.bk.o'), ('prm.bk.i.exc', 'prm.bk.i'), ('Xitm.bk.i', 'Xitm.fr.o'), ('Xitm.bk.i', 'Xitm.bk.o'), ('Xitm.bk.i', 'Xitm.bk.i.tp'), ('Xitm.fr.o', 'Xetm.fr.i'), ('Xitm.fr.i', 'Xitm.bk.o'), ('Xitm.fr.i', 'Xitm.fr.o'), ('Xitm.bk.o', 'bs.bkA.i'), ('Xitm.bk.o', 'Xitm.bk.o.Do'), ('Xitm.frL.i', 'Xitm.fr.o'), ('Xitm.bkL.i', 'Xitm.bk.o'), ('Xetm.bk.i', 'Xetm.fr.o'), ('Xetm.bk.i', 'Xetm.bk.o'), ('Xetm.fr.o', 'Xitm.fr.i'), ('Xetm.fr.i', 'Xetm.bk.o'), ('Xetm.fr.i', 'Xetm.fr.o'), ('Xetm.fr.i', 'Xetm.fr.i.tp'), ('Xetm.fr.i', 'Xetm.fr.i.Do'), ('Xetm.frL.i', 'Xetm.fr.o'), ('Xetm.bkL.i', 'Xetm.bk.o'), ('Xetm.fr.o.exc', 'Xetm.fr.o'), ('srm.bk.i', 'srm.fr.o'), ('srm.bk.i', 'srm.bk.o'), ('srm.fr.o', 'bs.bkB.i'), ('srm.fr.i', 'srm.bk.o'), ('srm.fr.i', 'srm.fr.o'), ('srm.fr.i', 'srm.fr.i.Do'), ('srm.bk.o', 'srm.bk.o.tp'), ('srm.frL.i', 'srm.fr.o'), ('srm.bkL.i', 'srm.bk.o'), ('srm.bk.i.exc', 'srm.bk.i'), ('Yitm.bk.i', 'Yitm.fr.o'), ('Yitm.bk.i', 'Yitm.bk.o'), ('Yitm.bk.i', 'Yitm.bk.i.tp'), ('Yitm.fr.o', 'Yetm.fr.i'), ('Yitm.fr.i', 'Yitm.bk.o'), ('Yitm.fr.i', 'Yitm.fr.o'), ('Yitm.bk.o', 'bs.frB.i'), ('Yitm.bk.o', 'Yitm.bk.o.Do'), ('Yitm.frL.i', 'Yitm.fr.o'), ('Yitm.bkL.i', 'Yitm.bk.o'), ('Yetm.bk.i', 'Yetm.fr.o'), ('Yetm.bk.i', 'Yetm.bk.o'), ('Yetm.fr.o', 'Yitm.fr.i'), ('Yetm.fr.i', 'Yetm.bk.o'), ('Yetm.fr.i', 'Yetm.fr.o'), ('Yetm.fr.i', 'Yetm.fr.i.tp'), ('Yetm.fr.i', 'Yetm.fr.i.Do'), ('Yetm.frL.i', 'Yetm.fr.o'), ('Yetm.bkL.i', 'Yetm.bk.o'), ('Yetm.fr.o.exc', 'Yetm.fr.o'), ('bs.frA.i', 'bs.bkA.o'), ('bs.frA.i', 'bs.frB.o'), ('bs.bkA.o', 'Xitm.bk.i'), ('bs.bkA.o', 'bs.bkA.o.Do'), ('bs.bkA.i', 'bs.frA.o'), ('bs.bkA.i', 'bs.bkB.o'), ('bs.frA.o', 'prm.fr.i'), ('bs.frB.i', 'bs.bkB.o'), ('bs.frB.i', 'bs.frA.o'), ('bs.bkB.o', 'srm.fr.i'), ('bs.bkB.i', 'bs.frB.o'), ('bs.bkB.i', 'bs.bkA.o'), ('bs.frB.o', 'Yitm.bk.i'), ('bs.frB.o', 'bs.frB.o.Do'), ('Xetm.fr.o.Di', 'Xetm.fr.o'), ('Yetm.fr.o.Di', 'Yetm.fr.o'), ('srm.fr.o.Di', 'srm.fr.o'), ('bs.bkA.i.Di', 'bs.bkA.i'), ('Xitm.bk.i.Di', 'Xitm.bk.i'), ('bs.frB.i.Di', 'bs.frB.i'), ('Yitm.bk.i.Di', 'Yitm.bk.i')]) captured errors: def T_SFLU_DRFPMI_build_show(): """ Show a graph reduction using networkx+tikz """ ifo = optics.GraphElement() ifo.subgraph_add( 'prm', optics.LossyBasisMirror(), translation_xy=(-25, 0), rotation_deg=180, ) ifo.subgraph_add( 'Xitm', optics.LossyBasisMirror(), translation_xy=(25, 0), rotation_deg=180, ) ifo.subgraph_add( 'Xetm', optics.LossyMirror(), translation_xy=(55, 0), rotation_deg=0 ) ifo.subgraph_add( 'srm', optics.LossyBasisMirror(), translation_xy=(0, -25), rotation_deg=90+180, ) ifo.subgraph_add( 'Yitm', optics.LossyBasisMirror(), translation_xy=(0, 25), rotation_deg=90+180, ) ifo.subgraph_add( 'Yetm', optics.LossyMirror(), translation_xy=(0, 55), rotation_deg=90, ) ifo.subgraph_add( 'bs', optics.BeamSplitter(), translation_xy=(0, 0), rotation_deg=0 ) ifo.edges.update({ ("prm.fr.i", "bs.frA.o"): "prc.tau", ("bs.frA.i", "prm.fr.o"): "prc.tau", ("srm.fr.i", "bs.bkB.o"): "sec.tau", ("bs.bkB.i", "srm.fr.o"): "sec.tau", ("Yitm.bk.i", "bs.frB.o"): 'BSY.tau', ("bs.frB.i", "Yitm.bk.o"): 'BSY.tau', ("Xitm.bk.i", "bs.bkA.o"): 'BSX.tau', ("bs.bkA.i", "Xitm.bk.o"): 'BSX.tau', ("Xetm.fr.i", "Xitm.fr.o"): "XARM.tau", ("Xitm.fr.i", "Xetm.fr.o"): "XARM.tau", ("Yetm.fr.i", "Yitm.fr.o"): "YARM.tau", ("Yitm.fr.i", "Yetm.fr.o"): "YARM.tau", }) ifo['Yetm'].node_angle["fr.o"] = -45 ifo['Yitm'].node_angle["bk.o"] = -45 ifo['srm'].node_angle["bk.o"] = -45 ifo['srm'].edges["bk.i", "bk.i.exc"] = "sec_to" ifo['srm'].edges["bk.o.tp", "bk.o"] = "sec_fr" ifo['srm'].edge_handedness["bk.o.tp", "bk.o"] = "r" ifo['srm'].locations["bk.i.exc"] = (15, -10) ifo['srm'].locations["bk.o.tp"] = (15, 10) ifo['prm'].edges["bk.i", "bk.i.exc"] = "1" ifo['prm'].edges["bk.o.tp", "bk.o"] = "1" ifo['prm'].node_angle["bk.i.exc"] = +45 ifo['prm'].locations["bk.i.exc"] = (15, -10) ifo['prm'].locations["bk.o.tp"] = (15, 10) ifo['prm'].edges["fr.i.tp", "fr.i"] = "1" ifo['prm'].locations["fr.i.tp"] = (-5, 12) ifo['Xetm'].edges["fr.i.tp", "fr.i"] = "1" ifo['Xetm'].edges["fr.o", "fr.o.exc"] = "1" ifo['Xetm'].locations["fr.i.tp"] = (-5, 15) ifo['Xetm'].locations["fr.o.exc"] = (-5, -15) ifo['Yetm'].edges["fr.i.tp", "fr.i"] = "1" ifo['Yetm'].edge_handedness["fr.i.tp", "fr.i"] = "r" ifo['Yetm'].edges["fr.o", "fr.o.exc"] = "1" ifo['Yetm'].locations["fr.i.tp"] = (-5, 15) ifo['Yetm'].locations["fr.o.exc"] = (-5, -15) ifo['Xitm'].edges["bk.i.tp", "bk.i"] = "1" ifo['Xitm'].locations["bk.i.tp"] = (5, -12) ifo['Yitm'].edges["bk.i.tp", "bk.i"] = "1" ifo['Yitm'].locations["bk.i.tp"] = (5, -12) sflu = SFLU.SFLU( edges=ifo.build_edges(), derivatives=[ 'Xetm.fr.r', 'Yetm.fr.r', 'srm.fr.r', 'BSX.tau', 'BSY.tau', ], reduce_list=reduce_list, graph=True, ) # match=False allows a reduced input/output set # sflu.graph_nodes_pos(ifo.build_locations(), match=True) ifo.update_sflu(sflu) G1 = sflu.G.copy() if True: yamlstr = sflu.convert_self2yamlstr() # print(yamlstr) with open(tjoin('DRFPMI.yaml'), 'w') as F: F.write(yamlstr) sflu = SFLU.SFLU.convert_yamlstr2self(yamlstr) #sflu.graph_nodes_pos(DRFPMI_locs, match=True) print('inputs: ', sflu.inputs) print('outputs: ', sflu.outputs) print('nodes: ', sflu.nodes) # dprint('edges: ', sflu.edges) print('nodes') #print(sflu.graph_nodes_repr()) #G1 = sflu.G.copy() sflu.graph_reduce_auto_pos(lX=-10, rX=+10, Y=0, dY=-2) sflu.reduce(*reduce_list) assert(not sflu.nodes) sflu.graph_reduce_auto_pos_io(lX=-30, rX=+30, Y=10, dY=-2) G2 = sflu.G.copy() dprint(G1.edges) > nx2tikz.dump_pdf( [ G1, G2, ], fname = tjoin('testG.pdf'), texname = tjoin('testG.tex'), # preamble = preamble, scale='10pt', ) ../../src/wield/control/SFLU/test/T_SFLU_DRFPMI_build.py:200: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../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_DRF...__6b5f', '/builds/wield-control/docs/maketests/test_results/T_SFLU_DRFPMI_build.py/T_SFLU_DRFPMI_build_show/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 = 5, c2pwrite = 6, errread = 7 errwrite = 8, 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