. error - ImportError: No module named Modul8
  • anomad
    master
    Posts: 412
    Joined: Sun Oct 21, 2007 10:07 pm
    Location: north cakalacky, usa
    Contact:

    . error - ImportError: No module named Modul8

    by anomad » Sat Jun 01, 2013 5:49 am

    . has anyone come across this error before ?

    . i'm working on a module where i use cPickle to write to a file in the user's home directory which works fine.

    . however, when i reload the module and try to load the file, it get 'ImportError: No module named Modul8' and was wondering if anyone has seen this before?


    -james
    (a nomad. )
  • User avatar
    sigmasix
    master
    Posts: 1224
    Joined: Thu Dec 02, 2004 2:12 pm
    Location: gva | switzerland
    Contact:

    Re: . error - ImportError: No module named Modul8

    by sigmasix » Tue Jun 04, 2013 1:53 pm

    I did see this before but can't remember what was the problem and how I I solved it :(

    I think I was also using some sort of Python package or library and that was the problem. I think only Boris can answer this question now and I don't know how often he comes on the forum nowadays :(
  • anomad
    master
    Posts: 412
    Joined: Sun Oct 21, 2007 10:07 pm
    Location: north cakalacky, usa
    Contact:

    Re: . error - ImportError: No module named Modul8

    by anomad » Tue Jun 04, 2013 4:10 pm

    . yeah, i'm guessing it's something about when cPickle is being called to load a list of objects, which is odd b/c i use cPickle.load in another module and it works just fine.

    . still poking around on this, b/c i'd like the user to be able to save presets, rather than use the dictionary serialization.


    . if you happen to remember what your fix was, please let me know :D


    -james
    (a nomad. )
  • User avatar
    sigmasix
    master
    Posts: 1224
    Joined: Thu Dec 02, 2004 2:12 pm
    Location: gva | switzerland
    Contact:

    Re: . error - ImportError: No module named Modul8

    by sigmasix » Wed Jun 05, 2013 4:33 pm

    oh yes, that was my problem, I tried to serialize things into a file the user could choose. Exactly the same as yours.

    In the end, the settings are stored in the md8 file… The module I was working on was not meant to be distributed so I can be careful enough to do it with the "official" way.

    But it would be really grat to be able to save settings in an external file I agree
  • anomad
    master
    Posts: 412
    Joined: Sun Oct 21, 2007 10:07 pm
    Location: north cakalacky, usa
    Contact:

    Re: . error - ImportError: No module named Modul8

    by anomad » Wed Jun 05, 2013 11:10 pm

    . well, in digging deeper into the wonders of cPickle and the like, the best i can figure is that since i'm saving an array of objects called 'Action' -- cPickle is storing the data description as Modul8.Action - which doesn't exist - hence the error. if i define the object in Init() and create an instance of the object and then print it, i get - <Modul8.Action instance at 0x4dd44738> which makes sense.

    . so, i wrote a standalone python script to create a test datafile to try and load in - it sees the data description as __main__.Action, but that gives AttributeError: 'module' object has no attribute 'Action' (Action being my name for the object)

    . grrrrr.

    . so, i will probably write a routine to write out the objects as simple arrays and another routine to read the arrays back into objects. this sort of feels like reaching over my shoulder to scratch my ass though...

    -james
    (a nomad. )
  • anomad
    master
    Posts: 412
    Joined: Sun Oct 21, 2007 10:07 pm
    Location: north cakalacky, usa
    Contact:

    Re: . error - ImportError: No module named Modul8

    by anomad » Wed Jun 19, 2013 7:47 pm

    . for my own notes and in case someone else comes across this issue - here was my solution :

    Code: Select all

          myUserDefs = []
          
          for x in range(len(myAction)) :
             myUserDefs.append(myAction[x].__dict__)
          f = open("/Users/anomad/perfTest15.dat",'wb')
          cPickle.dump(myUserDefs, f)
          f.close()


    . notes :
    . myAction is a list of custom 'Action' objects that contained several fields and a few methods
    . myUserDefs is list that will be filled with a dictionary containing name:value pairs from the 'Action' object
    . cPickle is used to basically write the list of name:value pairs to a file in my home directory

    . then, for the load, i pull the information back in and recreate the list of 'Action' objects in to 'myAction'

    . i went about this method because i'm storing an effect definition dictionary in the object and this was the cleanest way i found to save the multiple data types the 'Action' object was using.

    . my module may publicly see the light of day once again! :)


    -james
    (a nomad. )
  • mamuu45
    junior Member
    Posts: 1
    Joined: Sat Mar 21, 2015 1:42 pm

    Re: . error - ImportError: No module named Modul8

    by mamuu45 » Sat Mar 21, 2015 1:50 pm

    That was my problem, I tried to serialize things into a file the user could choose. Exactly the same as yours. In the end, the settings are stored in the md8 file… The module I was working on was not meant to be distributed so I can be careful enough to do it with the "official" way.???
    You can join us for best cert killer 300-101 dumps oracle training solutions. Our 640-722 security certifications[/url] contains all those you want to pass for real quincy exam & www.jhu.edu training.
  • imnuben
    junior Member
    Posts: 1
    Joined: Mon Mar 30, 2015 10:02 am

    Re: . error - ImportError: No module named Modul8

    by imnuben » Mon Mar 30, 2015 10:15 am

    Je ne peux pas trouver ce module sur la bibliothèque Modul8. Est-il appelé «couche la position setter"?câble data ipad air 2 carte micro sd ipad air 2

Who is online

Users browsing this forum: No registered users and 8 guests