Up and onward into my development learnings is this course from Udemy. Now I readily admit.. this was a spur of the moment choice due to a 90% sale ending very soon.. I did not research it well enough.
The lecturer is obviously a super smart guy and very skilled in the ways of the Python (we haven't reached Django yet). But being an English as a second language guy, sometimes his ideals aren't explained in familiar ways.
So you might wonder why I chose Django. I was wanting two things: more intermediate Python, and a framework to step into.
From what I can tells the primaries are Django and Flask.. the later's been described to me as a good enough framework but does not contain all the things you;d expect to find. More of a DIY choice. Whereas Django has a ton of stuff built-in like auth, html, etc.
And honestly there's not a ton of choices I could come across that deal with those two packages primarily. I started this this past weekend, I've been able to skip through some of the beginning level Python stuff but we're now approaching the meat of the course. I'll re-post back with my thoughts.
Technology tidbits and things related to small farming including Powershell, AD, Exchange, Security, Chickens, Dogs, General Construction and the like.
Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts
Wednesday, June 24, 2020
Coursera: Python for Beginners
So as my second foray into Python learning, I chose the Python for Beginners specialization.. You might ask why?
Well the reasoning was to hopefully hear about some of the most complex parts: lists, dictionaries, tuples a second time and using different words. I figure hearing about the same topic multiple, identical times is wasteful. But having a topic described in two completely different ways is best to help it sink in.
And it did I believe. Honestly I did not like this one, the TA's and lecturers used were not good speakers...nothing like Dr. Chuck that's for sure.
I mean, don;t get me wrong I did pickup more on the entirety of the beginning levels of the subject but it could have been easier.
Well the reasoning was to hopefully hear about some of the most complex parts: lists, dictionaries, tuples a second time and using different words. I figure hearing about the same topic multiple, identical times is wasteful. But having a topic described in two completely different ways is best to help it sink in.
And it did I believe. Honestly I did not like this one, the TA's and lecturers used were not good speakers...nothing like Dr. Chuck that's for sure.
I mean, don;t get me wrong I did pickup more on the entirety of the beginning levels of the subject but it could have been easier.
Coursera: Python For Everbody
EDIT: The dates are wrong.. I actually completed this back last month. Just forgot to post it.
So I after hew and hawing over Python for the better part of 2 years I finally decided to go after what I can afford. The PY4E Specialization on Coursera is led by Dr. Chuck Severence from the University of Michigan: Ann Arbor. The guys great at explaining things in a way for total noobs to understand.
This specialization is listed as a 6 month duration but I felt like spending more than 2 hours a week so I knocked it out in about a month. Even got a certificate to prove it!
What I liked about the experience was they incorporate assignments to help practice and drive home what was taught. Some were difficult for me I'll admit.. I did resort to IRC help on #python for a few of them.
But it was so much more effective than lecture alone.
Anyway now I'm onto the next specialization, Python for Beginners.
So I after hew and hawing over Python for the better part of 2 years I finally decided to go after what I can afford. The PY4E Specialization on Coursera is led by Dr. Chuck Severence from the University of Michigan: Ann Arbor. The guys great at explaining things in a way for total noobs to understand.
This specialization is listed as a 6 month duration but I felt like spending more than 2 hours a week so I knocked it out in about a month. Even got a certificate to prove it!
What I liked about the experience was they incorporate assignments to help practice and drive home what was taught. Some were difficult for me I'll admit.. I did resort to IRC help on #python for a few of them.
But it was so much more effective than lecture alone.
Anyway now I'm onto the next specialization, Python for Beginners.
Wednesday, July 26, 2017
Python 3 + Paramiko UPDATE
I can hear the voice over from Unreal Tournament. back in the day, "MU MU MU MULTIKILL!"
I figured out the correct syntax for my SSH/paramiko script thus completing my second actual Python script. WOOT. (With vast amounts of help from the guys in an IRC channel I frequent)
So my hangup on all of this boiled down to trying to use a Python2 command in Python3.. Ok well two instances of that: raw_input() was changed to just input(). And my print stdout() should have been print(stdout.read())
Once I got those values changed she ran like a well-oiled machine. Here's what I've been working on:
I will keep this, if anything as a paramiko snippet. It works, it shows me how to SSH into a remote host and run a command. At this early stage, I can't ask for much more.
I figured out the correct syntax for my SSH/paramiko script thus completing my second actual Python script. WOOT. (With vast amounts of help from the guys in an IRC channel I frequent)
So my hangup on all of this boiled down to trying to use a Python2 command in Python3.. Ok well two instances of that: raw_input() was changed to just input(). And my print stdout() should have been print(stdout.read())
Once I got those values changed she ran like a well-oiled machine. Here's what I've been working on:
import sys, paramiko, getpass user = input("Username:") #Prompts for username#passwd = getpass.
getpass("Password for " + user + ":") #Prompts for password
key_file = input("Publickey full path:") #Prompts for full path to
key file
name = input("Target Hostname:") #Prompt for target
hostnamec
command = input("Enter target command:") #Prompt for
remote command
#Calling the paramiko ssh function
ssh = paramiko.SSHClient()
#Define value 'ssh' as calling the paramiko.sshclient
print('calling paramiko')ssh.set_missing_host_key_policy(paramiko.
AutoAddPolicy()) #Must come before connect line to add hosts
to known_hosts#ssh.connect("name", username="user",
password="passwd")
ssh.connect(hostname = name, username = user, key_filename =
key_file) # key_filename means to specify,
pkey on the#other hand means to actually paste in the key text
itself
print('trying to connect')
ssh.invoke_shell()
stdin, stdout, stderr = ssh.exec_command (command)
print(stdout.read())
#ssh.close()
I will keep this, if anything as a paramiko snippet. It works, it shows me how to SSH into a remote host and run a command. At this early stage, I can't ask for much more.
Tuesday, July 25, 2017
Python + Paramiko = SSH unhappiness :(
Been reading the book, watching random YouTube videos on Python.. reading articles and blog posts. Figure one of the best ways to learn something is by doing, so I thought and thought and what's one of the most used parts of a script?
Connecting to a remote machine!
So I went with Paramiko as it seems to be the defacto SSHing inside Python .. thing. Following examples is still tricky. I created a new EC2 instance for this.. churned out a short script or snippet as I like to call it. A paramiko_snippet on using the SSH client but am having issues sending remote commands.
I can connect, and invoke_shell() returns an active channel so I'm good there.
But when sending commands, 'channel.send('command')' returns nothing but a number.. in this case a 2.. next time I ran it gave me a 3.
Maybe it's some Python 2 versus 3 issue. It's not clear yet, but my Google-Fu is strong and I will figure it out.
channel.send('ls')
2
channel.send('ls\n')
3
Connecting to a remote machine!
So I went with Paramiko as it seems to be the defacto SSHing inside Python .. thing. Following examples is still tricky. I created a new EC2 instance for this.. churned out a short script or snippet as I like to call it. A paramiko_snippet on using the SSH client but am having issues sending remote commands.
I can connect, and invoke_shell() returns an active channel so I'm good there.
But when sending commands, 'channel.send('command')' returns nothing but a number.. in this case a 2.. next time I ran it gave me a 3.
Maybe it's some Python 2 versus 3 issue. It's not clear yet, but my Google-Fu is strong and I will figure it out.
channel.send('ls')
2
channel.send('ls\n')
3
Thursday, July 13, 2017
Learning Python!
It's been a while since my last post. Just been horribly busy with work and home stuff, and being in Montana it's damn hard to stay indoors!
Anyway for the past three weeks I've devoted myself to picking up a working knowledge of Python. So far I like it!
The IRC channel I frequent is chock full of current|ex Amazon folks, Expedia, Disney, Mojo and a few other places that I'd consider 'Enterprise' level. More than one handful of devops live in this channel so under a few actual, real DevOps Engineers I chose to start this adventure off with a book;
Introducing Python: Modern Computing in Simple Packages by Bill Lubanovic.
It' easy to read and follow. I typically read some while at lunch and spend nights watching the Udemy videos that follow 'Automate The Boring Stuff with Python'. Once the Udemy videos are done I'm considering paying for a month of Lynda.com and checking out what they have.
In any case, why did I start this? After doing the whole sysadmin thing for almost 15 years I'm feeling stagnant. I mean sure every time you change employers or introduce some new application you are learning new things. And while I don't want to switch paths straight into development, I do really enjoy pulling together some code and forming something new with it.
Also under advisement from the crew I chose PyCharm as an IDE. Absolutely love it! Very intuitive, helpful, and damn easy to learn. Discovered virtenv's the other day and last week I wrote my first actual script and used it at work!
Anyway I've got my eyes set on a new price in town which would come with a new title. We'll see.
Anyway for the past three weeks I've devoted myself to picking up a working knowledge of Python. So far I like it!
The IRC channel I frequent is chock full of current|ex Amazon folks, Expedia, Disney, Mojo and a few other places that I'd consider 'Enterprise' level. More than one handful of devops live in this channel so under a few actual, real DevOps Engineers I chose to start this adventure off with a book;
Introducing Python: Modern Computing in Simple Packages by Bill Lubanovic.
It' easy to read and follow. I typically read some while at lunch and spend nights watching the Udemy videos that follow 'Automate The Boring Stuff with Python'. Once the Udemy videos are done I'm considering paying for a month of Lynda.com and checking out what they have.
In any case, why did I start this? After doing the whole sysadmin thing for almost 15 years I'm feeling stagnant. I mean sure every time you change employers or introduce some new application you are learning new things. And while I don't want to switch paths straight into development, I do really enjoy pulling together some code and forming something new with it.
Also under advisement from the crew I chose PyCharm as an IDE. Absolutely love it! Very intuitive, helpful, and damn easy to learn. Discovered virtenv's the other day and last week I wrote my first actual script and used it at work!
Anyway I've got my eyes set on a new price in town which would come with a new title. We'll see.
Subscribe to:
Posts (Atom)