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
-
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 ? -
@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?
-
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
-
@philippe sure there is no mix lower/upper case? Is it possible to post the mdp module or at least the class definition.
-
Is your module https://pypi.org/project/MDP ??
-
@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 ? -
@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 definitionI’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.
-
@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 -
@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?
-
@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 -
@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 importantAnyway, most important is that it works now.
-
@cvp
My module’s name was ‘mdp’
I rename it ‘myModule’I didn’t change any of my classe names
Is that clear enough
-