It works, or let's say it seems to work.

Attached is the tm_python file modified to work with python 3 under ubuntu
13.10 (not tested with python 2.7).

Finally, I commented the problematic line and add iinstead :

sys.stdout.flush()


But I still can't get any .eps within texmacs with matplotlib. Am i the
only one to have this problem ?

Regards.

Marc

2014-11-11 19:02 GMT+01:00 marc lalaude-labayle <marc.lala...@gmail.com>:

> Yes.
>
> But i encounter new problems with bytes and str : the version 3 of python
> does change a lot of things.
>
> I struggle with these lines :
>
> sys.stdout = os.fdopen (sys.stdout.fileno(), 'wb', 0)
>
> texmacs_out ("verbatim:Python " + sys.version +
>              "\nPython plugin for TeXmacs.\n" +
>              "Please see the documentation in Help -> Plugins -> Python")
>
> The sys.version is the problem now, if 'wb' is ok ...
>
>
> In fact, i doubt : does this python plugin works with a python 3 version ?
> I thought i could make it work, but i don't know now :(
>
> Marc
>
> 2014-11-11 18:25 GMT+01:00 Alexandre Dezotti <dezotti.alexan...@gmail.com>
> :
>
>> Hi,
>>
>> Have you tried replacing 'w' to 'wb' ?
>>
>> https://mail.python.org/pipermail/python-dev/2008-December/084437.html
>>
>> 2014-11-11 18:14 GMT+01:00 marc lalaude-labayle <marc.lala...@gmail.com>:
>>
>>> I digged a little more in the error messages i get.
>>>
>>> In the tm_python file i get after a svn compilation, i changed the first
>>> line to /usr/bin/env python3
>>>
>>> Then :
>>>
>>>    1. on line 54, the print is now a function, so i changed to
>>>    print(DATA_BEGIN ...)
>>>    2. map doesn't return a list anymore and lambda for two variables
>>>    doesn't work the same. So i changed the line 317 to return
>>>    dict(list(map(lambda k,v: ...)
>>>    3. I then changed an import module. The cStringIO doesn't work any
>>>    longer. So from io import StringIO
>>>
>>>
>>> And now, the error message while launching python within texmacs i get
>>> is this one:
>>>
>>> Traceback (most recent call last):
>>>   File "/usr/local/libexec/TeXmacs/bin/tm_python", line 340, in <module>
>>>     sys.stdout = os.fdopen (sys.stdout.fileno(), 'w', 0)
>>>   File "/usr/lib/python3.3/os.py", line 1043, in fdopen
>>>     return io.open(fd, *args, **kwargs)
>>> ValueError: can't have unbuffered text I/O
>>> ↯ Mort
>>>
>>> Python]
>>>
>>>
>>> And i really don't know what to do now !
>>>
>>>
>>> Thx for any help.
>>>
>>>
>>> Marc
>>>
>>> 2014-11-11 17:36 GMT+01:00 marc lalaude-labayle <marc.lala...@gmail.com>
>>> :
>>>
>>>> Hi,
>>>>
>>>> after some tries, i still can't get the python plugin with a python3
>>>> version under ubuntu. I modified th tm_python file with different first
>>>> lines : neither /usr/bin/env python3 nor /usr/bin/python3 worked.
>>>>
>>>> I just recompiled a svn version to test and still the same : syntax
>>>> error on line 54 of the tm_python file.
>>>>
>>>> This line is print DATA_BEGIN + out_str + DATA_END
>>>>
>>>> The funny thing is it used to work (or i think so) before i changed to
>>>> a svn version of texmacs a few months ago.
>>>>
>>>> Does anyone encounters the same problem ? If so, which fix did you find
>>>> ?
>>>>
>>>> Thx.
>>>>
>>>> Marc
>>>>
>>>>
>>>> 2014-07-03 9:27 GMT+02:00 Miguel de Benito Delgado <
>>>> m.debenit...@gmail.com>:
>>>>
>>>>> Hi,
>>>>>
>>>>>  you have to change that line of the copy of tm_python that texmacs is
>>>>> reading upon startup. Its location will depend on your configuration. Most
>>>>> probably /usr/local/something or maybe  ~/.TeXmacs/plugins/python. Unless
>>>>> you use your copy of the sources as your TEXMACS_PATH, the tm_python file
>>>>> won't be the one in wherever/texmacs-sources/src/plugins.
>>>>>
>>>>> Best,
>>>>>
>>>>> --
>>>>> Miguel de  Benito.
>>>>>
>>>>>
>>>>> On Mon, Jun 30, 2014 at 2:29 PM, marc lalaude-labayle <
>>>>> marc.lala...@gmail.com> wrote:
>>>>>
>>>>>> Hi Miguel,
>>>>>>
>>>>>> i have a tm_python file in the /src folder.
>>>>>>
>>>>>> So, i change the first line to /usr/python3 for example and then
>>>>>> compile ? Or did i misunderstand something ?
>>>>>>
>>>>>> Best regards,
>>>>>>
>>>>>> Marc
>>>>>>
>>>>>>
>>>>>> 2014-06-30 12:36 GMT+02:00 Miguel de Benito Delgado <
>>>>>> m.debenit...@gmail.com>:
>>>>>>
>>>>>> Salut Julien,
>>>>>>>
>>>>>>>   you can try changing the first line of plugins/python/tm_python,
>>>>>>> which reads
>>>>>>>
>>>>>>> #!/usr/bin/env python
>>>>>>>
>>>>>>> to the python interpreter you want to use.
>>>>>>>
>>>>>>> Best,
>>>>>>>
>>>>>>> --
>>>>>>> Miguel de  Benito.
>>>>>>>
>>>>>>>
>>>>>>> On Sun, Jun 29, 2014 at 1:07 PM, Julien Frontisi <
>>>>>>> julien.front...@free.fr> wrote:
>>>>>>>
>>>>>>>> Hi again,
>>>>>>>> the previous attempts were made on my desktop with mac os 10.9.
>>>>>>>> on my laptop with mac os 10.7, the python plugin shows python
>>>>>>>> version number 2.7.1
>>>>>>>> which is the python installed by Apple in /System. I don't think I
>>>>>>>> can change this python nor add any new module to it.
>>>>>>>> How can I force the python plugin in texmacs to use the /Library
>>>>>>>> one, as the terminal does ?
>>>>>>>> And how can I make it use the new modules ?
>>>>>>>> Thanks
>>>>>>>> Julien
>>>>>>>>
>>>>>>>>
>>>>>>>>  Le 29 juin 2014 à 10:43, Julien Frontisi <julien.front...@free.fr>
>>>>>>>> a écrit :
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>> I'm using the python plugin in mac os texmacs app but cannot import
>>>>>>>> sympy module.
>>>>>>>> Some other modules like numpy, for example, work fine but importing
>>>>>>>> sympy just gives :
>>>>>>>>
>>>>>>>> > Traceback (most recent call last):
>>>>>>>> > ImportError: No module named sympy
>>>>>>>>
>>>>>>>> On the other hand, using python on the terminal (without texmacs)
>>>>>>>> works fine.
>>>>>>>>
>>>>>>>> Maybe texmacs plugin uses a different python installation from the
>>>>>>>> one the terminal is using.
>>>>>>>> The latter is
>>>>>>>> /Library/Frameworks/Python.framework/Versions/2.7/bin/python
>>>>>>>> and there is another one in /System/Library/Frameworks/
>>>>>>>> but I don't know how to check which one texmacs is using.
>>>>>>>>
>>>>>>>> Has anyone got sympy module working in python plugin ?
>>>>>>>> Thanks
>>>>>>>> Julien
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Attachment: tm_python
Description: Binary data

_______________________________________________
Texmacs-dev mailing list
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev

Reply via email to