Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'Namespace' object has no attribute 'func' for python 3.6 or greater #39

Closed
rbavery opened this issue Nov 18, 2019 · 5 comments

Comments

@rbavery
Copy link
Contributor

rbavery commented Nov 18, 2019

Fresh installs of porder with python versions 3.6.7 or greater now bark when running porder

# rave at rave-thinkpad in ~/planet_tutorial [12:32:58]
→ porder                          
Traceback (most recent call last):
  File "/home/rave/miniconda3/envs/py3/bin/porder", line 8, in <module>
    sys.exit(main())
  File "/home/rave/miniconda3/envs/py3/lib/python3.6/site-packages/porder/porder.py", line 450, in main
    args.func(args)
AttributeError: 'Namespace' object has no attribute 'func'
(py3) 

I tested this on a python 2.7 environment and the error does not occur. To reproduce the error:

conda create -n py3 python=3.6 
conda activate py3
pip install porder datetimerange
porder

I'm not sure why this fails, being unfamiliar with argparse, but maybe this SO post helps? https://stackoverflow.com/questions/16878315/what-is-the-right-way-to-treat-python-argparse-namespace-as-a-dictionary

@samapriya
Copy link
Owner

Hi Ryan
Can you try

porder -h

and let me know if that works?

@rbavery
Copy link
Contributor Author

rbavery commented Nov 18, 2019

Hey Sam! In my python 3 env that works and so does porder version and porder quota

But while porder idlist works with python 2.7, it interprets args incorrectly with python 3

# rave at rave-thinkpad in ~/planet_tutorial on git:master ✖︎ [15:20:18]
→ porder quota idlist --input "/home/rave/planet_tutorial/san_pedro_section.geojson" --start "2019-06-01" --end "2019-06-08" --item "PSScene4Band" --asset "analytic_sr" --outfile "/home/rave/planet_tutorial/data/idlist.csv" --cmax ".05" --number "1" --overlap "100"
usage: porder [-h]
              {version,quota,shp2geojson,base64,simplify,idlist,difflist,idsplit,idcheck,bundles,order,ordersize,ostate,stats,download,multipart,multiproc}
              ...
porder: error: unrecognized arguments: idlist --input /home/rave/planet_tutorial/san_pedro_section.geojson --start 2019-06-01 --end 2019-06-08 --item PSScene4Band --asset analytic_sr --outfile /home/rave/planet_tutorial/data/idlist.csv --cmax .05 --number 1 --overlap 100

@samapriya
Copy link
Owner

samapriya commented Nov 19, 2019

Hi Ryan
You tried to use two tools in the same line

porder quota idlist
porder quota is one tool and porder idlist is another

notice above

@rbavery
Copy link
Contributor Author

rbavery commented Nov 19, 2019

oh YIKES, my b! It looks like idlist works on python 3 so that's good! I'm going to assume the only thing that doesn't behave is just running porder which isn't a big deal.

samapriya added a commit that referenced this issue Nov 19, 2019
- Fixed arg readout if no argument is passed to CLI. [Issue 39](#39).
- Updated requirements to include DateTimeRange
- Fixed issue with GDAL~=3 requirement for fiona 1.8.11 release
samapriya added a commit that referenced this issue Nov 19, 2019
- Fixed arg readout if no argument is passed to CLI. [Issue 39](#39).
- Updated requirements to include DateTimeRange
- Fixed issue with GDAL~=3 requirement for fiona 1.8.11 release
@samapriya
Copy link
Owner

Hi Ryan
This has been fixed and the release 0.5.7 should work for porder without arguments. Closing this, for now, let me know if this reoccurs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants