Bugs item #1455357, was opened at 2006-03-21 08:08 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1455357&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Michael Yanowitz (yanowitz) Assigned to: Nobody/Anonymous (nobody) Summary: Incompatible size for long (int) in Python Win and Linux? Initial Comment: There appears to be a problem with packing/unpacking long (and int) values when sending data from Windows to Linux. I am not sure if it is a bug or just due to incompatibleness. Normally we think of long as being 4 bytes. However, on Linux, it might be 8 bytes (in Python). Here are good results in Windows, packing and unpacking a long: $ python Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import struct >>> p = struct.pack("L", 12345) >>> p '90\x00\x00' >>> u = struct.unpack("L",p) >>> u (12345L,) However, on Linux, I get slightly different results: Python 2.4.1 (#1, May 16 2005, 15:15:14) [GCC 4.0.0 20050512 (Red Hat 4.0.0-5)] on linux2 Type "help", "copyright", "credits" or "license" for more information>>> import struct >>> p = struct.pack("L", 12345) >>> p '90\x00\x00\x00\x00\x00\x00' >>> u = struct.unpack("L",p) >>> u (12345L,) This is annoying, because I want to be able to send data from Windows to Linux (and vice-versa) over a socket. I am new to Python, and the only way I know of of doing that is by packing and unpacking the data. Please email me [EMAIL PROTECTED] if this isn't a bug or there is a known work-around for this problem. Thanks in advance: Michael Yanowitz ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1455357&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com