Re: Does os.path relpath produce an incorrect relative path?

2023-05-27 Thread BlindAnagram

On 26/05/2023 16:42, Eryk Sun wrote:

On 5/26/23, cactus  wrote:


Surprisingly (for me at least) the alternative provided by the pathlib
module 'relative_to' method doesn't provide for full relative path
computation.  I was expecting this would offer everything that os.path
offers but it doesn't in this case.


Starting with Python 3.12, the relative_to() method has a walk_up
parameter. It defaults to False for the sake of backward
compatibility.

https://docs.python.org/3.12/library/pathlib.html#pathlib.PurePath.relative_to


Thanks, it is good to know that this is coming.

  Brian


--
https://mail.python.org/mailman/listinfo/python-list


Re: Module error

2023-05-27 Thread Thomas Passin

On 5/26/2023 8:30 PM, giuseppacef...@gmail.com wrote:

I have reinstalled python which reinstalls pip.  I have added the
path:'C:\sers\Giuseppa\AppData\Local\Packages\PythonSoftwareFoundation.Pytho
n.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts and still
get the error below. Could you help me with this please?

  


Traceback (most recent call last):

   File "C:\Users\Giuseppa\Documents\DataScience\PYTHON\Subsetting.py", line
11, in 

 import pandas as pd

ModuleNotFoundError: No module named 'pandas'
First of all, did you install Python from the Microsoft Store or using 
the Python installer from python.org?  The python.org installer does not 
use paths like that.  In case of problems, I think it would be 
preferable to install using the python.org installer.


Second, after an install of Python, you need to install any packages 
that are not standard Python modules and libraries.  Pandas is not part 
of a standard Python installation, so you would have to re-install it. 
Changing the Windows path has nothing to do with it.  Install pandas with


 -m pip install pandas --user

where  is the actual command that you use to run the version of 
Python you want to work with.


You can find out if your version of Python is running out of that 
LocalCache directory or not by running the following from the command 
line in a console:


 -c "import sys;print('\n'.join(sys.path))"

Again,  represents your actual "python" command.

You will get a display something like mine (I'm not showing the entire 
listing):


C:\Users\tom\AppData\Local\Programs\Python\Python311\python311.zip
C:\Users\tom\AppData\Local\Programs\Python\Python311\DLLs
C:\Users\tom\AppData\Local\Programs\Python\Python311\Lib
C:\Users\tom\AppData\Local\Programs\Python\Python311
C:\Users\tom\AppData\Roaming\Python\Python311\site-packages

You see that in my case, there is no LocalCache directory involved.  I 
installed using the installer from python.org.

--
https://mail.python.org/mailman/listinfo/python-list