Cannot display pictures

I am new to mogan and texmac. I recently install mogan on my laptop. But I cannot insert a pictures in. I click like the following pictures to insert a figure in D:\download\fig.png.

But it tells me cannot find the picture.

I then directly drag the picture in, but get the following result

By the way, I can run python code through python plugin. But once I use ps_out() to display a figure, it also gives an error.

Error : ramdisc://image.ps could not be converted to png

I have already install ghostscript and it can be detected by mogan. But all the pictures cannot be displayed on my laptop.

Scheme]  (find-binary-python3)

<url C:\Users\Shwan\.conda\envs\mybase\python.exe>
Scheme]  (version-binary-python3)

Python 3.13.0
Scheme]  (set-preference "plugin:binary:python3" "C:\\Users\\Shwan\\.conda\\envs\\mybase\\python.exe")

Scheme]  (find-binary-python3)

<url C:\Users\Shwan\.conda\envs\mybase\python.exe>
Scheme]  (version-binary-python3)

Python 3.13.0
Scheme]  (find-binary-gs)

<url C:\Program Files\gs\gs10.04.0\bin\gswin64c.exe>
Scheme]  

Is there any plugin or setting I forgot? Any help given will be appreciated.

I really want to upload more then one pictures but it is forbidden for me as a new user.


The issue with Mogan being unable to read pictures has been resolved. However, the second issue remains unresolved: the Python function ps_out(fig) is still not working correctly.

Hi @shwan and welcome to the forum.

I tried with Mogan the code that appears in the image you posted and I get an image

On the other hand, I did not understand how the figure you want to insert in your document (the one in D:\download\fig.png) is related to the Python code in the screenshot.

Finally, the developer of Mogan, @darcy, might be able to figure out what happens (he also may need more information :slight_smile: )

Ok, I understoof it, they are two separate issues. By the way, I tried to insert a .jpg picture with Mogan and I got the error that Mogan can’t read the image file (not find); on the other hand I have been able to insert a .png picture—the two pictures have the same permissions.

Let us see if @darcy knows what is happening.

I resolved the first issue. The picture is stored on the D Drive. However, the .tmu document I created was initially on my desktop, which is located on the C Drive. Later, I moved the document to a new folder on the D Drive, and it successfully read the picture! I suspect this is because Mogan reads the picture locally.

But the second issue that python ps_out(fig) get an error is still not solved. In fact this code comes form the example document for python plugins in Mogan.

I think it is worth starting Mogan from the terminal and seeing if you get any error messages there. If you are on Windows, this may help: https://texmacs.github.io/notes/docs/windows-output-error.html (tested only with TeXmacs)

Thanks. I opened Mogan in powershell and open the error document. The stderr.txt and stdout.txt was then created in my \usr dir.

The content of the stdout.txt is:

TeXmacs] debug-io, check_output: ps -p 60812
TeXmacs] std-bench, Task 'tt_font_exists NotoSerifCJK-Regular' took 16 ms
TeXmacs] With linked TrueType support
TeXmacs] convert-error, ramdisc://image.ps could not be converted to png
TeXmacs] debug-shell, Launching 'C:\Users\Shwan\.conda\envs\mybase\python.exe -X utf8 "C:\\Program Files\\XmacsLabs\\MoganResearch-1.2.9.5\\plugins\\python\\bin\\python.pex"'
TeXmacs] convert-error, ramdisc://image.ps could not be converted to png

The content of the stderr.txt is:

Failed to load url in ["C:\Users\Shwan\AppData\Local\Temp\.lolly\134980\29129A2C_2F4B_4660_8906_A4543B749480.ps"]
Failed to load url in ["C:\Users\Shwan\AppData\Local\Temp\.lolly\134980\29129A2C_2F4B_4660_8906_A4543B749480.ps"]

;exact->inexact argument, #f, is boolean but should be a number
;    (and (> (length box) 0) (map...
;    C:\Program Files\XmacsLabs\MoganResearch-1.2.9.5\progs\utils\handwriting\handwriting.scm, line 41, position: 0
; string->float: (and (> (length box) 0) (m...
; get-image-size-from-bbox: ((fbox (and (> ...
; ((box (eps-image-size from)) (box_w (- (t... ; from: <url ramdisc://image.ps>
;                                              opt_w: 1349
;                                              opt_h: 960
; convert-via: ((what* (fun what (append op... ; what: <url ramdisc://image.ps>
;                                              opts1: ((last? . #t) (dest . <url C:\U...
;                                              opts2: ()
;                                              path: ("png-file")
;                                              options: ((dest . <url C:\Users\Shwan\Ap...

Failed to load url in ["C:\Users\Shwan\AppData\Local\Temp\.lolly\134980\5E97A1B8_D221_4F10_84EC_264A2C575280.ps"]
Failed to load url in ["C:\Users\Shwan\AppData\Local\Temp\.lolly\134980\5E97A1B8_D221_4F10_84EC_264A2C575280.ps"]

;exact->inexact argument, #f, is boolean but should be a number
;    (let ((fun (ahash-ref...
;    C:\Program Files\XmacsLabs\MoganResearch-1.2.9.5\progs\kernel\texmacs\tm-convert.scm, line 236, position: 0
; string->float: (let ((fun (ahash-ref conv...
; get-image-size-from-bbox: ((fbox (and (> ... ; box: "0 0 461 346\r"
; ((if res1 res1 (gs-image-size u)))         ; u: <url ramdisc://image.ps>
; ((box (eps-image-size from)) (box_w (- (t... ; opt_w: 1349, opt_h: 960

I am not familiar with TeXmacs and Scheme. If someone can help me, I would greatly appreciate it.

1 Like

Try using TeXmacs, seems a problem with the Scheme interpreter used in Mogan.

2 Likes

Thanks for reporting the bug, I will fix it in as soon as possible, and hopefully in v1.2.9.8.

Just released v1.2.9.7 after 7 release candidates.

I’ve confirmed the bug on Windows. It is a bug on Windows, and it works fine on Linux.

Just wait for the release of Mogan v1.2.9.8.