473,503 Members | 3,740 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python crashed when importing SOAPpy,printing out 'usage:copy source destination'

Hello all,
when i import SOAPpy, the python crashed and print out 'usage:copy
source destination'.
As follows:
############################
haiyun# python
Python 2.4.1 (#2, Mar 28 2006, 21:00:14)
[GCC 3.4.2 [FreeBSD] 20040728] on freebsd5
Type "help", "copyright", "credits" or "license" for more information.
>>import SOAPpy
usage:copy source destination
#############################
Then i checked and found that in my pwd there is a .py file,
i guess it is this file caused the problem.
the file content is as follows:
############################
haiyun# cat a.py
#!env python
usage="usage:copy source destination\n"
import sys
len=len(sys.argv)
if len!=3 :
print usage
sys.exit()
################end#########

So the python will crash when i import SOAPpy if working in a dir
containing this .py file,
and if rename the .py file to another type , say .txt, the problem
dispeared.

Who can tell me what's the problem.

Oct 28 '06 #1
4 5408
ji**********@gmail.com wrote:
when i import SOAPpy, the python crashed and print out 'usage:copy
source destination'.
As follows:
############################
haiyun# python
Python 2.4.1 (#2, Mar 28 2006, 21:00:14)
[GCC 3.4.2 [FreeBSD] 20040728] on freebsd5
Type "help", "copyright", "credits" or "license" for more information.
>>>import SOAPpy
usage:copy source destination
#############################
Then i checked and found that in my pwd there is a .py file,
i guess it is this file caused the problem.
the file content is as follows:
############################
haiyun# cat a.py
#!env python
usage="usage:copy source destination\n"
import sys
len=len(sys.argv)
if len!=3 :
print usage
sys.exit()
################end#########

So the python will crash when i import SOAPpy if working in a dir
containing this .py file,
and if rename the .py file to another type , say .txt, the problem
dispeared.

Who can tell me what's the problem.
this is how things work: Python doesn't distinguish between script
files and module files; a module is simply a script that defines a
bunch of things.

if you want to create something that can work both as a script and a
module, see:

http://effbot.org/pyfaq/tutor-what-i...e-main-for.htm

</F>

Oct 28 '06 #2
Fredrik Lundh wrote:
>
this is how things work: Python doesn't distinguish between script
files and module files; a module is simply a script that defines a
bunch of things.

if you want to create something that can work both as a script and a
module, see:

http://effbot.org/pyfaq/tutor-what-i...e-main-for.htm

</F>
I still can't understand it. If i rename the 'copy.py' to 'a.py',
there will be no problem.
As follows:
###########################
haiyun# ls
copy.py
haiyun# python
Python 2.4.1 (#2, Mar 28 2006, 21:00:14)
[GCC 3.4.2 [FreeBSD] 20040728] on freebsd5
Type "help", "copyright", "credits" or "license" for more information.
>>import SOAPpy
usage:copy source destination

haiyun# ls
copy.py copy.pyc
##########################

it seems that the copy.py in the PWD has been interpreted as the
SOAPpy module imported.
So i rename the copy.py to a.py.
As follows:
########################
haiyun# ls
copy.py copy.pyc
haiyun# rm copy.pyc
haiyun# mv copy.py a.py
haiyun# ls
a.py
haiyun# python
Python 2.4.1 (#2, Mar 28 2006, 21:00:14)
[GCC 3.4.2 [FreeBSD] 20040728] on freebsd5
Type "help", "copyright", "credits" or "license" for more information.
>>import SOAPpy
#########################

Everything is all right!
The content of the copy.py(a.py) is:
#########################
haiyun# cat a.py
#!env python
usage="usage:copy source destination\n"
import sys
len=len(sys.argv)
if len!=3 :
print usage
sys.exit()
#########################

I guess something in the SOAPpy module conflects with the copy.py in
the PWD.
So what it happened?
>Regards,
jiang.haiyun
Oct 28 '06 #3
ji**********@gmail.com wrote:
I still can't understand it. If i rename the 'copy.py' to 'a.py',
there will be no problem.
hint: when it works, try typing the following into the interpreter:
>>import copy
copy.__file__
</F>

Oct 28 '06 #4
Fredrik Lundh wrote:
ji**********@gmail.com wrote:
I still can't understand it. If i rename the 'copy.py' to 'a.py',
there will be no problem.

hint: when it works, try typing the following into the interpreter:
>>import copy
>>copy.__file__

</F>
I know, the copy module is imported by the SOAPpy module.
But SOAPpy imported an un-proper one from the CWD.

Thank you very much :)
>Regards,
jiang.haiyun
Oct 29 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1710
by: logistix | last post by:
PyXR 0.9.3- Cross-Referenced HTML from Python Source PyXR generates HTML pages from python source files. It also generates cross-referenced hyperlinks and integrates with the Python Library...
1
2548
by: M.E.Farmer | last post by:
Hello c.l.py!, I have just finished this and decided to share. PySourceColor is a module to convert Python source into colored html. Yes it has been done before, but I like this better:) You can...
2
355
by: Elric02 | last post by:
I'm currently trying to get access to the Python source code, however whenever I try to extract the files using the latest version of WinZip (version 10) I get the following error "error reading...
2
2086
by: Petter Haggholm | last post by:
For academic reasons, I'm hacking on the Python source trying to add some new capabilities. At present, I'm making minor changes mostly to familiarise myself with the code and gain awareness of...
4
1525
by: renguy | last post by:
I am interested in making some changes and additions to the Python environment (Python and IDLE). I have the source code and can build the source, but what I want to know is what are the "main"...
9
3727
by: John Zenger | last post by:
To my horror, someone pointed out to me yesterday that a web app I wrote has been prominently displaying a misspelled word. The word was buried in my code. Is there a utility out there that...
5
2687
by: xkenneth | last post by:
Hi All, I'll shortly be distributing a number of python applications that use proprietary. The software is part of a much larger system and it will need to be distributed securely. How can i...
1
1134
by: kirby.urner | last post by:
It's probably not news to anyone here that Python 3 gives us access to the unicode codespace for Python names, not just string literals, meaning our functions and classes, lists and dictionaries,...
5
2599
by: Joe Strout | last post by:
We have a client who's paranoid about distributing the Python source to his commercial app. Is there some way I can distribute and use just the .pyc files, so as to not give away the source? ...
0
7192
marktang
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,...
0
7064
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7261
Oralloy
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,...
1
6974
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...
0
5559
agi2029
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,...
0
4665
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3147
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1492
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 ...
1
721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.