[Tutor] Problem compiling code from GitHub

Mats Wichmann mats at wichmann.us
Mon Aug 27 13:51:52 EDT 2018


On 08/27/2018 05:14 AM, Dave Hill wrote:

> I get the following error
> 
>    Traceback (most recent call last):
>       File "C:\Code\Python\ODS_Writer\Test_ODS#1.py", line 5, in <module>
>         from OdsWriter import odswriter as ods
>       File "C:\Code\Python\ODS_Writer\OdsWriter.py", line 7, in <module>
>         from . import ods_components
>    ImportError: attempted relative import with no known parent package
> 
> I have put the code from GitHub in various locations subject to my
> limited knowledge of Python, but I have no idea what the following
> extract means, and searching online on & off for two days has proved
> unfruitful.
> 
>    from __future__ import unicode_literals
>    from zipfile import ZipFile
>    import decimal
>    import datetime
>    from xml.dom.minidom import parseString
> 
>    from . import ods_components
>    from .formula import Formula
> 
> I understand the use of 'import' and have written my own modules, but
> from . import ods_components has me floored.
> 
> Thank you in advance for any help.

the doc bit you're missing to at least tell you what this is is here:

https://docs.python.org/3/tutorial/modules.html#intra-package-references

this is tricky ground, however.


More information about the Tutor mailing list