Could this be related to https://github.com/sagemath/sage/pull/36529?


On Tuesday, December 12, 2023 at 3:50:55 PM UTC-8 Andrew wrote:

> Playing around with this a little more, I think that this is a bug/timing 
> issue in sage.misc.latex.py (or in subprocess.run, or a mac oddity since 
> it only started happening recently). 
>
> What seems to be happening is that the generated PDF file, output_file, is 
> being deleted before the viewer is able to open it. Specifically, if I add 
> time.sleep(2) before the tmp.cleanup  then the viewer opens as expected.
>
>     def run_viewer():
>         run([viewer, output_file], capture_output=True)
>         time.sleep(1)    ## adding this, together with import time, fixes 
> the problem
>         tmp.cleanup()
>
> (This around line 1957 of latex.py.) Certainly this explains my experience 
> of the command working sometimes and failing at other times. On the other 
> hand, it is a little strange because subprocess.run is supposed to wait for 
> the process to finish. A shorter example that exhibits the problem, at 
> least on the two macs that I have available, is
>
>     sage: view(crystals.LSPaths( 
> RootSystem(['A',4]).weight_space().basis()[1] ) )
>
> If people agree that this is a bug then I am happy to post a fix.
>
> Andrew
>
>
> On Monday 11 December 2023 at 4:35:59 pm UTC+11 Andrew wrote:
>
>> I am trying to view crystal graphs from inside sage, and I am going a 
>> little nuts. Sometimes view(...) works as I expect but most of the time it 
>> doesn't, and I see the error message:
>>
>> The document “sage.pdf” could not be opened. The file doesn’t exist.
>>
>> (my emphasis). I compiled sage from source and I am running:
>>
>> SageMath version 10.3.beta1
>> Release Date: 2023-12-10         
>> Using Python 3.11.6.
>>
>> on a 2022 macbook pro (M1 max), running Sonoma 14.1.2. I installed 
>> dot2tex using:
>>     sage -i dot2tex, which 
>> which installed without errors. Running
>>     sage: from sage.graphs.graph_latex import check_tkz_graph
>>     sage: check_tkz_graph() 
>> does not report any problems with my set up.
>>
>> I get the error message above using the the sage commands:
>>
>> sage: L=RootSystem(['A',4]).weight_space().basis()
>> sage: G=crystals.LSPaths(['A',4], L[1])
>> sage: G
>> The crystal of LS paths of type ['A', 4] and weight Lambda[2]
>> sage: view(G)
>>
>> I get the same error if I try the examples from the "Classical crystals" 
>> thematic tutorial, 
>> <https://doc.sagemath.org/html/en/thematic_tutorials/lie/crystals.html#installing-dot2tex>
>>  
>> such as:
>>
>> sage: B = crystals.Tableaux(['A',2], shape=[2,1])
>> sage: view(B, tightpage=True) 
>>
>> When it does work, a nice tikz generated pdf file pops up. Am I missing 
>> some steps? Can anyone tell me what I am doing wrong?
>>
>> Andrew
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/c47fda1e-16dc-4a87-a17b-dc5393aca1afn%40googlegroups.com.

Reply via email to