Share

PyS60

Tracker: Bugs

5 error import socket because e32socket error - ID: 1760277
Last Update: Comment added ( jplauril )

We use Python For S60 1.4.0 SDK 3rdEd (Python ForS60_1_4_0_SDK_3rdEd.zip
taked from SourceForge)
Tested in Emulator S60 3rd Edition FP1 (Symbian 9.2)

Can“t import the module "socket" , obtaining the error "No Module named
e32socket".
(e32socket.pyd exist and the same aplication run ok in pys60 1.2 (for 2nd
Ed)).

Although, it seems that it is failing only the first time when trying to
import socket and consecutively when running same script again it works.

The thread is here:
http://discussion.forum.nokia.com/forum/showthread.php?t=111359&highlight=e
32socket

Thank you, and excuse me for my poor english.

Regards.


TotoRaf ( totoraf ) - 2007-07-25 13:07

5

Open

Accepted

Nobody/Anonymous

socket

None

Public


Comments ( 11 )

Date: 2009-01-07 08:59
Sender: jplaurilProject Admin

Can anyone else replicate this?


Date: 2009-01-06 23:19
Sender: ecostanza

Hello.

I tried using PythonForS60_1_4_5_SDK_3rdEdFP1.zip and
PythonForS60_1_4_5_SDK_3rdEd.zip but with either of them and
S60_3rd_FP2_SDK_v1.1 I get the same problem.

Enrico



Date: 2008-12-12 07:34
Sender: jplaurilProject Admin

Note that there's a binary compatibility break between the 3.0 and 3.1 SDKs
that affects the socket module. As a result we've made a separate 3.1 build
of the SDK available - you should use that on 3.1+.



Date: 2008-12-12 02:03
Sender: blfgomes

It looks like this is a regression in 1.4.5. I installed 1.4.4 and it
worked fine.


Date: 2008-12-12 01:41
Sender: blfgomes

Any news on this one?
I can't import urllib because of this e32socket bug.
I'm using S60 3rd Edition SDK for Symbian OS, Feature Pack 2 v1.1 and
PythonForS60 1.4.5.



Date: 2008-04-24 11:10
Sender: jplaurilProject Admin


Reproduced. We'll need to investigate if there's some binary compatibility
break between the 3.0 and 3.1 emulators.


Date: 2008-01-30 04:19
Sender: sharkeyzoic


Okay, just confirming that a similar bit of code (which establishes a TCP
connection using socket) works fine when run on the N95 but has the same
problem on the emulator.

Haven't tried 2nd edition (yet)

-----sharks

-----8<-----cut here-----8<-----
import socket

apid = socket.select_access_point()
apo = socket.access_point(apid)
socket.set_default_access_point(apo)

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('zoic.org', 80))
s.send('GET /TESTING/\r\n\r\n')
s.recv(100)
s.close()

apo.stop()
----->8-----cut here----->8-----


Date: 2008-01-29 22:59
Sender: sharkeyzoic


G'day,

I'm having this problem too, and the workaround of importing socket
twice doesn't actually work ... you end up with the broken stub of the
socket library left over from the first import.

Here's the code which produces the error:

-----8<-----cut here-----8<-----
import socket

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
----->8-----cut here----->8-----

The problem occurs with PyS60 1.4.2 final and the emulator of SDK 3rd
edition FP1 and FP2 beta, when the script is run from the python app. To
install, I just unzipped the PyS60 "Epoc32" directory over
C:\Symbian\9.2\S60_3rd_FP1\Epoc32\ ... is this not correct? Perhaps
there's a step I missed?

Interestingly, Ensymble makes a SIS file just fine, and that file will
load without errors on an actual N95. Not that the version attached does
anything, mind you. I'll try and write one which does and comment again
...

-----8<-----cut here-----8<-----
Version 1.4.2 final

*** RUN socket_test.py FROM THE PYTHON APP Options >> Run Script

Traceback (most recent call last):
File "c:\private\2000b1a5\default.py", line 81, in menu_action f()
File "c:\private\2000b1a5\default.py", line 65, in query_and_exec
execfile(script_list[index][1].encode['utf-8'],
script_namespace.namespace)
File "c:\python\socket_test.py", line 1 in ?
import socket
File "c:\resource\site.py", line 97, in patsec_import
return _original_import(name, globals, locals, fromlist)
File "c:\resource\socket.py", line 18 in ?
from e32socket import *
File "c:\resource\site.py", line 112, in platsec_import
raise ImportError("No module named"+name)
ImportError: No modules named e32socket

*** RUN socket_test.py AGAIN

Traceback (most recent call last):
File "c:\private\2000b1a5\default.py", line 81, in menu_action f()
File "c:\private\2000b1a5\default.py, line 65, in query_and_exec
execfile(script_list[index][1]).encode('utf-8'),
script_namespace.namespace)
File "c:\python\socket_test.py", line 3 in ?
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
AttributeError: 'module' object has no attribute 'socket'

*** RUN INTERACTIVE CONSOLE

>>> import sys
>>> sys.path
['c:\\private\\2000b1a5', 'c:\\resource']
>>> socket.__dict__.keys()
['__builtins__','__name__','__file__','__doc__']
>>>
----->8-----cut here----->8-----

Anyhoo, this is a show-stopper for PyS60 and me ... I'll have to go back
to the godawful C++ APIs if the problem can't be solved.

-----sharks


Date: 2007-11-28 21:23
Sender: miohtama


Could you please post e32socket.pyd here?


Date: 2007-11-27 14:36
Sender: miohtama


To get rid of the warning (doesn't fix the problem):

try:
import socket # This fails first time
except:
pass

import socket # Import succeed on the second time... wtf


Date: 2007-09-30 18:02
Sender: mobilenomad


Second import didn't help me. I couldn't use any of the socket.* methods.


This seems to be an issue with the S60 3rd Edition FP1 emulator as the
same Python SDK works fine with the 3rd Edition MR.

As a workaround fix do the following (for S60 3rd Edition FP1):
1. Download the pys60 source & unzip
2. setup.py configure 30
3. cd ext\socket\
4. bldmake bldfiles
5. abld build winscw udeb
6. copy \epoc32\release\winscw\udeb\e32socket.pyd to
\epoc32\winscw\c\sys\bin
-> import socket works!



Attached File

No Files Currently Attached

Changes ( 5 )

Field Old Value Date By
resolution_id Remind 2008-04-24 11:10 jplauril
assigned_to otsov 2008-04-24 11:10 jplauril
resolution_id None 2008-04-17 07:01 hiagarwa
artifact_group_id wont-fix-for-1.4 2007-10-23 09:06 jplauril
assigned_to janimr 2007-10-23 09:06 jplauril