Trying to install cx_Oracle

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Paulmiddleton
    New Member
    • Jul 2010
    • 12

    Trying to install cx_Oracle

    I'm new to Python and would like to learn it but also want to use cx_Oracle to access Oracle. I've installed 2 versions of Python and on the latest version (3.1.2) I get the error

    File "<stdin>", line 1
    install cx_Oracle
    ^
    SyntaxError: invalid syntax

    Please Help
    I've put the cx_Oracle in the local dirctory and the path to it in the path. I'm using windows
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    If you did a binary installation, all you need to do is import the module as in:
    Code:
    import cx_Oracle

    Comment

    • Paulmiddleton
      New Member
      • Jul 2010
      • 12

      #3
      Thanks but thats what I do and then I get the error

      Comment

      • bvdet
        Recognized Expert Specialist
        • Oct 2006
        • 2851

        #4
        I could be something as simple as a leading space character as in:
        Code:
        >>>  import math
        Traceback (  File "<interactive input>", line 1
            import math
            ^
        SyntaxError: invalid syntax
        >>>

        Comment

        • Paulmiddleton
          New Member
          • Jul 2010
          • 12

          #5
          Unfortunately not, I've tried extra spaces, upper case, lower case, the case that is specified...... AAAAAggggh

          Comment

          • bvdet
            Recognized Expert Specialist
            • Oct 2006
            • 2851

            #6
            It's probably something in the preceding code, possibly unbalanced parentheses.

            Comment

            • Paulmiddleton
              New Member
              • Jul 2010
              • 12

              #7
              but I'm only putting in import cx_Oracle

              Comment

              • bvdet
                Recognized Expert Specialist
                • Oct 2006
                • 2851

                #8
                Originally posted by Paulmiddleton
                but I'm only putting in import cx_Oracle
                Does this work:
                Code:
                import math

                Comment

                • Paulmiddleton
                  New Member
                  • Jul 2010
                  • 12

                  #9
                  That worked, just went straight back to the prompt

                  Comment

                  • Paulmiddleton
                    New Member
                    • Jul 2010
                    • 12

                    #10
                    >>> import cx_Oracle
                    Traceback (most recent call last):
                    File "<stdin>", line 1, in <module>
                    ImportError: DLL load failed: The specified module could not be found.

                    Comment

                    • bvdet
                      Recognized Expert Specialist
                      • Oct 2006
                      • 2851

                      #11
                      Make sure the pyd file is in a directory on the Python path as in:
                      Code:
                      >>> import sys
                      >>> sys.path

                      Comment

                      • Paulmiddleton
                        New Member
                        • Jul 2010
                        • 12

                        #12
                        This is the results of the above, I've put the cx_Oracle.pyd file in every directory here but still get the asme error. How do I add a directory to sys??

                        ['', 'C:\\Python31\\ python31.zip', 'C:\\Python31\\ DLLs', 'C:\\Python31\\ lib', 'C:\\Python31\\ lib\\pl
                        at-win', 'C:\\Python31', 'C:\\Python31\\ lib\\site-packages']

                        Error Message


                        >>> import cx_Oracle
                        Traceback (most recent call last):
                        File "<stdin>", line 1, in <module>
                        ImportError: DLL load failed: The specified module could not be found.

                        Comment

                        • bvdet
                          Recognized Expert Specialist
                          • Oct 2006
                          • 2851

                          #13
                          Originally posted by Paulmiddleton
                          This is the results of the above, I've put the cx_Oracle.pyd file in every directory here but still get the asme error. How do I add a directory to sys??

                          ['', 'C:\\Python31\\ python31.zip', 'C:\\Python31\\ DLLs', 'C:\\Python31\\ lib', 'C:\\Python31\\ lib\\pl
                          at-win', 'C:\\Python31', 'C:\\Python31\\ lib\\site-packages']

                          Error Message


                          >>> import cx_Oracle
                          Traceback (most recent call last):
                          File "<stdin>", line 1, in <module>
                          ImportError: DLL load failed: The specified module could not be found.
                          Did you perform a binary installation? The install file should have a name like cx_Oracle-5.0.3-10g.win32-py2.6.msi.

                          Comment

                          • Paulmiddleton
                            New Member
                            • Jul 2010
                            • 12

                            #14
                            Yes,the install file is
                            cx_Oracle-5.0-10g.win32-py3.0.msi

                            Comment

                            • bvdet
                              Recognized Expert Specialist
                              • Oct 2006
                              • 2851

                              #15
                              Try installing the version that matches your Python version:
                              cx_Oracle-5.0.3-10g.win32-py3.1.msi

                              Comment

                              Working...