Python论坛  - 讨论区

标题:[python-chinese] 这怎么会出错的?怪

2007年04月15日 星期日 13:04

jessinio smith jessinio在gmail.com
星期日 四月 15 13:04:02 HKT 2007

¿´²»³öΪʲôѽ£¬°ïһϡ£ÃÆѽ


#!/usr/bin/python
# -*- coding: utf-8 -*-
import socket

mySocket = socket.socket()
mySocket.bind(('192.168.1.72',4444))
mySocket.listen()
#Ö÷º¯ÊýµÄ¿ªÊ¼£º
if __name__ == '__main__':
    while 1:
    mySocketChild,addr = mySocket.accept()
    print addr
    mySocketChild.close()

³ö´íÐÅÏ¢£º
Traceback (most recent call last):
  File "socket.py", line 3, in ?
    import socket
  File "/home/jessinio/files/socket.py", line 5, in ?
    mySocket = socket.socket()
TypeError: 'module' object is not callable
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070415/8fee93c3/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年04月15日 星期日 13:05

jessinio smith jessinio在gmail.com
星期日 四月 15 13:05:07 HKT 2007

whileÓï¾äÏÂÃæÊÇ´øËõ½øµÄ£¬gmailÕâ¸öûÓÐÏÔʾ¡£
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070415/a50be13b/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年04月15日 星期日 13:34

liokm liokmkoil在gmail.com
星期日 四月 15 13:34:40 HKT 2007

µ±Ç°Ä¿Â¼ÏµÄÎļþºÍÄ£¿éÖØÃûÁË£¬²»»áÕýÈ·¶ÁÈ¡Ä£¿ésocketÁË¡£

ÔÚ07-4-15£¬jessinio smith <jessinio在gmail.com> дµÀ£º
>
> ¿´²»³öΪʲôѽ£¬°ïһϡ£ÃÆѽ
>
>
> #!/usr/bin/python
> # -*- coding: utf-8 -*-
> import socket
>
> mySocket = socket.socket()
> mySocket.bind(('192.168.1.72',4444))
> mySocket.listen ()
> #Ö÷º¯ÊýµÄ¿ªÊ¼£º
> if __name__ == '__main__':
>     while 1:
>     mySocketChild,addr = mySocket.accept()
>     print addr
>     mySocketChild.close()
>
> ³ö´íÐÅÏ¢£º
> Traceback (most recent call last):
>   File " socket.py", line 3, in ?
>     import socket
>   File "/home/jessinio/files/socket.py", line 5, in ?
>     mySocket = socket.socket()
> TypeError: 'module' object is not callable
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070415/83e97737/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年04月15日 星期日 13:37

jessinio smith jessinio在gmail.com
星期日 四月 15 13:37:57 HKT 2007

¸Ðл£¡£¡¸Ð¶¯ÖÐ~~~~~~

ÃÆÁ˺ܶࡣ»¹ÒÔΪ×Ô¼ºÃ»ÓÐд´úÂëµÄÌ츳¡£Ïë°ÑµçÄÔ¸øÈÓÁË¡£
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070415/0c220ab9/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年04月15日 星期日 13:58

jessinio smith jessinio在gmail.com
星期日 四月 15 13:58:49 HKT 2007

¸ÄÁË»¹ÊDz»ÐÐѽ£¡£¡£º

еÄÎÊÌ⣺

jessinio在nio2host:~/files$ mv socket.py printPeersocket.py
jessinio在nio2host:~/files$ python printPeersocket.py
Traceback (most recent call last):
  File "printPeersocket.py", line 3, in ?
    import socket
  File "/usr/lib/python2.4/socket.py", line 5, in ?
    This module provides socket operations and some related functions.
TypeError: 'module' object is not callable
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070415/b36f1dd9/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年04月15日 星期日 14:10

liokm liokmkoil在gmail.com
星期日 四月 15 14:10:31 HKT 2007

µ±Ç°Ä¿Â¼ÏÂÒѾ­±àÒë¹ýµÄÎļþɾû£¿±ÈÈçsocket.pyc £º£©

ÔÚ07-4-15£¬jessinio smith <jessinio在gmail.com> дµÀ£º
>
> ¸ÄÁË»¹ÊDz»ÐÐѽ£¡£¡£º
>
> еÄÎÊÌ⣺
>
> jessinio在nio2host:~/files$ mv socket.py printPeersocket.py
> jessinio在nio2host:~/files$ python printPeersocket.py
> Traceback (most recent call last):
>   File "printPeersocket.py", line 3, in ?
>     import socket
>   File "/usr/lib/python2.4/socket.py", line 5, in ?
>     This module provides socket operations and some related functions.
> TypeError: 'module' object is not callable
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070415/4bd00b1c/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年04月15日 星期日 14:20

jessinio smith jessinio在gmail.com
星期日 四月 15 14:20:47 HKT 2007

Ŷ£¡£¡£¡£¡£¡£¡£¡£¡

sys.pathĬÈÏ°üÀ¨µ±Ç°Ä¿Â¼µÄÂ𣿣¿
>>> sys.path
['', '/usr/lib/python24.zip', '/usr/lib/python2.4',
'/usr/lib/python2.4/plat-linux2', '/usr/lib/python2.4/lib-tk',
'/usr/lib/python2.4/lib-dynload', '/usr/local/lib/python2.4/site-packages',
'/usr/lib/python2.4/site-packages',
'/usr/lib/python2.4/site-packages/Numeric',
'/usr/lib/python2.4/site-packages/cairo',
'/usr/lib/python2.4/site-packages/gst-0.10',
'/var/lib/python-support/python2.4', '/usr/lib/python2.4/site-packages/gtk-
2.0', '/var/lib/python-support/python2.4/gtk-2.0',
'/usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode']

µÚÒ»¸öÊÇ¿ÕµÄ×Ö·û´®¡£±íʾµ±Ç°Ä¿Â¼Â𣿣¿²»ÊÇ'.'Â𣿣¿
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070415/ee6c6660/attachment-0001.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年04月15日 星期日 14:31

liokm liokmkoil在gmail.com
星期日 四月 15 14:31:17 HKT 2007

*path* A list of strings that specifies the search path for modules.
Initialized from the environment variable PYTHONPATH, plus an
installation-dependent default.

As initialized upon program startup, the first item of this list, path[0],
is the directory containing the script that was used to invoke the Python
interpreter. If the script directory is not available (e.g. if the
interpreter is invoked interactively or if the script is read from standard
input), path[0] is the empty string, which directs Python to search modules
in the current directory first.


ÔÚ07-4-15£¬jessinio smith <jessinio在gmail.com> дµÀ£º
>
> Ŷ£¡£¡£¡£¡£¡£¡£¡£¡
>
> sys.pathĬÈÏ°üÀ¨µ±Ç°Ä¿Â¼µÄÂ𣿣¿
> >>> sys.path
> ['', '/usr/lib/python24.zip', '/usr/lib/python2.4',
> '/usr/lib/python2.4/plat-linux2', '/usr/lib/python2.4/lib-tk',
> '/usr/lib/python2.4/lib-dynload', '/usr/local/lib/python2.4/site-packages',
> '/usr/lib/python2.4/site-packages',
> '/usr/lib/python2.4/site-packages/Numeric',
> '/usr/lib/python2.4/site-packages/cairo',
> '/usr/lib/python2.4/site-packages/gst- 0.10',
> '/var/lib/python-support/python2.4', '/usr/lib/python2.4/site-packages/gtk-
> 2.0', '/var/lib/python-support/python2.4/gtk-2.0',
> '/usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode']
>
> µÚÒ»¸öÊÇ¿ÕµÄ×Ö·û´®¡£±íʾµ±Ç°Ä¿Â¼Â𣿣¿²»ÊÇ'.'Â𣿣¿
>
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070415/84227782/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号