I know this is a very simple question, but I know some python to understand some of the basics and I was wondering what would be the best possible solution, or direction, for studying python. I still struggle with small scripts from time to time, with very small number of them actually working the way I intended. So I just wanted to see if anyone has any suggestions on how to go about this.
The other thing is I came across other sites and other sources of python examples that I would eventually like to be at or close to the level of a novice python developer. Eventually I would like to expand on that even further, but as of now I can handle small scripts here and there and so I am starting out low and slow.
Here are somethings that I came across that I would like to know more about and be able to understand and utilize.
Any of the Esri breakdowns for tools and such
This question has come up several times on GeoNet. A quick search gives some good threads:
The way I learned (and let's be clear, no one will be coming to me with py questions...ever....), is I set some specific goal I wanted to do with Python, and for me, that was/is data management automation. I have a LOT of data, and touching it every day was killing my schedule. So I googled stuff like "how to publish to AGOL with python" and "how to manage portal groups with python". I quickly learned that no matter how crazy the thing was that I wanted to do, someone else has already done it, and I just lifted their code from Github. Then I had to make it work in my environment, so what I did was execute each line, line by line, in a py exe window, which not only kinda sorta taught me what the line did, but what I needed to change to make it work. Over years, I have learned enough that I'm able to cherry pick code blocks from various scripts and piece them together to do entirely new things. I recently had to learn, very quickly, how to publish (and delete) 1000 services to Portal.....
Here's something new I'm going to try with my staff, that might work for you:
Instead of using ArcToolbox in Pro, for the 100 or so GP operations we do in a day, we're going to start running the same tool(s) out of the python window with the syntax reference open in another monitor.
Robert, I agree with Thomas completely. The best way to learn is by apply/doing. You can read all the books and tutorials you can find, or take as many classes as you have money for, but until you start applying it to solve questions/issue/etc..., it won't really click for you.
I 100% agree with this. I learned by solving problems that limited my workflows. I also took it further by buying single board computers like beaglebone or Raspberry PI and programmed some home automation in python for the computer to control. If you start writing code to solve real world problems you will learn quick, just stick with it because the learning curve can be daunting.
I came to that conclusion about a week ago when I was tasked with a simple assignment that, to my knowledge, they had been doing by hand for several years. I had done this task by hand just to learn the workflow and after a couple of times, I realized that this process could easily be rendered seamless if I could simply create something (either python script, modebuilder, or both) that would convert an elongated methodology and simplify it. The other thing is that I have been trying to get the scripts that I have created so far to work in process in modelbuilder. The reason being is that if either I or someone else wanted to use it, it wouldn't be confined to whatever parameters I set up in the script. For some projects that are like this, I have used models most of the time to simplify these tasks. But I realized that some of the tools I need to reach the end result that I wanted, didn't exist, or hadn't been created. So I came to the conclusion that learning python would help fill in the gaps where some of the tools weren't provided or created. But I also realized that some of the python processes I was lacking, and so I don't have quite a solid foundation on most of those. I understand basics like classes, modules, simple scripts, some loops(could probably use more practice with those) and many other things<---like 98.99% of those things
My friend and I had practiced python before, and I even took a class on it. Unfortunately we were using the Esri python book, which made little to no sense, and lacked anything in terms of understanding the principles and such. I would like to eventually get to the point where I can I can comfortably create scripts that would get to the result(s) that I picture.
So I will keep trying and practicing, and do my best to not get lost since I had little to no understanding on how much a person could really accomplish just using python alone.
Thanks for your help Jeremy, and everyone who continues to give wisdom and guidance
Sounds like you are very motivated! One of the things that I do for all of my non-server side scripts that are meant to be run from ArcGIS Destop is I put them all in toolbox and put the tool box in my script folder. I then set them up to be configured with the GUI that comes standard with ArcMap or Pro. This allows people to easily change the the variables as parameters so they act like a normal geoprocessing tool.
Back to your original question about studying and learning. One of the biggest things you can do is get set up with a good Integrated Development Environment (IDE) to write python in. My favorite is pycharm and I highly recommend it. Also learn how to swap the python environment interpreter between 2.7 and 3.x so you can write code for both ArcMap, Pro and ArcGIS API for Python in pycharm.
I also recommend the basic python classes on teamtreehouse.com . A few of my engineer friends highly recommend this website and it does look good. I personally use udemy.com as well as teamtreehouse to learn new things.
One thing you should know... python is taking over the world. You have chosen a good time to start learning.
The other thing is that I would like to get to the point where I can script well enough in python to be able to fully utilize the python addin tool. I discovered this a year or to ago and I was really intrigued with how easy it was to create an addin tool simply using python. The other thing people have mentioned to me as well is the arcobjects for visual studio(which I would also like to learn eventually) simply because the idea of a greater level of flexibility would make simple or complex tasks seem seamless. So there is a lot that I would like to utilize, in addition to python, to further enhance my skill set. I am currently working on a complex 3D model using Microstation, CityEngine, and ArcPro. I would like to eventually create tools to go along with that model. I am still in the design phase but once everything is set up, I hope to eventually enhance the model further.
Ok. I haven't tried adding a python addin tool to pro just yet since I would like to be able to create the kind of tools needed for both the model that I am working on as well as other things.