Re: [Tutor] Problem compiling code from GitHub

2018-09-02 Thread Dave Hill

I now have 'odswriter' working, thank you.

I, eventually, uninstalled all versions of python and cleaned out as 
many references to python and odswriter as I could find. I then 
installed 3.7, and odswriter using


$ cd odswriter
$ python setup.py install

I guess that the first attempt at the latter steps was thwarted by some path 
problem re. Windows?

On 29/08/2018 14:04, Oscar Benjamin wrote:

On Mon, 27 Aug 2018 at 13:18, 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 admit that I am confounded as to where/how to access this code.

There are two ways. The code is there in github because that's where
the author(s) are saving their work on it and where people could
contribute to it.

Normally as a "user" of the odswriter code you wouldn't access it from
there. If you did want to access it from github in order to use the
code you would normally use the git program to download it:

 $ git clone https://github.com/mmulqueen/odswriter

Alternatively you can download the .zip file from github using your
browser and extract it. Either way you then need to *install* the
package to use it:

 $ cd odswriter
 $ python setup.py install

However as I said before someone who simply wants to use the odswriter
code (and not contribute to writing it) would not normally access the
code from github since Python has a better place for this which is
PyPI. You can see the PyPI page for odswriter here:
https://pypi.org/project/odswriter/

Again though you wouldn't normally download the code from PyPI using
the web browser. Python comes with a program called pip which can
download and install it for you. So the command is:

 $ pip install odswriter

I don't know why Steve has difficulty with that but this is the
easiest, fastest, officially-recommended etc. way to install Python
packages.


I am using Python 3.6.4, in IDLE on a PC running windows.

I am using the following code as a starting point , Test_ODS#1.py

 import datetime
 import decimal
 ##import odswriter as ods
 try:
  from OdsWriter import odswriter as ods
 except RuntimeError:
  print("Error importing OdsWriter!")

I have just installed odswriter in Python 3.6, on Linux, using pip and
I get this:

 >>> from OdsWriter import odswriter as ods
 Traceback (most recent call last):
   File "", line 1, in 
 ModuleNotFoundError: No module named 'OdsWriter'

However if I instead write

 >>> from odswriter import ODSWriter

then it works fine. The package name odswriter should be all
lower-case. This may not show an error on Windows because you may be
using a case-insensitive filesystem but you should fix it anyway. The
class-name ODSWriter needs to exactly match each upper and lower-case
letter because Python is much fussier than Windows file systems.

I think that misspelling the capitals in a package name can lead to
import problems although I don't know if that explains the problem
you're having. Most likely that is because you haven't "installed" the
code correctly.

--
Oscar
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] I found the octal and hexadecimal direct conversion method

2018-09-02 Thread Alan Gauld via Tutor
On 02/09/18 14:27, kanzan wrote:
> ☻ I found direct method of octal and hexadecimal conversions ☻ (without
> using binary or decimal)

I'm not sure what you mean but numbertheory has been
around for along time and has long had methods to
convert from one base to another (not just computer
bases but base 3, base 24 and any others too) without
going via any intermediate bases.

> no-one's found this mathematical theory. 

You may be right and have found a new way to do
it but I doubt it.

> about this (e.g. how could i present this theory). 

You should try the various mathematical fora.
It's not a Python programming issue.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor