Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > does not work on freeBSD but works on linux, and windows

Reply
Thread Tools

does not work on freeBSD but works on linux, and windows

 
 
John fabiani
Guest
Posts: n/a
 
      06-30-2004
Hi,
this is a little strange. All I'm trying to do is ftp a 'dbf' file - but
the file is corrupt after the transfer.

1. the freeBSD 4.4 is a couple of years old using:

Python 2.1.1 (#1, Sep 13 2001, 18:12:15)
[GCC 2.95.3 20010315 (release) [FreeBSD]] on freebsd4
Type "copyright", "credits" or "license" for more information.

2. below is a simple ftp program

import ftplib
import sys
remote=ftplib.FTP(host='myIpAddress',user='usernam e',passwd='password')
mohpac07=open("/usr/home/spx/servplus/outbounds/mohpac07.dbf",'rb')
remote.set_debuglevel(2)
remote.set_pasv(0)
remote.storbinary("STOR mohpac07.dbf",mohpac07,8192)
remote.close
remote.quit

3. below is the output.

*cmd* 'TYPE I'
*put* 'TYPE I\r\n'
*get* '200 Switching to Binary mode.\r\n'
*resp* '200 Switching to Binary mode.'
*cmd* 'PORT 190,10,10,2,14,194'
*put* 'PORT 190,10,10,2,14,194\r\n'
*get* '200 PORT command successful. Consider using PASV.\r\n'
*resp* '200 PORT command successful. Consider using PASV.'
*cmd* 'STOR mohpac07.dbf'
*put* 'STOR mohpac07.dbf\r\n'
*get* '150 Ok to send data.\r\n'
*resp* '150 Ok to send data.'
*get* '226 File receive OK.\r\n'
*resp* '226 File receive OK.'


I then test the dbf file by attemping to open the file with foxpro and
the file is corrupt (not a table). The strange thing the same code
works from XP, and Linux (both are python 2.3). I don't know much about
freeBSD and I'm not sure if I can install 2.3.

Anybody no why this is happening?

TIA
John
 
Reply With Quote
 
 
 
 
David Bolen
Guest
Posts: n/a
 
      06-30-2004
John fabiani <(E-Mail Removed)> writes:

> 2. below is a simple ftp program
>
> import ftplib
> import sys
> remote=ftplib.FTP(host='myIpAddress',user='usernam e',passwd='password')
> mohpac07=open("/usr/home/spx/servplus/outbounds/mohpac07.dbf",'rb')
> remote.set_debuglevel(2)
> remote.set_pasv(0)
> remote.storbinary("STOR mohpac07.dbf",mohpac07,8192)
> remote.close
> remote.quit


Just a shot in the dark, but if your last two lines are accurate,
you're simply referencing the close and quit names within the ftplib
object, but aren't actually calling them. Also, quit() includes the
close operation, so I think you'd want that to end with:

remote.quit()

Note that your log never shows the Goodbye during a clean exit from
the server.

It's possible that the platform differences you are seeing has to do
with differences in buffering at the application and/or protocol stack
layer and perhaps how stranded data is handled during process/socket
shutdown. It's possible that the final portion of the data related to
the STOR is never getting transmitted to the remote ftp server.

-- David
 
Reply With Quote
 
 
 
 
Oliver Fromme
Guest
Posts: n/a
 
      06-30-2004
John fabiani <(E-Mail Removed)> wrote:
> 1. the freeBSD 4.4 is a couple of years old using:
> Python 2.1.1 (#1, Sep 13 2001, 18:12:15)


FreeBSD 4.4 is quite old, and I would strongly recommend
upgrading, especially if the machine is connected to a
network. The latest stable release of FreeBSD is 4.10.
It also comes with the latest version of Python (2.3.4),
both as a ready-made binary package and as a "port" for
easy compilation.

I suggest you upgrade that machine. I'm sure the problem
won't persist.

Best regards
Oliver

--
Oliver Fromme, Konrad-Celtis-Str. 72, 81369 Munich, Germany

``All that we see or seem is just a dream within a dream.''
(E. A. Poe)
 
Reply With Quote
 
John fabiani
Guest
Posts: n/a
 
      06-30-2004
Oliver Fromme wrote:

> John fabiani <(E-Mail Removed)> wrote:
> > 1. the freeBSD 4.4 is a couple of years old using:
> > Python 2.1.1 (#1, Sep 13 2001, 18:12:15)

>
> FreeBSD 4.4 is quite old, and I would strongly recommend
> upgrading, especially if the machine is connected to a
> network. The latest stable release of FreeBSD is 4.10.
> It also comes with the latest version of Python (2.3.4),
> both as a ready-made binary package and as a "port" for
> easy compilation.
>
> I suggest you upgrade that machine. I'm sure the problem
> won't persist.
>
> Best regards
> Oliver
>

Thanks for your reply. Can freeBSD support python 2.3? And if it does
how do I install it.
John
 
Reply With Quote
 
Oliver Fromme
Guest
Posts: n/a
 
      06-30-2004
John fabiani <(E-Mail Removed)> wrote:
> Thanks for your reply. Can freeBSD support python 2.3?


Yes, it's a standard package in FreeBSD 4.10.

> And if it does
> how do I install it.


First you should remove your old version of python, in order
to avoid any potential pitfalls. Use the pkg_delete command
for that purpose.

To install the precompiled binary package for FreeBSD 4.10,
perform this command as root:

pkg_add -r python

If you prefer to fetch the source code and compile it your-
self, type these commands as root (provided that you have
installed the ports collection, which really is strongly
recommended):

cd /usr/ports/lang/python
make install
make clean

For more details on the pkg_add(1) command, please refer to
its manual page. For more information on the FreeBSD ports
collection, please refer to the appropriate chapter in the
Handbook.

Best regards
Oliver

--
Oliver Fromme, Konrad-Celtis-Str. 72, 81369 Munich, Germany

``All that we see or seem is just a dream within a dream.''
(E. A. Poe)
 
Reply With Quote
 
Till Plewe
Guest
Posts: n/a
 
      06-30-2004
On Wed, Jun 30, 2004 at 02:01:23PM +0000, John fabiani wrote:
> Oliver Fromme wrote:
>
> >John fabiani <(E-Mail Removed)> wrote:
> > > 1. the freeBSD 4.4 is a couple of years old using:
> > > Python 2.1.1 (#1, Sep 13 2001, 18:12:15)

> >
> >FreeBSD 4.4 is quite old, and I would strongly recommend
> >upgrading,


....

> Thanks for your reply. Can freeBSD support python 2.3?


yes

> And if
> it does how do I install it.


1) cd /usr/ports/lang/python; make install clean

or install portupgrade first

2) cd /usr/ports/sysutils/portupgrade; make install clean
portinstall python;

but to upgrade freebsd you should have a look at the handbook
at www.freebsd.org.

- Till

 
Reply With Quote
 
Donn Cave
Guest
Posts: n/a
 
      07-01-2004
Quoth Oliver Fromme <(E-Mail Removed)>:
| John fabiani <(E-Mail Removed)> wrote:
|> 1. the freeBSD 4.4 is a couple of years old using:
|> Python 2.1.1 (#1, Sep 13 2001, 18:12:15)
|
| FreeBSD 4.4 is quite old, and I would strongly recommend
| upgrading, especially if the machine is connected to a
| network. The latest stable release of FreeBSD is 4.10.
| It also comes with the latest version of Python (2.3.4),
| both as a ready-made binary package and as a "port" for
| easy compilation.
|
| I suggest you upgrade that machine. I'm sure the problem
| won't persist.

Wow, I'm surprised to hear that. I will have to go back
and read the problem again, but it sounds like a very
ordinary application in terms of operating system support.
Not something that would expose a bug in FreeBSD 4.4.
What makes you think it's an OS bug?

Donn Cave, http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
Oliver Fromme
Guest
Posts: n/a
 
      07-01-2004
Donn Cave <(E-Mail Removed)> wrote:
> Quoth Oliver Fromme <(E-Mail Removed)>:
> | [...]
> | I suggest you upgrade that machine. I'm sure the problem
> | won't persist.
>
> Wow, I'm surprised to hear that. I will have to go back
> and read the problem again, but it sounds like a very
> ordinary application in terms of operating system support.
> Not something that would expose a bug in FreeBSD 4.4.
> What makes you think it's an OS bug?


By saying "upgrade" I meant both the OS and Python.
From his description, it seemed to be some kind of data
corruption, which could very well be an OS issue or a
Python issue (in libftp, for example). His application
code seemed to be correct, as far as I can tell.

That's all speculation of course, but even if the problem
persists with an up-to-date OS and Python, the update was
certainly not useless.

Best regards
Oliver

--
Oliver Fromme, Konrad-Celtis-Str. 72, 81369 Munich, Germany

``All that we see or seem is just a dream within a dream.''
(E. A. Poe)
 
Reply With Quote
 
John fabiani
Guest
Posts: n/a
 
      07-01-2004
Oliver Fromme wrote:
> Donn Cave <(E-Mail Removed)> wrote:
> > Quoth Oliver Fromme <(E-Mail Removed)>:
> > | [...]
> > | I suggest you upgrade that machine. I'm sure the problem
> > | won't persist.
> >
> > Wow, I'm surprised to hear that. I will have to go back
> > and read the problem again, but it sounds like a very
> > ordinary application in terms of operating system support.
> > Not something that would expose a bug in FreeBSD 4.4.
> > What makes you think it's an OS bug?

>
> By saying "upgrade" I meant both the OS and Python.
> From his description, it seemed to be some kind of data
> corruption, which could very well be an OS issue or a
> Python issue (in libftp, for example). His application
> code seemed to be correct, as far as I can tell.
>
> That's all speculation of course, but even if the problem
> persists with an up-to-date OS and Python, the update was
> certainly not useless.
>
> Best regards
> Oliver
>

I can't really update the OS because the main app on the server is using
SCO foxpro 2.6. This means that the OS is using the special lib's
reqired for SCO (xenix,unix libs) to run foxpro 2.6.

Anyway I know very little about FreeBSD. In fact I'll have to learn how
to upgrade Python 2.1 to Python 2.3. Of course this assumes that
problem has something to do with Python and not the under lying SO. BTW
FTP works without any issues - at least manually. Also the code I
provided is what is realy run on the computer.

Question can I just update the ftplib module? I'm thinking that might
be easier than attempt to update all of it to 2.3.

John
 
Reply With Quote
 
Donn Cave
Guest
Posts: n/a
 
      07-01-2004
In article <w5XEc.82372$(E-Mail Removed) >,
John fabiani <(E-Mail Removed)> wrote:
....
> I can't really update the OS because the main app on the server is using
> SCO foxpro 2.6. This means that the OS is using the special lib's
> reqired for SCO (xenix,unix libs) to run foxpro 2.6.
>
> Anyway I know very little about FreeBSD. In fact I'll have to learn how
> to upgrade Python 2.1 to Python 2.3. Of course this assumes that
> problem has something to do with Python and not the under lying SO. BTW
> FTP works without any issues - at least manually. Also the code I
> provided is what is realy run on the computer.
>
> Question can I just update the ftplib module? I'm thinking that might
> be easier than attempt to update all of it to 2.3.


It wouldn't hurt to try, and sure wouldn't hurt to look at
what has changed - if anything.

Before embarking on a more complicated upgrade, it would
probably be worth a further look at your software. If you
missed it, go back and find David Bolen's response to your
post. If your ftp function isn't already a stand-alone program,
break it out into a stand-alone program and see if it works any
different. Look at the result file and see if you can see
specifically what's different - "it's corrupted" isn't much
to go on. BSD will work differently in some subtle ways than
Linux, and that probably won't change from FreeBSD 4.4 to 4.10 -
not all differences from Linux and Windows are bugs.

Donn Cave, (E-Mail Removed)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
simple socket client-server interaction works on C, but the analogouscode does not work with Perl Mark_Galeck Perl Misc 3 08-16-2009 06:59 PM
<img onload= does not work in FireFox 1.0 but works in IE Luke Venediger Javascript 3 03-08-2005 08:15 PM
Webservice works once and then DOES NOT seem to work even though program does not crash Phi! ASP .Net Web Services 1 04-23-2004 08:42 AM
c extension works in Linux but not Windows==>?? ImportError: dynamic module does not define init function (initpeak_load) Christian Seberino Python 2 02-12-2004 10:08 PM
Why this javascript function does not work on IE5, but works on IE6? Andrzej Javascript 0 10-06-2003 04:21 PM



Advertisments