omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    problème d'importation

    Pythonista
    3
    13
    267
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      philippe last edited by

      je rencontre un problème à l'éxecution d'un fichier principal qui importe un script avec définition de classes.
      Les noms de classes ne sont pas reconnus par le script .
      y a-t-il qq chose de spécial à faire ?

      cvp 1 Reply Last reply Reply Quote 0
      • cvp
        cvp @philippe last edited by cvp

        @philippe il est habituel de décrire son problème en Anglais sinon vous réduisez le nombre de personnes pouvant vous aider uniquement à ceux qui parlent votre langue. (Google Translate is your friend)

        Pourriez-vous poster ici le code Python problématique et le message d'erreur

        Le script contenant les définitions de classes est-il dans le même répertoire que le script principal?

        It is usual to describe your problem in English otherwise you reduce the number of people who can help you only to those who speak your language. (Google Translate is your friend)

        Could you post the problematic Python code and error message here

        Is the script containing the class definitions in the same directory as the main script?

        1 Reply Last reply Reply Quote 0
        • P
          philippe last edited by

          indeed the main script is in the same directory with the module .

          import mdp
          ......
          generateur = mdp.Generator(mdp.Test())
          .......
          

          the error message is :
          'module mdp has no attribute Generator'

          PS: Generator is a Class defined in mdp Module

          cvp 1 Reply Last reply Reply Quote 0
          • cvp
            cvp @philippe last edited by

            @philippe sure there is no mix lower/upper case? Is it possible to post the mdp module or at least the class definition.

            1 Reply Last reply Reply Quote 0
            • ccc
              ccc last edited by ccc

              Is your module https://pypi.org/project/MDP ??

              • https://github.com/mdp-toolkit/mdp-toolkit
              P 1 Reply Last reply Reply Quote 0
              • P
                philippe @ccc last edited by

                @ccc
                I didn’t know this module
                I’ll try to change my module’s name
                Do you really think that it may be confusion between lower and upper case ?

                cvp 1 Reply Last reply Reply Quote 0
                • cvp
                  cvp @philippe last edited by cvp

                  @philippe said

                  Do you really think that it may be confusion between lower and upper case

                  Python is case sensitive, thus generator is not the same as Generator. That's why I asked you to post the mdp module classes definition

                  I’ll try to change my module’s name

                  Not yet sure it is necessary. Did you write yourself the mdp module? If yes, no need to play with the other one.

                  P 1 Reply Last reply Reply Quote 0
                  • P
                    philippe @cvp last edited by

                    @cvp
                    It does work now !
                    I have changed the name ; so it may appear , in that case , that case is insensitive?!
                    Thanks for your advices

                    cvp 1 Reply Last reply Reply Quote 0
                    • cvp
                      cvp @philippe last edited by

                      @philippe said

                      I have changed the name ; so it may appear , in that case , that case is insensitive?!

                      Sorry, I don't understand. Which name did you change?

                      P 1 Reply Last reply Reply Quote 0
                      • P
                        philippe @cvp last edited by

                        @cvp
                        I’ve change the name of my module (mdp)
                        Module that I’ve implemented
                        It’s a module composed with classes and functions; it’s purpose is to generate passwords

                        cvp 1 Reply Last reply Reply Quote 0
                        • cvp
                          cvp @philippe last edited by

                          @philippe Yes, I understand that. My question was "what did you change"

                          Example: your module was MDP and you changed into mdp
                          Your class was Generator and you changed into generator
                          Both examples showing that case is important

                          Anyway, most important is that it works now.

                          P 1 Reply Last reply Reply Quote 0
                          • P
                            philippe @cvp last edited by

                            @cvp
                            My module’s name was ‘mdp’
                            I rename it ‘myModule’

                            I didn’t change any of my classe names

                            Is that clear enough

                            cvp 1 Reply Last reply Reply Quote 0
                            • cvp
                              cvp @philippe last edited by

                              @philippe 👍

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post
                              Powered by NodeBB Forums | Contributors