[x3d-public] x3d.py package: Some feedback and suggestion for improvement; tuples and lists; updated x3d.py

Hans Moritz Guenther hgunther at mit.edu
Fri Mar 4 11:17:12 PST 2022


On 3/1/22 10:31 PM, Brutzman, Donald (Don) (CIV) wrote:
>
>  5. Bad news, still no joy.  Following “pip install x3d” and hiding
>     PYTHONPATH, the PyPi version installed via pip still fails, now
>     saying:
>
> IT160907-UWALPP+brutzman at IT160907-UWALPP 
> /cygdrive/c/x3d-code/www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter02GeometryPrimitives
>
> $ python BoxExample.py
>
> Traceback (most recent call last):
>
> File 
> "C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors\Chapter02GeometryPrimitives\BoxExample.py", 
> line 23, in <module>
>
> import x3d
>
> ModuleNotFoundError: No module named 'x3d'
>

That means that it's simply not finding the location where it's been 
installed to. Depending on how your Python is installed (provided by 
your operating system, conda, complied by hand yourself) it may be set 
up to look at different locations by default.

 > pip show x3d

(after running pip) should show you where the files went. How does 
Python know where to look? Again, that depends on how it was installed. 
Usually, that's the same place where pip installed stuff, but apparently 
that's not the case here. Maybe the pip is not the same one as the 
Python. That can happen when there are several Python version installed 
on the same system, e.g. one is installed using conda and one is 
provided by the operating system.

Typically, they are in the same location:


(base) MoritzAirRoseGold ~> which pip
/Users/guenther/mambaforge/bin/pip
(base) MoritzAirRoseGold ~> which python
/Users/guenther/mambaforge/bin/python

In that case, pip will install to a directory that python looks into 
when using "import".

If instead, the package is installed at a different location, then 
PYTHONPATH should be set to the base directory of the packages, i.e. if 
you have packages:

/my/dir/x3d

/my/dir/otherpackage1

/my/dir/otherpacakge2

then PYTHONPATH=/my/dir

not "/my/dir/x3d" (because that way python would look for 
/my/dir/x3d/x3d/__init__.py, so one level of x3d too many).

Moritz

-- 
Hans Moritz Günther
Massachusetts Institute of Technology
Kavli Institute for Astrophysics and Space Research
77 Massachusetts Avenue
NE83-569
Cambridge, MA 02139
hgunther at mit.edu
https://space.mit.edu/home/guenther/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220304/e2b18a10/attachment.html>


More information about the x3d-public mailing list