test_socket.py失败 [英] test_socket.py failure

查看:185
本文介绍了test_socket.py失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



大家好,


Linux 2.4.28

Glibc 2.2.5

gcc 2.95.3

我是Python的新手。


我已经从tar文件中编译了Python 2.4。

当运行''make test''我得到了一个失败

在test_socket中。


运行''。/ python Lib /test/test_socket.py''收益率:

================================ ================== ====================

错误:testGetServBy( __main __。GeneralModuleTests)

-------------------------------------- --------------------------------

Traceback(最近一次调用最后一次):

文件" Lib / test / test_socket.py",第330行,在testGetServBy中

port2 = socket.getservbyname(服务)

错误:服务/ proto not found


---------------------------------- ------------------------------------

在3.826s中进行58次测试


''服务'的价值'是'白天'。


经过大量的手工拧紧,编辑和使用''print''

语句后,我注释掉了第330行,

''#port2 = socket.getservbyname(service)''并用''port2 = port''替换它




运行''./ python Lib / test / test_socket.py''现在产生:

testGetServBy(__ main __。GeneralModuleTests)... ok


hi all,

Linux 2.4.28
Glibc 2.2.5
gcc 2.95.3
I''m new to Python.

I''ve compiled Python 2.4 from tar file.

When running ''make test'' i''m getting a failure
in test_socket.

Running ''./python Lib/test/test_socket.py'' yields:
================================================== ====================
ERROR: testGetServBy (__main__.GeneralModuleTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "Lib/test/test_socket.py", line 330, in testGetServBy
port2 = socket.getservbyname(service)
error: service/proto not found

----------------------------------------------------------------------
Ran 58 tests in 3.826s

The value of ''service'' was "daytime".

After much hand wringing, editing, and use of ''print''
statements i commented out line 330,
''# port2 = socket.getservbyname(service)'' and replaced it
with the line ''port2 = port''.

Running ''./python Lib/test/test_socket.py'' now yields:
testGetServBy (__main__.GeneralModuleTests) ... ok

推荐答案

x2***@mailcity.com 写道:
大家好,

Linux 2.4.28
Glibc 2.2.5
gcc 2.95.3

我是Python新手。

我已经从tar文件中编译了Python 2.4。

运行''make test''我在test_socket中失败了


运行''./python Lib / test / test_socket.py''产生:

===================== = ============================ ==================== />错误:testGetServBy(__ main __。GeneralModuleTests)
------------------------------------ ----------------------------------
Traceback(最近一次电话会议):
文件Lib / test / test_socket.py,第330行,在testGetServBy中
port2 = socket.getservbyname(服务)
错误:service / proto not found

- -------------------------------------------------- ------------------
在3.826s中进行58次测试

服务的价值是白天。

经过多次手工拧紧,编辑和使用''print''
语句后,我注释掉第330行,
''#port2 = socket.getservbyname(service)' '并用''port2 = port''替换它。

运行''。/ python Lib / test / test_socket.py''现在产生:

testGetServBy(__ main __。GeneralModuleTests)... ok



---------------------------------------- ------------------------------
在5.181s中进行58次测试

OK


''Modules / socketmodule.c'中找到''socket_getservbyname''的代码,其中调用了glibc
函数''getservbyname'':

Py_BEGIN_ALLOW_THREADS
sp = getservbyname(name,proto);
Py_END_ALLOW_THREADS
if(sp == NULL){
PyErr_SetString(socket_error," service / proto not found;
返回NULL;
}

唯一一次失败的socket.getservbyname调用是
它传递了单个参数。由于错误消息
service / proto not found似乎只是在gibc'''getservbyname'失败后才会生成'可能是那个'/'''PyArg_ParseTuple(args," s | s:getservbyname",& name,& proto)''
为''name''和/或'proto''生成导致
失败的值?

我在线搜索先前的失败报告330找到了第331行提到的问题。

好吧,无论如何,如果有人能指出我正确的道路,我会很感激。
hi all,

Linux 2.4.28
Glibc 2.2.5
gcc 2.95.3
I''m new to Python.

I''ve compiled Python 2.4 from tar file.

When running ''make test'' i''m getting a failure
in test_socket.

Running ''./python Lib/test/test_socket.py'' yields:
================================================== ====================
ERROR: testGetServBy (__main__.GeneralModuleTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "Lib/test/test_socket.py", line 330, in testGetServBy
port2 = socket.getservbyname(service)
error: service/proto not found

----------------------------------------------------------------------
Ran 58 tests in 3.826s

The value of ''service'' was "daytime".

After much hand wringing, editing, and use of ''print''
statements i commented out line 330,
''# port2 = socket.getservbyname(service)'' and replaced it
with the line ''port2 = port''.

Running ''./python Lib/test/test_socket.py'' now yields:
testGetServBy (__main__.GeneralModuleTests) ... ok
.
.
.
----------------------------------------------------------------------
Ran 58 tests in 5.181s

OK
Located the code for ''socket_getservbyname'' in
''Modules/socketmodule.c'' where the call to the glibc
function ''getservbyname'' is made:

Py_BEGIN_ALLOW_THREADS
sp = getservbyname(name, proto);
Py_END_ALLOW_THREADS
if (sp == NULL) {
PyErr_SetString(socket_error, "service/proto not found");
return NULL;
}
The only call of socket.getservbyname that failed was when
it was passed the single argument. Since the error message
"service/proto not found" seems to only be generated upon
failure of gibc''s ''getservbyname'' could it be that
''PyArg_ParseTuple(args, "s|s:getservbyname", &name, &proto)''
generates values for ''name'' and/or ''proto'' that cause the
failure?

My search for prior reports of failure at line 330 found
a mention of problems at line 331.

Well, at any rate, if someone could point me down the
correct path on this i would appreciate it.



从源代码编译需要你指出你想要编译的功能。没有线程支持,套接字不起作用,所以它

看起来你需要配置线程.IIRC你通过编辑

模块来做到这一点。文件。


问候

Steve


Compiling from source requires you to indicate the features that you
want compiled in. Without thread support, sockets din''t work, so it
looks like you need to configure threads in. IIRC you do this by editing
the Modules.? file.

regards
Steve


Steve Holden< st *** @ holdenweb。 COM>写道:
Steve Holden <st***@holdenweb.com> wrote:
x2***@mailcity.com 写道:
hi全部,

Linux 2.4.28
Glibc 2.2.5
gcc 2.95.3

我是Python新手。

我从tar文件中编译了Python 2.4。

运行''make test''我在test_socket中失败了

<运行''./ python Lib / test / test_socket.py''产生:

====================== ============================ ==================== />错误:testGetServBy(__ main __。GeneralModuleTests)
------------------------------------ ----------------------------------
Traceback(最近一次电话会议):
文件Lib / test / test_socket.py,第330行,在testGetServBy中
port2 = socket.getservbyname(服务)
错误:service / proto not found

- -------------------------------------------------- ------------------
在3.826s中进行58次测试

服务的价值是白天。

经过多次手工拧紧,编辑和使用''print''
语句后,我注释掉第330行,
''#port2 = socket.getservbyname(service)' '并用''port2 = port''替换它。

运行''。/ python Lib / test / test_socket.py''现在产生:

testGetServBy(__ main __。GeneralModuleTests)... ok



------------------ -------------------------------------------------- -
在5.181s中进行58次测试

OK


''Modules / socketmodule.c中找到''socket_getservbyname''的代码''glibc
函数''getservbyname''的调用是:

Py_BEGIN_ALLOW_THREADS
sp = getservbyname(name,proto);
Py_END_ALLOW_THREADS
if(sp == NULL){
PyErr_SetString(socket_error,service / proto not found);
返回NULL;
}

唯一一次失败的socket.getservbyname调用是
它传递了单个参数。由于错误消息
service / proto not found似乎只是在gibc'''getservbyname'失败后才会生成'可能是那个'/'''PyArg_ParseTuple(args," s | s:getservbyname",& name,& proto)''
为''name''和/或'proto''生成导致
失败的值?

我在线搜索先前的失败报告330发现
在第331行提到了问题。

好吧,无论如何,如果有人能指出我正确的道路,我会很感激。
hi all,

Linux 2.4.28
Glibc 2.2.5
gcc 2.95.3
I''m new to Python.

I''ve compiled Python 2.4 from tar file.

When running ''make test'' i''m getting a failure
in test_socket.

Running ''./python Lib/test/test_socket.py'' yields:
================================================== ====================
ERROR: testGetServBy (__main__.GeneralModuleTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "Lib/test/test_socket.py", line 330, in testGetServBy
port2 = socket.getservbyname(service)
error: service/proto not found

----------------------------------------------------------------------
Ran 58 tests in 3.826s

The value of ''service'' was "daytime".

After much hand wringing, editing, and use of ''print''
statements i commented out line 330,
''# port2 = socket.getservbyname(service)'' and replaced it
with the line ''port2 = port''.

Running ''./python Lib/test/test_socket.py'' now yields:
testGetServBy (__main__.GeneralModuleTests) ... ok
.
.
.
----------------------------------------------------------------------
Ran 58 tests in 5.181s

OK
Located the code for ''socket_getservbyname'' in
''Modules/socketmodule.c'' where the call to the glibc
function ''getservbyname'' is made:

Py_BEGIN_ALLOW_THREADS
sp = getservbyname(name, proto);
Py_END_ALLOW_THREADS
if (sp == NULL) {
PyErr_SetString(socket_error, "service/proto not found");
return NULL;
}
The only call of socket.getservbyname that failed was when
it was passed the single argument. Since the error message
"service/proto not found" seems to only be generated upon
failure of gibc''s ''getservbyname'' could it be that
''PyArg_ParseTuple(args, "s|s:getservbyname", &name, &proto)''
generates values for ''name'' and/or ''proto'' that cause the
failure?

My search for prior reports of failure at line 330 found
a mention of problems at line 331.

Well, at any rate, if someone could point me down the
correct path on this i would appreciate it.
Compiling from source requires you to indicate the features that you
want compiled in. Without thread support, sockets din''t work, so it
looks like you need to configure threads in. IIRC you do this by editing
the Modules.? file.



问候史蒂夫


regards
Steve




嗨Steve,


这里是

socketmodule.c的编译行的缩减版,其中包含''socket_getservbyname''

代码:


gcc -pthread -DNDEBUG ...

-c /usr/src/Python-2.4/Modules/socketmodule.c

-o build / temp。 linux-i686-2.4 / socketmodule.o


''-pthread''我需要的线程类型?


我''我仍然好奇为什么只有一个参数的调用才能失败,而另外两个调用

传递两个参数不会失败。


有什么想法吗?

pete jordan

x2164 at

mailcity com
< br $> b $ b -

............



hi Steve,

Here''s a cut down version of the compilation line for
socketmodule.c which contains the ''socket_getservbyname''
code:

gcc -pthread -DNDEBUG ...
-c /usr/src/Python-2.4/Modules/socketmodule.c
-o build/temp.linux-i686-2.4/socketmodule.o

Is ''-pthread'' the type of thread i need?

I''m still curious why only the call with one argument to
''socket.getservbyname'' fails while the two other calls
which pass two arguments don''t fail.

Any ideas?
pete jordan
x2164 at
mailcity com

--
............


x2 *** @ mailcity.com 写道:
大家好,

Linux 2.4.28
Glibc 2.2.5
gcc 2.95.3

我是Python的新手。

我是'我从tar文件编译了Python 2.4。

运行''make test''我在test_socket中失败了
hi all,

Linux 2.4.28
Glibc 2.2.5
gcc 2.95.3
I''m new to Python.

I''ve compiled Python 2.4 from tar file.

When running ''make test'' i''m getting a failure
in test_socket.




两个问题。首先,当您在

交互式提示符下运行时,以下代码会给出什么?:


Py>进口插座

Py> socket.getservbyname(''daytime'')

13


其次,/ etc / services中是否有白天条目?


干杯,

尼克。


-

Nick Coghlan | nc******@email.com |澳大利亚布里斯班

--------------------------------------- ------------------------
http://boredomandlaziness.skystorm.net



Two questions. First, what does the following code give when you run it at the
interactive prompt?:

Py> import socket
Py> socket.getservbyname(''daytime'')
13

Second, is there an entry for ''daytime'' in /etc/services?

Cheers,
Nick.

--
Nick Coghlan | nc******@email.com | Brisbane, Australia
---------------------------------------------------------------
http://boredomandlaziness.skystorm.net


这篇关于test_socket.py失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆