Giter Site home page Giter Site logo

Comments (5)

jidn avatar jidn commented on July 17, 2024

You are likely correct about it being a path issue, though I don't know why. It may be my unfamiliarity with macs. It did appear to install for python2 and work correctly, but it was not immediately available to you.

Is it the shell, or path, I do not know. Try the following command to see where your python interpreter believes it's site-packages are located.

$ python -m site

I usually work in Python3. However, with virtual environments, we can have the best of all worlds without messing with the system. I am running Arch Linux so there may be some slight variations. I found this when looking for "python virtual environment mac" on Google.

I started by creating a virtual environment in my /tmp directory. It will get removed when I reboot if I don't delete the directory first.

/tmp $ virtualenv --python=python2 testing
Running virtualenv with interpreter /usr/bin/python2
New python executable in /tmp/testing/bin/python2
Also creating executable in /tmp/testing/bin/python
Installing setuptools, pip, wheel...done.

I then activate the virtual environment and install lds-org

/tmp $ source testing/bin/activate
(testing) /tmp $ pip install lds-org
Collecting lds-org
  Downloading LDS_org-0.2.0-py2-none-any.whl
Collecting certifi (from lds-org)
  Using cached certifi-2017.11.5-py2.py3-none-any.whl
Collecting requests (from lds-org)
  Using cached requests-2.18.4-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests->lds-org)
  Using cached chardet-3.0.4-py2.py3-none-any.whl
Collecting idna<2.7,>=2.5 (from requests->lds-org)
  Using cached idna-2.6-py2.py3-none-any.whl
Collecting urllib3<1.23,>=1.21.1 (from requests->lds-org)
  Using cached urllib3-1.22-py2.py3-none-any.whl
Installing collected packages: certifi, chardet, idna, urllib3, requests, lds-org
Successfully installed certifi-2017.11.5 chardet-3.0.4 idna-2.6 lds-org-0.2.0 requests-2.18.4 urllib3-1.22

Let's check where python is getting its information

(testing) /tmp $ python -m site
sys.path = [
    '/tmp',
    '/tmp/testing/lib/python27.zip',
    '/tmp/testing/lib/python2.7',
    '/tmp/testing/lib/python2.7/plat-linux2',
    '/tmp/testing/lib/python2.7/lib-tk',
    '/tmp/testing/lib/python2.7/lib-old',
    '/tmp/testing/lib/python2.7/lib-dynload',
    '/usr/lib64/python2.7',
    '/usr/lib/python2.7',
    '/usr/lib/python2.7/plat-linux2',
    '/usr/lib64/python2.7/lib-tk',
    '/usr/lib/python2.7/lib-tk',
    '/tmp/testing/lib/python2.7/site-packages',
]
USER_BASE: '/home/clinton/.local' (exists)
USER_SITE: '/home/clinton/.local/lib/python2.7/site-packages' (exists)
ENABLE_USER_SITE: False

Everything looks good so now I attempt to get my information

(testing) /tmp $ python -m lds_org -e current-user-id
LDS.org username:XXX	
LDS.org password:
<!-- <Response [200]> -->
<!-- https://www.lds.org/mobiledirectory/services/ludrs/1.1/mem/mobile/current-user-id -->
xxxxxxx735

Try the python -m site and see if lds_org is installed in your site-packages directory. Additionally, python virtual environment makes it easy to create and toss away a python setups. I highly recommend it!

from lds-org.

alundiak avatar alundiak commented on July 17, 2024

python -m site is analogue result as I shown before using $ python print (sys.path):

sys.path = [
    '/Users/alund/prj/lds',
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
    '/Library/Python/2.7/site-packages',
    '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
    '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
]
USER_BASE: '/Users/alund/Library/Python/2.7' (doesn't exist)
USER_SITE: '/Users/alund/Library/Python/2.7/lib/python/site-packages' (doesn't exist)
ENABLE_USER_SITE: True
python3 -m site
sys.path = [
    '/Users/alund/prj/lds',
    '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip',
    '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6',
    '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload',
    '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages',
]
USER_BASE: '/Users/alund/Library/Python/3.6' (doesn't exist)
USER_SITE: '/Users/alund/Library/Python/3.6/lib/python/site-packages' (doesn't exist)
ENABLE_USER_SITE: True

DIFF I see, that site for python3 is installed in diff. lib: /usr/local/lib/python3.6/site-packages and not in

ls  /usr/local/lib/python3.6/site-packages 
Flask-0.12.2.dist-info                  chardet-3.0.4.dist-info                 face_recognition_models-0.3.0.dist-info numpy-1.13.3-py3.6.egg-info             requests-2.18.4.dist-info
Jinja2-2.10.dist-info                   click                                   flask                                   numpy-1.13.3.dist-info                  scipy
LDS_org-0.2.0.dist-info                 click-6.7.dist-info                     httplib2                                oauth2                                  scipy-0.19.1.dist-info
MarkupSafe-1.0.dist-info                cv2                                     httplib2-0.10.3.dist-info               oauth2-1.9.0.post1.dist-info            setuptools
OleFileIO_PL.py                         cv2.cpython-36m-darwin.so               idna                                    olefile                                 setuptools-36.5.0-py3.6.egg-info
PIL                                     dlib                                    idna-2.6.dist-info                      olefile-0.44.dist-info                  sitecustomize.py
Pillow-4.3.0.dist-info                  dlib-19.7.0.dist-info                   itsdangerous-0.24.dist-info             opencv_python-3.3.0.10.dist-info        tests
Werkzeug-0.12.2.dist-info               dotenv                                  itsdangerous.py                         pip                                     urllib3
__pycache__                             easy_install.py                         jinja2                                  pip-9.0.1-py3.6.egg-info                urllib3-1.22.dist-info
certifi                                 face_recognition                        lds_org.py                              pkg_resources                           werkzeug
certifi-2017.11.5.dist-info             face_recognition-1.0.0.dist-info        markupsafe                              python_dotenv-0.7.1.dist-info           wheel
chardet                                 face_recognition_models                 numpy                                   requests                                wheel-0.30.0-py3.6.egg-info
ls /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
Flask-0.12.2.dist-info                  certifi-2017.7.27.1.dist-info           face_recognition-1.0.0.dist-info        numpy-1.13.3.dist-info                  requests
Jinja2-2.9.6.dist-info                  chardet                                 face_recognition_models                 oauth2                                  requests-2.18.4.dist-info
MarkupSafe-1.0-py3.6.egg-info           chardet-3.0.4.dist-info                 face_recognition_models-0.3.0.dist-info oauth2-1.9.0.post1.dist-info            scipy
Mastodon.py-1.1.1.dist-info             click                                   flask                                   olefile                                 scipy-0.19.1.dist-info
OleFileIO_PL.py                         click-6.7.dist-info                     httplib2                                olefile-0.44.dist-info                  setuptools
PIL                                     cmake                                   httplib2-0.10.3-py3.6.egg-info          opencv_python-3.3.0.10.dist-info        setuptools-28.8.0.dist-info
Pillow-4.3.0.dist-info                  cmake-0.8.0.dist-info                   idna                                    peppercorn                              six-1.11.0.dist-info
README.txt                              cv2                                     idna-2.6.dist-info                      peppercorn-0.5-py3.6.egg-info           six.py
SQLAlchemy-1.1.14-py3.6.egg-info        dateutil                                itsdangerous-0.24-py3.6.egg-info        pip                                     sqlalchemy
Werkzeug-0.12.2.dist-info               dlib                                    itsdangerous.py                         pip-9.0.1.dist-info                     tests
__pycache__                             dlib-19.7.0-py3.6.egg-info              jinja2                                  pkg_resources                           urllib3
boost                                   dotenv                                  kanapka-server.egg-link                 python_dateutil-2.6.1.dist-info         urllib3-1.22.dist-info
boost-0.1-py3.6.egg-info                easy-install.pth                        markupsafe                              python_dotenv-0.7.1.dist-info           werkzeug
boost_py-1.0.0.dist-info                easy_install.py                         mastodon                                pytz
certifi                                 face_recognition                        numpy                                   pytz-2017.2.dist-info

Regarding virtualenv, I know about it, but I try to avoid, unless it's really really needed.
I'm well knowledgable about Unix environments, and maintain different folders of diff dist of Python is ok for me, unless I need 10 versions of python :) Then I will use virtualenv. But IMHO, the fact of existence of virtualenv, shows not-ideal state of Python itself. I think Language must provide and support ONLY one stable version. But I also know, that 2 vs. 3 is significant diff. So virtual env is very good in solving issues these days.

from lds-org.

alundiak avatar alundiak commented on July 17, 2024

@jidn Looks like I solved issue.

brew link python3
brew link python3 --overwrite --dry-run python3
brew link python3 --overwrite python3

And after that both these commands give similar output

python3 -m lds_org
#or
python -m lds_org

So with my Setup is ok. But ...

from lds-org.

alundiak avatar alundiak commented on July 17, 2024

Back to my question 1 - is it ok to have that output from LDS? I mean list of

[action-and-interview-list] https://www.lds.org/mls/mbr/services/report/action-interview-list/unit/{unit}/?lang=eng
[action-and-interview-list-full] https://www.lds.org/mls/mbr/services/report/action-interview-list/full/unit/{unit}/?lang=eng
...

??

And question 2:

When I type wrong username or password, it still shows the same result:

python -m lds_org 
LDS.org username:alundiak_bad
LDS.org password: # I entered not valid password here

[action-and-interview-list] https://www.lds.org/mls/mbr/services/report/action-interview-list/unit/{unit}/?lang=eng
[action-and-interview-list-full] https://www.lds.org/mls/mbr/services/report/action-interview-list/full/unit/{unit}/?lang=eng
[android-faq-url          ] http://www.lds.org/callings/melchizedek-priesthood/records-and-technology-support/lds-tools-faq?lang=eng
[android-latest-location  ] https://play.google.com/store/apps/details?id=org.lds.ldstools
[android-release-notes-url] https://www.lds.org/callings/melchizedek-priesthood/records-and-technology-support/lds-tools-release-notifications?lang=eng#android
[auth-url                 ] https://signin.lds.org/login.html
...

from lds-org.

jidn avatar jidn commented on July 17, 2024

Yes, it is OK to get that output. Unless you specify an endpoint, the default is to show a list of all standard endpoints.

The command line arguments for the module are:

(testing) /tmp $ python /tmp/testing/lib/python2.7/site-packages/lds_org.py --help
usage: lds_org.py [-h] [-e ENDPOINT] [-m MEMBER] [-u UNIT] [-j] [--log LOG]
                  [args [args ...]]

positional arguments:
  args         Arguments for endpoint URLs

optional arguments:
  -h, --help   show this help message and exit
  -e ENDPOINT  Endpoint to pretty print
  -m MEMBER    Member number
  -u UNIT      Unit number other than authorized users
  -j           output as JSON
  --log LOG    Filename for log, - for stdout

However, it shouldn't ask for a password and username. Looks like I need to put in a signin=False in the initialization. If there are endpoints, it will then attempt a sign in. I will fix this. Thank you for pointing this out.

from lds-org.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.