Bonsoir
J'ai deux petits code python:
toto_titi.py
et trial.pyCode:
1
2 def test(): print("OK")
En ligne de commande,Code:from .toto_titi import test
Citation:
python3
fonctionneCitation:
from toto_titi import test
ne fonctionne pas:Citation:
from .toto_titi import test
La documentation https://docs.python.org/fr/3/reference/import.htmlCode:
1
2
3 Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: attempted relative import with no known parent package
§ 5.4.1 et 5.4.2 indique la présence de __init__
Est-ce que cela vient de là ?