I'm trying to run a Python program on Unix and I'm encountering some
behavior I don't understand. I'm a Unix newbie, and I'm wondering if
someone can help.
I have a simple program:
_______________ _______________ ______________
#! /home/fergs/python/bin/python
import sys, os
import cx_Oracle
_______________ _______________ ______________
If I run it through the Python interpreter, this way: python test.py
it runs fine.
But if I try to run it as an executable script, this way:
test.py
I get an import error that says it can't find cx_Oracle.
Why does it behave differently when I run it in these two ways, and
what do I need to do to make it run successfully either way? 4 1786
Steve wrote: I'm trying to run a Python program on Unix and I'm encountering some behavior I don't understand. I'm a Unix newbie, and I'm wondering if someone can help.
I have a simple program: _______________ _______________ ______________
#! /home/fergs/python/bin/python import sys, os import cx_Oracle _______________ _______________ ______________
If I run it through the Python interpreter, this way:
>> python test.py it runs fine.
But if I try to run it as an executable script, this way: >> test.py
I get an import error that says it can't find cx_Oracle.
Why does it behave differently when I run it in these two ways, and what do I need to do to make it run successfully either way?
I ran across something similar with using py2exe. I think it occurs
when there are more than one file with the same name in different
locations in the search path. Try renaming cx_Oracle to _cx_Oracle then
import as...
import _cx_Oracle as cx_Oracle
Of course your problem might be entirely different. But this might help.
Cheers,
Ron
On Oct 07, Steve wrote: I have a simple program: _______________ _______________ ______________
#! /home/fergs/python/bin/python import sys, os import cx_Oracle _______________ _______________ ______________
If I run it through the Python interpreter, this way:
>> python test.py it runs fine.
But if I try to run it as an executable script, this way: >> test.py
I get an import error that says it can't find cx_Oracle.
Are "which python" and "/home/fergs/python/bin/python" the same? If
not, it appears that "which python" can see cx_Oracle, but the latter
cannot. You could mess with PYTHONPATH or get /home/.../python into the
front of your PATH.
--
Micah Elliott
<md*@micah.elli ott.name>
"Steve" wrote: I'm trying to run a Python program on Unix and I'm encountering some behavior I don't understand. I'm a Unix newbie, and I'm wondering if someone can help.
If I run it through the Python interpreter, this way:
>> python test.py it runs fine.
But if I try to run it as an executable script, this way: >> test.py
I get an import error that says it can't find cx_Oracle.
Why does it behave differently when I run it in these two ways, and what do I need to do to make it run successfully either way?
in the first case, the shell uses the PATH variable to search for a python
interpreter. in the second case, the shell uses the path specified in the
script.
what does "which python" say?
</F>
I did "which python" and the two paths were different. Once I fixed
the path in the script, it worked fine.
Thanks Frederik and Micah! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Markus Doering |
last post by:
Hello,
I just switched from 2.2 to Python 2.3.
I am developing an XML/CGI interface to databases as a python package called
"unitWrapper" containing several modules which ran fine under v2.2.
Running Python2.3 under windows2000 I get import errors when a module
imports another module of the same package with absolute package-names like
this:
|
by: jean.rossier |
last post by:
Hello All,
I am facing a problem while importing pylab library(in a .py program file) via
web browser however the same program works when I execute it from the command
prompt.
my configuration :
Fedora Core 3
Apache 2.0
|
by: zhang xiaoning |
last post by:
Hi,
I download and extract python-2.4.2 source code for unix, and then, build
and install it on aix5, the configure option I used is:
../configure --enable-shared --disable-ipv6 --prefix=/usr/python
then, I run:
make
and
make install
|
by: Iain A. Mcleod |
last post by:
Hi
I'm stuck with the following schema validation problem in VS.NET 2003:
I have two types of xml document and related schema:
project and projectCollection.
A projectcollection is just a set of projects.
Therefore, I wish to include the project customType in the projectCollection
namespace.
I therefore have declared two xsd documents: project.xsd and
projectcollection.xsd
|
by: mark |
last post by:
In Access 2000 and 2002, I have created an import specification to import the
fixed-width recordset below into an existing table. I am having strange
problems with the import of the date and time fields.
177 102003 16:43:12 102003 18:43:12 6OAG0ADP Y 0000 0000 0000 0000 61930 4HGA800
165 102003 17:43:12 102003 18:44:12 6OAG0ADP Y 0000 0000 0000 0000 61930 4HGA800
177 102003 16:41:18 102003 18:45:12 6OAG0ADP Y 0000 0000 0000 0000 61930...
| |
by: Dan |
last post by:
Could someone please help me with auto importing a series of data
files into an Access table. I tried to follow code given below in a
previous messagebut i'm getting error messages.
Here's my database stats:
Path: C:\Database (contains the database and all the text files to
be imported)
Text files to import: (SampleData4.txt and SampleData3.txt as testing
examples)
|
by: Neter Smith |
last post by:
I have run into a problem when trying to import a WSDL reference under VS
2003 and 1.1 of the framework. It appears as if it is in the generation of
the proxy that things are failing.
When I add the reference, I get the following error:
C:\Inetpub\wwwroot\WebServices\samples\WSDL\dotnet\OblixSampleForDotNetWSDL\Web
References\localhost\Reference.map(1): Custom tool error: Unable to import
WebService/Schema. A schema with the namespace...
|
by: Mathias Waack |
last post by:
Hi,
I've embedded python into a legacy application. It works - most of the time.
In some special situations the app crashes executing the "import random".
There are two different situations:
1. the sources compiled with gcc 4.1.2 crash with illegal instruction error:
(running my application)
|
by: Ron Adam |
last post by:
from __future__ import absolute_import
Is there a way to check if this is working? I get the same results with or
without it.
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17)
on win 32
_Ron
|
by: KingoftheKings |
last post by:
I'm new here. I want a help with VB codes that will import text or excel files from a specified directory in to an existing or new Access table. I have written some codes, but when I click the command button, nothing happens.Here is my code:
Private Sub cmdStartImport_Click()
Dim rst As ADODB.Recordset
Dim strNewTable As String
Dim strFileType As String
On Error GoTo ErrorHandler
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |