Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #84523 > unrolled thread

Hello World in Python

Started by"Christopher J. Pisz" <cpisz@austin.rr.com>
First post2015-01-24 17:53 -0600
Last post2015-01-24 22:53 -0600
Articles 6 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  Hello World in Python "Christopher J. Pisz" <cpisz@austin.rr.com> - 2015-01-24 17:53 -0600
    Re: Hello World in Python Chris Angelico <rosuav@gmail.com> - 2015-01-25 11:05 +1100
      Re: Hello World in Python Rustom Mody <rustompmody@gmail.com> - 2015-01-24 23:14 -0800
        Re: Hello World in Python Chris Angelico <rosuav@gmail.com> - 2015-01-25 18:27 +1100
    Re: Hello World in Python Terry Reedy <tjreedy@udel.edu> - 2015-01-24 20:12 -0500
      Re: Hello World in Python "Christopher J. Pisz" <cpisz@austin.rr.com> - 2015-01-24 22:53 -0600

#84523 — Hello World in Python

From"Christopher J. Pisz" <cpisz@austin.rr.com>
Date2015-01-24 17:53 -0600
SubjectHello World in Python
Message-ID<ma1b8f$pgf$1@dont-email.me>
I am trying to help a buddy out. I am a C++ on Windows guy. This buddy 
of mine is learning Python at work on a Mac. I figured I could 
contribute with non language specific questions and such.

When learning any new language, I said, the first step would be a Hello 
World program. Let's see if we can get that to work.

So my buddy creates opens the IDE they gave at the workplace, creates a 
new project, adds a demo.py file, writes one line : print "Hello World", 
hits Run in the IDE and indeed the display is shown at the bottom when 
it executes.

I say the next step would be to get that to run on the command line. So 
(keep in mind I know nothing about macs) my buddy opens a "zsh?" window, 
cd to the directory, and I say the command i most likely: python demo.py

It looks like it executes but there is no output to the command line window.

Can anyone explain why there is no output?
Can anyone recommend a good walkthrough of getting set up and doing basics?

It seems they jumped ahead at my buddy's workplace and want them to 
write a complicated script called by a "harness". I can only assume this 
harness is some compiled executable that takes python scripts as 
arguments and calls certain functions defined within them.

I'll probably end up learning python myself, just to help out. I hate to 
see someone making an effort to learn and not having the resources.

[toc] | [next] | [standalone]


#84527

FromChris Angelico <rosuav@gmail.com>
Date2015-01-25 11:05 +1100
Message-ID<mailman.18114.1422144321.18130.python-list@python.org>
In reply to#84523
On Sun, Jan 25, 2015 at 10:53 AM, Christopher J. Pisz
<cpisz@austin.rr.com> wrote:
> So my buddy creates opens the IDE they gave at the workplace, creates a new
> project, adds a demo.py file, writes one line : print "Hello World", hits
> Run in the IDE and indeed the display is shown at the bottom when it
> executes.
>
> I say the next step would be to get that to run on the command line. So
> (keep in mind I know nothing about macs) my buddy opens a "zsh?" window, cd
> to the directory, and I say the command i most likely: python demo.py
>
> It looks like it executes but there is no output to the command line window.
>
> Can anyone explain why there is no output?
> Can anyone recommend a good walkthrough of getting set up and doing basics?

Your broad methodology is fine! I'd normally expect that to work
correctly. Was the file properly saved? Ask him to display the file
(cat demo.py) to make sure it's what he thinks. Or maybe he's in a
different directory to the one he thinks he's in; again, catting the
file will help. Otherwise, it might be a weird problem with his shell,
but that's hard to diagnose.

One thing that I really like doing with my Python students (full
disclosure: I'm a mentor with www.thinkful.com and am thus at times
paid to help people learn Python) is some form of screen-sharing, so I
can watch him/her trying things. There are a number of zero-dollar
ways to do this, and it helps enormously. Flip on screen-share, ask
him to run the script, and see where that leads.

Good luck!

ChrisA

[toc] | [prev] | [next] | [standalone]


#84556

FromRustom Mody <rustompmody@gmail.com>
Date2015-01-24 23:14 -0800
Message-ID<7027fbaf-c124-40f6-894c-a4be6cce32b1@googlegroups.com>
In reply to#84527
On Sunday, January 25, 2015 at 5:36:02 AM UTC+5:30, Chris Angelico wrote:

> One thing that I really like doing with my Python students (full
> disclosure: I'm a mentor with www.thinkful.com and am thus at times
> paid to help people learn Python) is some form of screen-sharing, so I
> can watch him/her trying things. There are a number of zero-dollar
> ways to do this, and it helps enormously. Flip on screen-share, ask
> him to run the script, and see where that leads.

Would be interested in how you manage that!
Am teaching a class where everyone has a laptop.
Having them setup with a bare modicum of uniformity is turning out some challenge.
Some windows, some linux(es), even one blessed mac!

[toc] | [prev] | [next] | [standalone]


#84557

FromChris Angelico <rosuav@gmail.com>
Date2015-01-25 18:27 +1100
Message-ID<mailman.18129.1422170854.18130.python-list@python.org>
In reply to#84556
On Sun, Jan 25, 2015 at 6:14 PM, Rustom Mody <rustompmody@gmail.com> wrote:
> On Sunday, January 25, 2015 at 5:36:02 AM UTC+5:30, Chris Angelico wrote:
>
>> One thing that I really like doing with my Python students (full
>> disclosure: I'm a mentor with www.thinkful.com and am thus at times
>> paid to help people learn Python) is some form of screen-sharing, so I
>> can watch him/her trying things. There are a number of zero-dollar
>> ways to do this, and it helps enormously. Flip on screen-share, ask
>> him to run the script, and see where that leads.
>
> Would be interested in how you manage that!
> Am teaching a class where everyone has a laptop.
> Having them setup with a bare modicum of uniformity is turning out some challenge.
> Some windows, some linux(es), even one blessed mac!

Generally we use Google Hangouts - video chat, with options for
screen-share (replacing the camera; let's face it, when you're
discussing code, staring at talking heads isn't all that useful) and a
few other neat features. But if uniformity is an issue, you might want
to look into some kind of virtual Linux box like http://nitrous.io/ -
that way, everyone's using the same system, and nobody has to worry
about the stupid hassles of trying to support three different OSes.
Though Nitrous mightn't be as important for you as it is for the
Thinkful course; as part of the course, we teach PostgreSQL + Python +
PsycoPG2 + SQLAlchemy, and if you're on a Mac and your student is on
Windows, you'll *really* appreciate not having to figure out how to
install that lot on a foreign platform! (In theory, the situation
should be getting better. Installing stuff from PyPI under Windows has
long been a massive nuisance, but it's starting to become a bit
easier. But it's still a massive pain for someone who doesn't know
Windows to try to walk a Windows person through the setup.)

And hey. If you want a pay-for Python programming course, do check 'em
out - www.thinkful.com. You get regular one-on-one mentorship, a
highly responsive team of staff, and all sorts of random fun. There,
I'm done advertising now. :)

ChrisA

[toc] | [prev] | [next] | [standalone]


#84535

FromTerry Reedy <tjreedy@udel.edu>
Date2015-01-24 20:12 -0500
Message-ID<mailman.18118.1422148393.18130.python-list@python.org>
In reply to#84523
On 1/24/2015 6:53 PM, Christopher J. Pisz wrote:
> I am trying to help a buddy out. I am a C++ on Windows guy. This buddy
> of mine is learning Python at work on a Mac. I figured I could
> contribute with non language specific questions and such.
>
> When learning any new language, I said, the first step would be a Hello
> World program. Let's see if we can get that to work.
>
> So my buddy creates opens the IDE they gave at the workplace, creates a
> new project, adds a demo.py file, writes one line : print "Hello World",
> hits Run in the IDE and indeed the display is shown at the bottom when
> it executes.
>
> I say the next step would be to get that to run on the command line. So
> (keep in mind I know nothing about macs) my buddy opens a "zsh?" window,
> cd to the directory, and I say the command i most likely: python demo.py
>
> It looks like it executes but there is no output to the command line
> window.

It should.  In a Windows console, using 3.4:
C:\Programs\Python34>type tem.py  # cat on Mac?
print('Hello World!')

C:\Programs\Python34>python tem.py
Hello World!

 > Can anyone explain why there is no output?

Without a copy of the file and command, as above, no.

 > Can anyone recommend a good walkthrough of getting set up and doing 
basics?

Since you used 2.x  print syntax: https://docs.python.org/2.7/

"Python Setup and Usage
how to use Python on different platforms"

"Tutorial
start here"

 > I'll probably end up learning python myself, just to help out.

You might possibly enjoy Python as a complement to C++.  Some people 
prototype in Python and rewrite time critical functions in C++.  One can 
access .dlls either directly (via the ctypes module) and write a wrapper 
file in C or C++.  I believe Python has also been used to write tests 
for C++ functions (I know this is true for Python and Java, via Jython).

-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#84554

From"Christopher J. Pisz" <cpisz@austin.rr.com>
Date2015-01-24 22:53 -0600
Message-ID<54C476B8.2040100@austin.rr.com>
In reply to#84535
On 1/24/2015 7:12 PM, Terry Reedy wrote:
> On 1/24/2015 6:53 PM, Christopher J. Pisz wrote:
>> I am trying to help a buddy out. I am a C++ on Windows guy. This buddy
>> of mine is learning Python at work on a Mac. I figured I could
>> contribute with non language specific questions and such.
>>
>> When learning any new language, I said, the first step would be a Hello
>> World program. Let's see if we can get that to work.
>>
>> So my buddy creates opens the IDE they gave at the workplace, creates a
>> new project, adds a demo.py file, writes one line : print "Hello World",
>> hits Run in the IDE and indeed the display is shown at the bottom when
>> it executes.
>>
>> I say the next step would be to get that to run on the command line. So
>> (keep in mind I know nothing about macs) my buddy opens a "zsh?" window,
>> cd to the directory, and I say the command i most likely: python demo.py
>>
>> It looks like it executes but there is no output to the command line
>> window.
>
> It should.  In a Windows console, using 3.4:
> C:\Programs\Python34>type tem.py  # cat on Mac?
> print('Hello World!')
>
> C:\Programs\Python34>python tem.py
> Hello World!
>
>  > Can anyone explain why there is no output?
>
> Without a copy of the file and command, as above, no.
>
>  > Can anyone recommend a good walkthrough of getting set up and doing
> basics?
>
> Since you used 2.x  print syntax: https://docs.python.org/2.7/
>
> "Python Setup and Usage
> how to use Python on different platforms"
>
> "Tutorial
> start here"
>
>  > I'll probably end up learning python myself, just to help out.
>
> You might possibly enjoy Python as a complement to C++.  Some people
> prototype in Python and rewrite time critical functions in C++.  One can
> access .dlls either directly (via the ctypes module) and write a wrapper
> file in C or C++.  I believe Python has also been used to write tests
> for C++ functions (I know this is true for Python and Java, via Jython).
>

Good docs. I got setup in Windows in 10 minutes.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web