Loading ...
Sorry, an error occurred while loading the content.

Re: [NTS] Using Python instead of Perl

Expand Messages
  • rpdooling
    Jason, Any idea why I can t get something like this to work? It works fine from the command line no matter what directory I m in. ^!Info ^$GetOutput( python
    Message 1 of 19 , Oct 18, 2005
    • 0 Attachment
      Jason,

      Any idea why I can't get something like this to work? It works fine
      from the command line no matter what directory I'm in.

      ^!Info ^$GetOutput("python -V")$

      --- In ntb-scripts@yahoogroups.com, "Jason Morgan" <jason@d...> wrote:
      >
      > Rick,
      >
      > From my point of view, Python is much easier to understand than Perl.
      > If you have any experience with other Object Oriented languages, such as
      > C/C++, Python should be a snap for you.
      > As the majority of my clips are very specialized to my needs, I'm
      > including a very simple example that should give you an idea of how to
      > get started. You will need to install Python, which is free and can be
      > downloaded from www.python.org. There you can also find almost
      > everything you need to get started programming in Python.
      >
      > H="Sort"
      > ^!RunScript C:\python24\python.exe sort
      >
      > H="sort"
      > from sys import stdin
      > input = stdin.read().split('\n')
      > input.sort()
      > print '\n'.join(input)
      >
      > --
      > Jason Morgan
      > Senior Programmer
      > Decipher, Inc.
      > p 800.923.5523
      >
      >
      > > -----Original Message-----
      > > From: ntb-scripts@yahoogroups.com
      > > [mailto:ntb-scripts@yahoogroups.com] On Behalf Of rpdooling
      > > Sent: Wednesday, September 28, 2005 2:46 PM
      > > To: ntb-scripts@yahoogroups.com
      > > Subject: Re: [NTS] Using Python instead of Perl
      > >
      > >
      > > Jason,
      > >
      > > Fire away. I'm just learning PERL and thinking about
      > > switching to Python instead because I forget everything in
      > > between immersions. I hear Python is easier to read and remember.
      > >
      > > Rick
      > >
      > > --- In ntb-scripts@yahoogroups.com, "Jason Morgan" <jason@d...> wrote:
      > > > Not sure if anyone is interested, but I've managed to create clips
      > > > that will run Python code (which is what I mainly use). If
      > > anyone is
      > > > interested, let me know.
      > > >
      > > > --
      > > > Jason Morgan
      > > > Senior Programmer
      > > > Decipher, Inc.
      > > > p 800.923.5523
      > >
      > >
      > >
      > >
      > > ------------------------ Yahoo! Groups Sponsor
      > > --------------------~-->
      > > Get Bzzzy! (real tools to help you find a job). Welcome to
      > > the Sweet Life.
      > > http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/NhFolB/TM
      > > --------------------------------------------------------------
      > > ------~->
      > >
      > > ntb-scripts-unsubscribe@yahoogroups.com
      > >
      > >
      > > Yahoo! Groups Links
      > >
      > >
      > >
      > >
      > >
      > >
      >
    • rpdooling
      Jason, For purposes of comparison, this DOES work: ^!Info ^$GetOutput(python -c import sys;print sys.version )$ So I m thinking it s some quirk in Python or
      Message 2 of 19 , Oct 19, 2005
      • 0 Attachment
        Jason,

        For purposes of comparison, this DOES work:

        ^!Info ^$GetOutput(python -c "import sys;print sys.version")$

        So I'm thinking it's some quirk in Python or NoteTab that sends the
        output of a regular commandline Python command to StdErr.err instead
        of allowing NoteTab to grab it with the ^$GetOutput()$ function.

        Oh well.

        rd

        --- In ntb-scripts@yahoogroups.com, "rpdooling" <rpdooling@y...> wrote:
        >
        > Jason,
        >
        > Any idea why I can't get something like this to work? It works fine
        > from the command line no matter what directory I'm in.
        >
        > ^!Info ^$GetOutput("python -V")$
        >
        > --- In ntb-scripts@yahoogroups.com, "Jason Morgan" <jason@d...> wrote:
        > >
        > > Rick,
        > >
        > > From my point of view, Python is much easier to understand than Perl.
        > > If you have any experience with other Object Oriented languages,
        such as
        > > C/C++, Python should be a snap for you.
        > > As the majority of my clips are very specialized to my needs, I'm
        > > including a very simple example that should give you an idea of how to
        > > get started. You will need to install Python, which is free and
        can be
        > > downloaded from www.python.org. There you can also find almost
        > > everything you need to get started programming in Python.
        > >
        > > H="Sort"
        > > ^!RunScript C:\python24\python.exe sort
        > >
        > > H="sort"
        > > from sys import stdin
        > > input = stdin.read().split('\n')
        > > input.sort()
        > > print '\n'.join(input)
        > >
        > > --
        > > Jason Morgan
        > > Senior Programmer
        > > Decipher, Inc.
        > > p 800.923.5523
        > >
        > >
        > > > -----Original Message-----
        > > > From: ntb-scripts@yahoogroups.com
        > > > [mailto:ntb-scripts@yahoogroups.com] On Behalf Of rpdooling
        > > > Sent: Wednesday, September 28, 2005 2:46 PM
        > > > To: ntb-scripts@yahoogroups.com
        > > > Subject: Re: [NTS] Using Python instead of Perl
        > > >
        > > >
        > > > Jason,
        > > >
        > > > Fire away. I'm just learning PERL and thinking about
        > > > switching to Python instead because I forget everything in
        > > > between immersions. I hear Python is easier to read and remember.
        > > >
        > > > Rick
        > > >
        > > > --- In ntb-scripts@yahoogroups.com, "Jason Morgan" <jason@d...>
        wrote:
        > > > > Not sure if anyone is interested, but I've managed to create
        clips
        > > > > that will run Python code (which is what I mainly use). If
        > > > anyone is
        > > > > interested, let me know.
        > > > >
        > > > > --
        > > > > Jason Morgan
        > > > > Senior Programmer
        > > > > Decipher, Inc.
        > > > > p 800.923.5523
        > > >
        > > >
        > > >
        > > >
        > > > ------------------------ Yahoo! Groups Sponsor
        > > > --------------------~-->
        > > > Get Bzzzy! (real tools to help you find a job). Welcome to
        > > > the Sweet Life.
        > > > http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/NhFolB/TM
        > > > --------------------------------------------------------------
        > > > ------~->
        > > >
        > > > ntb-scripts-unsubscribe@yahoogroups.com
        > > >
        > > >
        > > > Yahoo! Groups Links
        > > >
        > > >
        > > >
        > > >
        > > >
        > > >
        > >
        >
      • acummingsus
        Hi Rick, Have you tried ^$GetDosOutput( whatever command )$ sometimes GetDosOutput works other times GetOutput works Of the two, Perl generally seems to like
        Message 3 of 19 , Oct 19, 2005
        • 0 Attachment
          Hi Rick,

          Have you tried

          ^$GetDosOutput("whatever command")$

          sometimes GetDosOutput works

          other times GetOutput works

          Of the two, Perl generally seems to like the GetDosOutput better.

          I suppose your Python binary and pertinent libraries are in your OS
          environment search path or otherwise you'd also have a problem in a
          console too. (and you don't have prob in console)

          None of those search paths in $PATH (for Python) have a space in the
          path? I'm thinking: if space then ntb may need use of the GetShort()

          Perl has no space in path. Likely Python doesn't either.

          I'd try Python now. But I'm too far along down (or up) into the
          *depth* of the Perl pool or lake or whatever it is. And, vision sees
          Perl falling together before too long now.

          I'll try Python after that happens.

          Alan.

          --- In ntb-scripts@yahoogroups.com, "rpdooling" <rpdooling@y...> wrote:
          >
          > Jason,
          >
          > For purposes of comparison, this DOES work:
          >
          > ^!Info ^$GetOutput(python -c "import sys;print sys.version")$
          >
          > So I'm thinking it's some quirk in Python or NoteTab that sends the
          > output of a regular commandline Python command to StdErr.err instead
          > of allowing NoteTab to grab it with the ^$GetOutput()$ function.
          >
          > Oh well.
          >
          > rd
          >
          > --- In ntb-scripts@yahoogroups.com, "rpdooling" <rpdooling@y...> wrote:
          > >
          > > Jason,
          > >
          > > Any idea why I can't get something like this to work? It works fine
          > > from the command line no matter what directory I'm in.
          > >
          > > ^!Info ^$GetOutput("python -V")$
          > >
          > > --- In ntb-scripts@yahoogroups.com, "Jason Morgan" <jason@d...> wrote:
          > > >
          > > > Rick,
          > > >
          > > > From my point of view, Python is much easier to understand than
          Perl.
          > > > If you have any experience with other Object Oriented languages,
          > such as
          > > > C/C++, Python should be a snap for you.
          [ . . ]
        • rpdooling
          Thanks, Alan, Same result with GetDosOutput. I tried that before posting. It sends the version number to StdErr. The python path has no spaces. As for Python
          Message 4 of 19 , Oct 20, 2005
          • 0 Attachment
            Thanks, Alan,

            Same result with GetDosOutput. I tried that before posting. It sends
            the version number to StdErr. The python path has no spaces.

            As for Python vs. Perl, it's one of those holy wars, like Emacs vs.
            vi. I was told to try both, so I bought a book on Perl and another on
            Python. I already have Perl scripts and I'll keep using them. I'll let
            you know more after I learn more Python.

            Rick

            --- In ntb-scripts@yahoogroups.com, "acummingsus" <acummingsus@g...>
            wrote:
            >
            > Hi Rick,
            >
            > Have you tried
            >
            > ^$GetDosOutput("whatever command")$
            >
            > sometimes GetDosOutput works
            >
            > other times GetOutput works
            >
            > Of the two, Perl generally seems to like the GetDosOutput better.
            >
            > I suppose your Python binary and pertinent libraries are in your OS
            > environment search path or otherwise you'd also have a problem in a
            > console too. (and you don't have prob in console)
            >
            > None of those search paths in $PATH (for Python) have a space in the
            > path? I'm thinking: if space then ntb may need use of the GetShort()
            >
            > Perl has no space in path. Likely Python doesn't either.
            >
            > I'd try Python now. But I'm too far along down (or up) into the
            > *depth* of the Perl pool or lake or whatever it is. And, vision sees
            > Perl falling together before too long now.
            >
            > I'll try Python after that happens.
            >
            > Alan.
            >
            > --- In ntb-scripts@yahoogroups.com, "rpdooling" <rpdooling@y...> wrote:
            > >
            > > Jason,
            > >
            > > For purposes of comparison, this DOES work:
            > >
            > > ^!Info ^$GetOutput(python -c "import sys;print sys.version")$
            > >
            > > So I'm thinking it's some quirk in Python or NoteTab that sends the
            > > output of a regular commandline Python command to StdErr.err instead
            > > of allowing NoteTab to grab it with the ^$GetOutput()$ function.
            > >
            > > Oh well.
            > >
            > > rd
            > >
            > > --- In ntb-scripts@yahoogroups.com, "rpdooling" <rpdooling@y...>
            wrote:
            > > >
            > > > Jason,
            > > >
            > > > Any idea why I can't get something like this to work? It works fine
            > > > from the command line no matter what directory I'm in.
            > > >
            > > > ^!Info ^$GetOutput("python -V")$
            > > >
            > > > --- In ntb-scripts@yahoogroups.com, "Jason Morgan" <jason@d...>
            wrote:
            > > > >
            > > > > Rick,
            > > > >
            > > > > From my point of view, Python is much easier to understand than
            > Perl.
            > > > > If you have any experience with other Object Oriented languages,
            > > such as
            > > > > C/C++, Python should be a snap for you.
            > [ . . ]
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.