Problem to insert a Python session

Hello
I can’t insert a Python session within TeXmacs , I have the following message :
/Library/Developer/CommandLineTools/usr/bin/python3: can’t open file ‘/Users/
alexandre/.TeXmacs/plugins/tmpy/session/tm_python.py’: [Errno 2] No such file
or directory
I first wrote to Texmacs user mailing list , the thread of discussion is : https://lists.texmacs.org/wws/arc/texmacs-users/2022-09/msg00000.html
We will continue the discussion on the forum
Thank you to help me to fix the problem

Hi again :slight_smile:
I opened the Python plugin initialization file, init_python.scm, inside the plugins/python/progs/directory of the TeXmacs installation, and I found there is a definition which depends on whether you have a Python plugin directory in your TeXmacs home directory or not.
The error message you received makes me think that you have a /Users/alexandre/.TeXmacs/plugins/tmpy
directory, which though does not contain all of the files that it should contain, and you might have as well the /plugins/tmpy/ in the TeXmacs installation directory which according to the information that you posted on the mailing list is Applications/TeXmacs.app/Contents/Resources/share/TeXmacs.
Given this, I would try removing the /Users/alexandre/.TeXmacs/plugins/tmpy (maybe making a copy somewhere else if you want to preserve its contents) and see if without this directory the Python plugin works.

1 Like

Hi
Thank you again to help me:)
I removed the file /Users/alexandre/.TeXmacs/plugins/tmpy and I tried again to insert a Python session within TeXmacs but it is always the same message :
/Library/Developer/CommandLineTools/usr/bin/python3: can’t open file ‘/Users/alexandre/.TeXmacs/plugins/tmpy/session/tm_python.py’: [Errno 2] No such file or directory
Busy …

Could you please do from the menu Tools->Update->Plugins a few times (four or five), then exit TeXmacs, open TeXmacs and then try again? It seems to me that sometimes TeXmacs needs a bit of time to detect that plugins have changed

it is done but I have always the same problem.

Let’s then try another way.
Could you please copy paste and execute the following two commands, one per line, in a TeXmacs Scheme session (from the menu Insert->Session->Scheme, first item in Insert->Session):

(getenv "TEXMACS_HOME_PATH")

and

(url-exists? "$TEXMACS_HOME_PATH/plugins/tmpy")

What do you get?

Hi again :slight_smile:
I got : #:1:30: end of file in string constant
for the first command
and : #:1:49: end of file in string constant
for the second one
I don’t know scheme at all so I am unable to understand the responses

You should type double quote manually. There’s something wrong with coding system in webpage. Also these two:

(getenv "TEXMACS_PATH")
(url-exists? "$TEXMACS_PATH/plugins/tmpy")

Execute them one by one.

Thank you , I didn’t notice there was a pb with double quote
Finally I got :
“/Applications/TeXmacs.app/Contents/Resources/share/TeXmacs”
and
#f

For the commands of @sharkc?

Which TeXmacs version and macOS version are you using?

Another option is to use Edit -> Paste from -> Verbatim

Hi
Mac Version : Mac OS Big Sur 11.6.8 and
Texmacs version : TeXmacs-2.1.1.dmg for MacOS 10.10 and later.

If so, could you then check if the folder

exists? If it does not exist, it means that your TeXmacs installation has been corrupted.

Hi
I checked :
/Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/plugins exists
but
/Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/plugins/tmpy doesn’t exist
I checked and I don’t have the folder tmpy at this address

IMHO if plugins/tmpy does not exist it makes sense to reinstall TeXmacs (perhaps downloading it again from http://www.texmacs.org/tmweb/download/macosx.en.html) and then check if the tmpy folder is there.
Before doing that it is still interesting to see the output of the commands

(getenv "TEXMACS_HOME_PATH")

and

(url-exists? "$TEXMACS_HOME_PATH/plugins/tmpy")

(in a Scheme session).

Hi,
I got :
“/Users/alexandre/.TeXmacs” for the first command
#t for the second one

Seems like both your installation of TeXmacs and the directory storing user preferences and modifications (TEXMACS_HOME_PATH) are corrupted. My advice would be to uninstall and reinstall TeXmacs and move the directory “/Users/alexandre/.TeXmacs” to some backup location.

I uninstalled and reinstalled and I have exactly the same messages :

When I want to insert a Python session :
/Library/Developer/CommandLineTools/usr/bin/python3: can’t open file ‘/Users/alexandre/.TeXmacs/plugins/tmpy/session/tm_python.py’: [Errno 2] No such file or directory
Busy…

In a scheme session :
(getenv “TEXMACS_HOME_PATH”)
“/Users/alexandre/.TeXmacs”
(url-exists? “$TEXMACS_HOME_PATH/plugins/tmpy”)
#t

This time , the directory : /Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/plugins/tmpy exists and contains some files and other directory

This is completely as expected. As I mentioned above, two directories have been corrupted and reinstalling only fixes one of them. To fix the other one, you need to move your /Users/alexandre/.TeXmacs folder, or delete the plugins/tmpy/ folder within it.