User Tag List

Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 11 to 20 of 25

Thread: Python Scripting - Extension

  1. #11
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Sep 2006
    Location
    Dublin, Ireland / Covilha, Portugal
    Posts
    227
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Python Scripting - Extension

    I'm sorry Mathias, I don't fully understand the bit to add the site packages directory to the sys.path in the extension. Do I script that in the extension? Could you give me an example?

    Thanks for your time, great news that opencv can be used trouhg python object

  2. #12
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleSWF Export ModuleXNA Export Module
    Fusion 2.5 (Steam)
    Mathias's Avatar
    Join Date
    Jun 2006
    Location
    Copenhagen, Denmark
    Posts
    1,083
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)

    Re: Python Scripting - Extension

    Basically, you install pyopencv (and Python 2.6.5 beforehand if you haven't already), and then you do this in your code:
    Code:
    import sys
    # or whatever the path to your Python installation is
    sys.path.append('C:\\Program Files\\Python26\\Lib\\site-packages')
    import pyopencv
    This is a bit hack-ish, but it works. When distributing your application, you should include the site-packages\pyopencv (and site-packages\numpy if it's a dependency) directories in the same directory as the EXE.

  3. #13
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Sep 2006
    Location
    Dublin, Ireland / Covilha, Portugal
    Posts
    227
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Python Scripting - Extension

    I've tried asa you said,

    My code:

    import sys

    sys.path.append('C:\\Python26\\Lib\\site-packages')
    import numpy
    import pyopencv


    img = imread('people.jpg')
    hog = HOGDescriptor()
    hog.setSVMDetector(HOGDescriptor.getDefaultPeopleD etector())
    for r in hog.detectMultiScale(img, 0, Size(8,8), Size(24,16), 1.05, 2).to_list_of_Rect():
    r.x += round(r.width*0.1)
    r.y += round(r.height*0.1)
    r.width = round(r.width*0.8)
    r.height = round(r.height*0.8)
    rectangle(img, r.tl(), r.br(), Scalar(0,255,0), 1)

    namedWindow("people detector", 1)
    imshow("people detector", img)
    waitKey(0)

    I still get no module named multiarray as an error

  4. #14
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Sep 2006
    Location
    Dublin, Ireland / Covilha, Portugal
    Posts
    227
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Python Scripting - Extension

    sorry mathias, got it to work... just like you said

  5. #15
    No Products Registered

    Join Date
    Jun 2006
    Posts
    625
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Python Scripting - Extension

    I've run into the same kind of problems (trying to run pylacewing from the extension), and ended up adding this to my project :
    sys.path.append('C:\\Python26')
    sys.path.append('C:\\Python26\\DLLs')
    sys.path.append('C:\\Python26\\lib')
    sys.path.append('C:\\Python26\\lib\\lib-tk')
    sys.path.append('C:\\Python26\\lib\\plat-win')
    sys.path.append('C:\\Python26\\lib\\site-packages')
    sys.path.append('C:\\Python26\\lib\\site-packages\\Pythonwin')
    sys.path.append('C:\\Python26\\lib\\site-packages\\win32')
    sys.path.append('C:\\Python26\\lib\\site-packages\\win32\\lib')

    everything runs ok now

  6. #16
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Aug 2006
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Python Scripting - Extension

    Im new to python so im slightly confused about adding the extensions/packages. What im wondering is what do you download/need?

    Would i get the exe like -

    Box2D-2.0.2b1.win32-py2.6.exe

    Then install, i do this and can get it working with the main python but im not sure what to do in regards to making it work with MMF still yet. Also when it says put the package into the python26.zip does that mean you unzip it add the exe or install it then copy some files to some location and re-zip it again?

    I know that python is highly documented off site just like Lua is but all scripting extensions should definitely have a few tutorials with this type of stuff and other things where it links to MMF. Starting a new code language with no help docs and searching the web to find possibly the wrong answers or non MMF based answers is kind of annoying so a links/MMF reference here or on the wiki would also be nice

  7. #17
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleSWF Export ModuleXNA Export Module
    Fusion 2.5 (Steam)
    Mathias's Avatar
    Join Date
    Jun 2006
    Location
    Copenhagen, Denmark
    Posts
    1,083
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)

    Re: Python Scripting - Extension

    Box2D uses binary modules, so you'll have to install it, and then copy the Box2D package from your site-packages directory and include it with your executable when you distribute it (when you're merely developing, you can add site-packages to sys.path)

  8. #18
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Aug 2006
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Python Scripting - Extension

    Thanks i will try this, i think some other packages had a few other files in other folders also so maybe it would be better to just copy and zip the whole python folder?

    Also im curious, when a exe that uses python is built how does it use the zip would it use the whole thing somewhere? If that is the case is it worth optimizing it by removing any un-needed examples and extra things from packages etc? or would it only use what gets used. Python seems very powerful, this is like having 10000+ new extensions if i can get the packages working ok, it is great

  9. #19
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleSWF Export ModuleXNA Export Module
    Fusion 2.5 (Steam)
    Mathias's Avatar
    Join Date
    Jun 2006
    Location
    Copenhagen, Denmark
    Posts
    1,083
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)

    Re: Python Scripting - Extension

    It includes the whole python26.zip file, so you should remove examples and tests from the packages you're including, yeah

  10. #20
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Aug 2006
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Python Scripting - Extension

    Ok thanks for the info

Page 2 of 3 FirstFirst 1 2 3 LastLast

Similar Threads

  1. Port Python extension to iOS
    By iOSC in forum Paid Design & Development Requests
    Replies: 1
    Last Post: 1st July 2014, 01:07 PM
  2. Python extension port to iOS
    By iOSC in forum Python Scripting
    Replies: 2
    Last Post: 6th May 2014, 08:11 AM
  3. Python extension port to iOS
    By iOSC in forum iOS Export Module Version 2.0
    Replies: 3
    Last Post: 18th March 2013, 09:05 AM
  4. Python extension
    By Forum User in forum Extension Development
    Replies: 21
    Last Post: 1st February 2008, 08:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •