Hi Graham, thanks for answering, I tried what you told me, I save in a file
called "utilities.py" the function that my pickle object needs,  and then I
import it as seen in the following image:
[image: Selección_100.png]
Later, in the app.py file I import the module that contains the
"word_normalization" function and load the pickle object, even so, the
error continues, it tells me that it cannot find the "utilities" module, I
attach the images of my path project where I save the module.
[image: Selección_099.png]
[image: Selección_098.png]

El dom., 18 de oct. de 2020 a la(s) 18:45, Graham Dumpleton (
[email protected]) escribió:

> Move any code you need for pickled objects out of your main Python code
> file and put it in a separate module, that you import and use, with
> pickling done from the context of the imported module.
>
> This is necessary because under mod_wsgi there is no __main__ module, so
> pickled functions/object types can only come from separate imported modules.
>
> Issues with pickle are covered in the documentation at:
>
> *
> https://modwsgi.readthedocs.io/en/master/user-guides/issues-with-pickle-module.html?highlight=pickle
>
> Graham
>
> On 18 Oct 2020, at 11:49 pm, Edwin Rueda <[email protected]> wrote:
>
> Hello everyone, I am having an error when I load a model saved with
> pickle, the error is as follows:
>
> [Sun oct 18 12:35:54.049848 2020] [wsgi:error] [pid 2775:tid
> 139848716216064] [client 179.67.95.54:53634] AttributeError: Can't get
> attribute 'word_normalization' on <module '__main__' (built-in)>, referer
> http://ec2-54-232-139-27.sa.compute.amazonaws.com/
>
> the problem is that the pickle object that I load depends on a function
> called 'word_normalization', locally I call the function first before
> loading the pickle object and it works, but already on the server I load
> the function first (as shown in the image below) and it generates the
> aforementioned error. I would like to know how to solve this problem, thank
> you.
>
> <Selección_087.png>
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/modwsgi/27c0e972-c6a7-48b8-95e5-26d651e3d817n%40googlegroups.com
> <https://groups.google.com/d/msgid/modwsgi/27c0e972-c6a7-48b8-95e5-26d651e3d817n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> <Selección_087.png>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/modwsgi/9A6B42FA-DDB4-4050-A07D-954996525714%40gmail.com
> <https://groups.google.com/d/msgid/modwsgi/9A6B42FA-DDB4-4050-A07D-954996525714%40gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 
*Edwin J. Rueda*
Maestrando en Ciencias de la Computación
Universidade Federal do Pará, Brasil
Ingeniero de Sistemas
Universidad Industrial de Santander, Colombia

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/CAJ83xwr-AFCrGq41zbh1M2R_9enYuuuzQ_HhwbB-6enh2o-1ig%40mail.gmail.com.

Reply via email to