python / cpython

The Python programming language
https://www.python.org
Other
63.46k stars 30.39k forks source link

Python/pystate.c:561 :PyGILState: The assertion 'autoInterpreterState' has failed #48693

Closed 1d0cf1aa-0356-403c-aec2-b356dd36a537 closed 15 years ago

1d0cf1aa-0356-403c-aec2-b356dd36a537 commented 15 years ago
BPO 4443
Nosy @brettcannon, @amauryfa
Files
  • unnamed
  • unnamed
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = None closed_at = created_at = labels = ['interpreter-core', 'invalid', 'performance'] title = "Python/pystate.c:561 :PyGILState: The assertion 'autoInterpreterState' has failed" updated_at = user = 'https://bugs.python.org/lcarrionr' ``` bugs.python.org fields: ```python activity = actor = 'amaury.forgeotdarc' assignee = 'none' closed = True closed_date = closer = 'amaury.forgeotdarc' components = ['Interpreter Core'] creation = creator = 'lcarrionr' dependencies = [] files = ['12139', '12143'] hgrepos = [] issue_num = 4443 keywords = [] message_count = 7.0 messages = ['76484', '76487', '76488', '76491', '76493', '76494', '76501'] nosy_count = 3.0 nosy_names = ['brett.cannon', 'amaury.forgeotdarc', 'lcarrionr'] pr_nums = [] priority = 'normal' resolution = 'not a bug' stage = None status = 'closed' superseder = None type = 'resource usage' url = 'https://bugs.python.org/issue4443' versions = ['Python 2.5'] ```

    1d0cf1aa-0356-403c-aec2-b356dd36a537 commented 15 years ago

    The project goal is to incorporate the functionality of interaction of the excel application (gnumeric) with the XO's journal. All the activities needs to register any change in that datastore (save and open files are made throw it).

    In order to apply this option, we need to call some python code from the implementation of the worksheet in C code. This is called embedded python in C. The steps followed to accomplish this goal came from the OLPC site recomendations, in wiki.laptop.org. The python script for the interaction with the journal's datastore can be found in here: http://wiki.laptop.org/go/Copy_to_and_from_the_Journal

    The changes in the gnumeric code are basically in the workbook-view.c and main-application.c to handle the open and save options. In the main- application.c the method gui_file_copy_from_journal uses the python api/c to make the call to the journal script. after this method and during the open of the file, an exception rises. Although we are not sure, we believe it has to do with the closure of the python enviroment after the finalize call. We need to erase this exception or may be just handle it.

    The error running in the XO is:

    gnumeric: Python/pystate.c:561 :PyGILState: The assertion 'autoInterpreterState' has failed

    The configuration of the XO where we are getting the exception is:

    Python 2.5 (r25:51908, Oct 19 2007, 09:47:40) [gcc 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2

    Any help is greatly appreciated!!!

    brettcannon commented 15 years ago

    Is this an actual bug report or more of a request for help? If it is the former then a test case is needed in order to help figure out what is going on. If it is the latter you should ask on comp.lang.python/python-list.

    benjaminp commented 15 years ago

    Also, please do not add everyone in the project to the nosy list.

    amauryfa commented 15 years ago

    The assertion is clear if you open the source code (Python/pystate.c, line 561):

    assert(autoInterpreterState); / Py_Initialize() hasn't been called! \/

    Does your code make sure that the python interpreter is initialized?

    1d0cf1aa-0356-403c-aec2-b356dd36a537 commented 15 years ago

    Hi Amaury, thanks for you response...

    This is my code sniped

    gboolean gui_file_copy_to_journal(char const *uri) { g_printerr("SAVING PYTHON JOURNAL!...........%s\n", uri);

            char * arg1[7];
        arg1[0] = "python";
        arg1[1] = "/home/olpc/copy-to-Journal.py"; 
        arg1[2] = uri+7;
        arg1[3] = "-d";
        arg1[4] = "hoja_de_calculo"; 
        arg1[5] = "-m";
        arg1[6] = "application/x-gnumeric"; 
            g_printerr ("Writing py \n");
            Py_Initialize(); 
            Py_Main(7, arg1);
            Py_Finalize();
            g_printerr ("Writing Py_Finalize \n");
    
            return TRUE;
    }

    also, I tried with other method like linux journal show in http://www.linuxjournal.com/article/3641

    Any help is greatly appreciated...

    Luis Carrión Tata Consultancy Services Colonia 1329-Piso 3 Montevideo,. Uruguay Mailto: luis.carrion@tcs.com Website: http://www.tcs.com


    Experience certainty. IT Services Business Solutions Outsourcing


    Amaury Forgeot d'Arc \report@bugs.python.org\ 27/11/2008 07:22 a.m. Please respond to Python tracker \report@bugs.python.org\

    To luis.carrion@tcs.com cc

    Subject [bpo-4443] Python/pystate.c:561 :PyGILState: The assertion 'autoInterpreterState' has failed

    Amaury Forgeot d'Arc \amauryfa@gmail.com\ added the comment:

    The assertion is clear if you open the source code (Python/pystate.c, line 561):

    assert(autoInterpreterState); / Py_Initialize() hasn't been called! \/

    Does your code make sure that the python interpreter is initialized?

    ---------- nosy: +amaury.forgeotdarc


    Python tracker \report@bugs.python.org\ \http://bugs.python.org/issue4443\


    ForwardSourceID:NT0000A7E6 \=====-----=====-----\===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you

    amauryfa commented 15 years ago

    Py_Initialize(); Py_Main(7, arg1); Py_Finalize();

    This seems correct... unless two threads run this function at the same time. Can you ensure that this is not the case?

    It seems to me that a simple call to system("python /home/olpc/copy-to-Journal.py [other-args-here]") would be better...

    1d0cf1aa-0356-403c-aec2-b356dd36a537 commented 15 years ago

    Thank you so much. It do worked!

    I don't think two threads to be running the same function because the messages are displayed only once. Yes it seems to be a better way it worked, thank you again.

    Regards,

    Luis Carrión Tata Consultancy Services Colonia 1329-Piso 3 Montevideo,. Uruguay Mailto: luis.carrion@tcs.com Website: http://www.tcs.com


    Experience certainty. IT Services Business Solutions Outsourcing


    Amaury Forgeot d'Arc \report@bugs.python.org\ 27/11/2008 10:11 a.m. Please respond to Python tracker \report@bugs.python.org\

    To luis.carrion@tcs.com cc

    Subject [bpo-4443] Python/pystate.c:561 :PyGILState: The assertion 'autoInterpreterState' has failed

    Amaury Forgeot d'Arc \amauryfa@gmail.com\ added the comment:

    Py_Initialize(); Py_Main(7, arg1); Py_Finalize();

    This seems correct... unless two threads run this function at the same time. Can you ensure that this is not the case?

    It seems to me that a simple call to system("python /home/olpc/copy-to-Journal.py [other-args-here]") would be better...


    Python tracker \report@bugs.python.org\ \http://bugs.python.org/issue4443\


    ForwardSourceID:NT0000A982 \=====-----=====-----\===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you