portable python

mblume mblume at socha.net
Fri Oct 24 15:28:53 EDT 2008


Am Fri, 24 Oct 2008 11:33:33 -0700 schrieb asit:

> On Oct 24, 11:18 pm, "Jerry Hill" <malaclyp... at gmail.com> wrote:
>> On Fri, Oct 24, 2008 at 1:42 PM, asit <lipu... at gmail.com> wrote:
>> > I code in both windows and Linux. As python is portable, the o/p
>> > should be same in both cases. But why the following code is perfect
>> > in windows but error one   in Linux ???
>>
>> What error message do you get in linux?  How are you running your code
>> in linux?  Your code seems to generally work on my Ubuntu linux box, so
>> you need to give us more information.
>>
>> --
>> Jerry
> 
> this the o/p
> lipu at lipu-desktop:~/hack$ python portscan.py 59.93.128.10 10 20
> Traceback (most recent call last):
>   File "portscan.py", line 33, in <module>
>     print str(port) + " : " + scan(ip,port,timeout)
>   File "portscan.py", line 22, in scan
>     return status[result]
> KeyError: 11
> lipu at lipu-desktop:~/hack$

Python is certainly portable, but ino order to do its job, it relies
on the underlying OS and libraries to work, which may be different from OS
to OS. The status message you define in your code 
(e.g. 10056:"already connected") seem to be specific to Windows, IIRC. 

HTH
Martin



More information about the Python-list mailing list