Jython : SyntaxError: Lexical error at line 29, column 32. Encountered: "$" (36), after : ""
<p>I am getting a syntax error in my code. Can anyone say what's wrong in the syntax? I am new to this language, don't have much of an idea.</p>

<p>Error Message:</p>

<h2>WASX7017E: Exception received while running file "jdbcConn.jy"; exception information: com.ibm.bsf.BSFException: exception from Jython: Traceback (innermost last): (no code object) at line 0 File "", line 29 classpath = ["classpath" , ${ORACLE_JDBC_DRIVER_PATH}/ojdbc6.jar ] ^ SyntaxError: Lexical error at line 29, column 32. Encountered: "$" (36), after : ""</h2>

<p>My Code :</p>

<pre><code>import sys

## **JDBCProvider** ##

def OracleJDBC(cellName,serverName):
    name ="Oracle JDBC Driver"
    print " Name of JDBC Provider which will be created ---&gt; " + name
    print "   ----------------------------------------------------------------------------------------- "
    # Gets the name of cell
    cell = AdminControl.getCell() 
    print cell
    cellid = AdminConfig.getid('/Cell:'+ cell +'/')
    print cellid
    print "   ----------------------------------------------------------------------------------------- "
    ## Creating New JDBC Provider ##
    print " Creating New JDBC Provider :"+ name 
    n1 = ["name" , "Oracle JDBC Driver" ]
    desc = ["description" , "Oracle JDBC Driver"]
    impn = ["implementationClassName" ,
            "oracle.jdbc.pool.OracleConnectionPoolDataSource"]
    classpath = ["classpath" , ${ORACLE_JDBC_DRIVER_PATH}/ojdbc6.jar ]
    attrs1 = [n1 , impn , desc , classpath]

    n1 = ["name" , "Oracle JDBC Driver" ]

    desc = ["description" , "Oracle JDBC Driver"]

    impn = ["implementationClassName" , "oracle.jdbc.pool.OracleConnectionPoolDataSource"]

    classpath = ["classpath" , "${ORACLE_JDBC_DRIVER_PATH}/ojdbc6.jar"]

    attrs1 = [n1 , impn , desc , classpath]

    Serverid = AdminConfig.getid("/Cell:" + cellName + "/ServerName:" + serverName +"/")

    jdbc = AdminConfig.create('JDBCProvider', Serverid, attrs1)

    print " New JDBC Provider created :" + name 

    AdminConfig.save()

    print " Saving Configuraion " 

    print "   ----------------------------------------------------------------------------------------- "

    ####################################################################################################################
    ####################################################################################################################

#main program starts here
if __name__ == '__main__':
    cellName = sys.argv[0]
    serverName = sys.argv[1]
    OracleJDBC(cellName,serverName)
</code></pre>

<p>Your problem is in this line:</p>

<pre><code>classpath = ["classpath" , ${ORACLE_JDBC_DRIVER_PATH}/ojdbc6.jar ]
</code></pre>

<p>Instead, do something like</p>

<pre><code>opath = os.getenv("ORACLE_JDBC_DRIVER_PATH")
classpath = ["classpath", "{}/ojdbc6.jar".format(opath)]
</code></pre>

<p>"${ORACLE_JDBC_DRIVER_PATH}" is shell syntax, not Python.</p>

python jython