py/pyext help


    Mar 24 2007 | 6:13 am
    Hi all,
    I'm trying to integrate a python script with max/msp, but I'm still new to max/msp, and I'm not quite sure how to get py/pyext up and running properly.
    I've downloaded the binaries from http://grrrr.org/ext/py/, unzipped them, and copied py-objectmappings.txt to C:Program FilesCycling '74MaxMSP 4.6Cycling '74init
    Beyond that, I don't see any instructions for how to install this patch. When I open up the thread-1.mxb patch that comes with the py/pyext files, I get a warning in the Max window "error: pyext no such object", which makes me think I'm missing a step.
    And, assuming I can get this properly installed, how do I go about running my python script? It's already written as a non-max/msp script.
    Any help would be much appreciated.

    • Mar 24 2007 | 8:47 am
      On 24 Mar 2007, at 07:13, Mike wrote:
      >
      > Hi all,
      >
      > I'm trying to integrate a python script with max/msp, but I'm still
      > new to max/msp, and I'm not quite sure how to get py/pyext up and
      > running properly.
      >
      > I've downloaded the binaries from http://grrrr.org/ext/py/,
      > unzipped them, and copied py-objectmappings.txt to C:Program Files
      > Cycling '74MaxMSP 4.6Cycling '74init
      >
      > Beyond that, I don't see any instructions for how to install this
      > patch. When I open up the thread-1.mxb patch that comes with the
      > py/pyext files, I get a warning in the Max window "error: pyext no
      > such object", which makes me think I'm missing a step.
      >
      hi mike,
      the object your are looking for is in max-darwin and is called "py.mxo".
      stick this together with the scripts somewhere into max's searchpath.
      BUT as far as i can see, this is only for maxmsp 4.5.
      crashes max 4.6, works fine in max 4.5 for me.
      >
      > And, assuming I can get this properly installed, how do I go about
      > running my python script? It's already written as a non-max/msp
      > script.
      apperently you pass the name of the script to load as the first
      argument when creating the max-object.
      i haven't made any further tests, but that's how the example-patch
      works.
      volker.
    • Mar 24 2007 | 8:54 am
    • Mar 24 2007 | 1:53 pm
      On 24 Mar 2007, at 12:49, Thomas Grill wrote:
      > Hi all,
      > i'm sorry that i currently don't have time to properly update my
      > website, but the py/pyext packages on http://grrrr.org/ext/py are
      > not up-to-date any more.
      > Please replace the binary with the one that you find below http://
      > grrrr.org/ext/beta .
      > Volker, this one should be working for you under Max 4.6
      hi thomas,
      thanks for the update!
      it works fine, although under max 4.6 i have to trick max into
      loading pyext:
      when i open thread-1.mxb, max reports pyext: no such object.
      when i create a (empty) [py] object, py/pyext 0.2.1pre will be loaded/
      created, and after that thread-1.mxb works fine.
      this is not the case with the old py.mxo under max 4.5
      apart from that, everthing seems to be ok.
      thanks again,
      volker.
    • Mar 24 2007 | 4:26 pm
      Hi Volker,
      >
      > it works fine, although under max 4.6 i have to trick max into
      > loading pyext:
      > when i open thread-1.mxb, max reports pyext: no such object.
      > when i create a (empty) [py] object, py/pyext 0.2.1pre will be
      > loaded/created, and after that thread-1.mxb works fine.
      >
      the actually recommended procedure is to install the py-
      objectlist.txt file (i think it's called that way...) from the py
      package, to inform Max about the objects within the external library.
      greetings,
      Thomas
      --
      Thomas Grill
    • Mar 24 2007 | 6:53 pm
      On 24 Mar 2007, at 17:26, Thomas Grill wrote:
      > Hi Volker,
      >>
      >> it works fine, although under max 4.6 i have to trick max into
      >> loading pyext:
      >> when i open thread-1.mxb, max reports pyext: no such object.
      >> when i create a (empty) [py] object, py/pyext 0.2.1pre will be
      >> loaded/created, and after that thread-1.mxb works fine.
      >>
      >
      > the actually recommended procedure is to install the py-
      > objectlist.txt file (i think it's called that way...) from the py
      > package, to inform Max about the objects within the external library.
      that's what i had done - but only for the max4.5 version...
      ok, works like a charm now, thanks.
      volker.
    • Mar 24 2007 | 9:03 pm
      Thanks for all your help. I've now got py/pyext properly installed, and I've got the threads.mxb demo up and running.
      I'm still confused over how to get py to run my script, though.
      For simplicity, I'm using a basic "hello world" to get this set up right. It lives in a directory thats' part of the Max MSP path. All the examples have seen use the pyext object, not py, so I'm not sure how to use it properly.
      I don't want to use python to represent a max object, just to actually run the script, so I'm using the py object.
      How do I do this?
      Thanks.
    • Mar 24 2007 | 10:17 pm
      hi mike,
      I can send you an example of py, which is taken from the Pd version of
      py/pyext. I don't find it in the max release, but I think it should be
      somewhere. anyway. py is even easier to use than pyext...
      marius.
      Mike wrote:
      > Thanks for all your help. I've now got py/pyext properly installed, and I've got the threads.mxb demo up and running.
      > I'm still confused over how to get py to run my script, though.
      >
      > For simplicity, I'm using a basic "hello world" to get this set up right. It lives in a directory thats' part of the Max MSP path. All the examples have seen use the pyext object, not py, so I'm not sure how to use it properly.
      >
      > I don't want to use python to represent a max object, just to actually run the script, so I'm using the py object.
      >
      > How do I do this?
      >
      > Thanks.
      >
      # py/pyext - python script objects for PD and MaxMSP
      #
      # Copyright (c) 2002-2005 Thomas Grill (gr@grrrr.org)
      # For information on usage and redistribution, and for a DISCLAIMER OF ALL
      # WARRANTIES, see the file, "license.txt," in this distribution.
      #
      """Several functions to show the py script functionality"""
      import sys
      print "Script initialized"
      try:
      print "Script arguments: ",sys.argv
      except:
      print
      def numargs(*args): # variable argument list
      """Return the number of arguments"""
      return len(args)
      def strlen(arg):
      """Return the string length"""
      # we must convert to string first (it's a symbol type most likely)
      return len(str(arg))
      def strcat(*args):
      """Concatenate several symbols"""
      return reduce(lambda a,b: a+str(b), args,"")
      def addall(*args): # variable argument list
      """Add a couple of numbers"""
      return reduce(lambda a,b: a+b, args,0)
      def ret1():
      return 1,2,3,4
      def ret2():
      return "sd","lk","ki"
      def ret3():
      return ["sd","lk","ki"]
    • Mar 24 2007 | 10:26 pm
      >
      > I don't want to use python to represent a max object, just to
      > actually run the script, so I'm using the py object.
      >
      > How do I do this?
      >
      either
      [function args( ->(right) [py module]
      or
      [list args( ->(right) [py module.function]
      see the help files for more info
      greetings,
      Thomas
      --
      Thomas Grill