Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.python > #5127
| From | robert <robert@redcor.ch> |
|---|---|
| Newsgroups | de.comp.lang.python |
| Subject | [Python-de] Verständnis-Problem mit python3 import |
| Date | 2018-03-01 10:38 +0100 |
| Message-ID | <mailman.161.1519897543.2835.python-de@python.org> (permalink) |
| References | <8df4c688-813f-74c4-9523-f9ed0a4b00ae@redcor.ch> |
Hoi zäme, Ich bin dabei ein Aplikation von 2.7 nach 3.6 zu migrieren. Nun habe ich ein Problem den Mechanismus von Python 3.6 import zu verstehen. in einem modul config habe ich eine __init__.py datei. Die beginnt so: # -*- encoding: utf-8 -*- import os import sys from . import globaldefaults GD = globaldefaults.GLOBALDEFAULTS from globaldefaults import GLOBALDEFAULTS wenn ich das modul in 2.7 lade funktioniert es wie gewünscht, nicht aber in 3.6 robert@chrissy:~/bridge-builder$ python3.6 Python 3.6.4 (default, Jan 28 2018, 17:52:01) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import config Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/robert/bridge-builder/config/__init__.py", line 6, in <module> from globaldefaults import GLOBALDEFAULTS ModuleNotFoundError: No module named 'globaldefaults' was mich hier verblüfft, ist dass ich from . import globaldefaults GD = globaldefaults.GLOBALDEFAULTS ausführen kann, nicht aber from globaldefaults import GLOBALDEFAULTS was mach ich da falsch?? danke robert
Back to de.comp.lang.python | Previous | Next | Find similar
[Python-de] Verständnis-Problem mit python3 import robert <robert@redcor.ch> - 2018-03-01 10:38 +0100
csiph-web