473,757 Members | 8,085 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:co py source destination\n"
import sys
len=len(sys.arg v)
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 5434
ji**********@gm ail.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:co py source destination\n"
import sys
len=len(sys.arg v)
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:co py source destination\n"
import sys
len=len(sys.arg v)
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**********@gm ail.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**********@gm ail.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
1731
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 Reference as well, which makes it distinctive from the 8 million other prettyprinters out there. It's been tested on 2.3 for Windows, OpenBSD 3.2 and RedHat 7.3. There's no reason it shouldn't work on other platforms with minor configuration. ...
1
2576
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 easily define your own colorscheme. example usage: # Highlight PySourceColor.py python PySourceColor.py or # Show help
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 however after processing 0 entries
2
2096
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 what issues I may encounter, with the result that I encountered a fairly strange one (to me, anyway). As I wanted to add new fields to all Python objects, it seemed to make the most sense to add them to PyObject_HEAD. When I added an int field to...
4
1547
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" functions or source code for Python and IDLE. Specifically I would like to know what in Python and IDLE would be analogous to void main () in a standard C program. This will help me to work out the structure of the interpreter and the environment....
9
3741
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 will help spell-check literal strings entered into Python source code? I don't mean spell-check strings entered by the user; I mean, go through the .py file, isolate strings, and tell me when the strings contain misspelled words. In an ideal...
5
2709
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 achieve this? Regards, Ken
1
1143
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, might go outside Latin-1 for their source code representation. I have an example in my blog: http://mybizmo.blogspot.com/2008/05/chinese-names-in-python.html If others have Python source with names in other languages,
5
2609
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? Thanks, - Joe
0
9298
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9906
jinu1996
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...
1
9885
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,...
0
9737
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8737
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, 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...
1
7286
isladogs
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...
0
6562
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
3399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2698
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.