[Tutor] Problem compiling code from GitHub

Dave Hill dave at the-hills.org.uk
Tue Aug 28 12:30:55 EDT 2018


I did as suggested but with the same result.

I am now looking at extracting the code from the the separate files to 
form a single module, and hopefully get a result.

On 27/08/2018 14:14, Steven D'Aprano wrote:
> Hi Dave, and welcome!
>
>
> On Mon, Aug 27, 2018 at 12:14:33PM +0100, Dave Hill wrote:
>
>> I have found 'odswriter' on GitHub
>> https://github.com/mmulqueen/odswriter which appears to provide what I
>> want. However, I have come to a halt, due to the limitation of my knowledge.
> [...]
>
>
>> 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
> That sounds like the problem. Some libraries are pretty forgiving about
> where they are, some not so much. Some come with detailed installation
> instructions, some don't.
>
> This appears to be in the second category of both cases.
>
> I would start by carefully deleting the code from Github (or at least
> moving it out of the way) first, then installing it again.
>
> Try installing it using the pip command. Open up a command line console.
> I think you do this under Windows by typing Ctrl-R ("Run") then entering
> "cmd", You ought to get a text window with a prompt looking something
> like this:
>
>      C:\ %
>
> or similar. (If in doubt, ask.)
>
> Try entering the command
>
>      pip --version
>
> and if you get an error like "pip not found" or similar, try this:
>
>     python36 -m ensurepip --default-pip
>     python36 -m pip install --upgrade pip setuptools wheel
>
> after which you can then try:
>
>     pip install odswriter
>
> I'll be honest: I don't use pip myself, every time I've tried I get
> frustrated and end up installing things the old-fashioned manual way
> which is theoretically "harder" but it works for me. And everyone else
> swears by pip. (I just swear at it, especially the horrible colours it
> likes to use.)
>
> But if you get any errors, please don't hesitate to copy and paste them
> here (DON'T take a screen shot) so we can read them and advise you.
>
>
> There's a tutorial here with more detail:
>
> https://packaging.python.org/tutorials/installing-packages/
>
>
>
>


More information about the Tutor mailing list