I have a path I trying to hook up to marathon (an automation testing tool) to locate a folder on an SVN but I keep getting a name error here is the module code

def LookUpPathPrefix(pathToFind):

    from marathon.playback import *
    inFile = open("paths.txt", "r")
    mountPointName = "start"

    while (mountPointName):
        mountPointName = inFile.readline()
        mountPoint=inFile.readline()

        if mountPointName.strip('\n\r') == pathToFind:
            fullFilename = mountPoint.strip('\n\r')
            break
    inFile.close()

    return fullFilename

**********************************************************************************Below is the actual script minus a couple security excerpts but the call is the same I get the following error when running the script

Exceptions>namerror : global name 'LookUpPathPrefix' is not defined Import Library.py   line 32 in function test





#{{{ Marathon
from default import *

#}}} Marathon

import os




def test():



    # Open the demo and training library

    from  LookUpPath import*
    fullfilename= LookUpPathPrefix('LIBRARIES')

    fullfilename = fullfilename+"_Libraries\"Here would be the aboslute path"

    if window('untitled'):
        select_menu('File>>Import Library...')
        if window('Select a Library to Import'):
            select('JFileChooser_0', fullfilename)

Edited 2 Years Ago by pyTony: code formatting, use the toolbar!

You could try from LookUpPath import LookUpPathPrefix instead of from LookUpPath import * making your text function like this

def test():
    # Open the demo and training library
    from  LookUpPath import LookUpPathPrefix
    fullfilename= LookUpPathPrefix('LIBRARIES')
    fullfilename = fullfilename+"_Libraries\"Here would be the aboslute path"
    if window('untitled'):
        select_menu('File>>Import Library...')
        if window('Select a Library to Import'):
            select('JFileChooser_0', fullfilename)

Thanks I did that and it finds the Module I think its a problem with the directory in the test harness apprecitate the feed back britanicus

This article has been dead for over six months. Start a new discussion instead.