sftp error

244 views
Skip to first unread message

Bel

unread,
Jan 21, 2015, 10:13:32 AM1/21/15
to bots...@googlegroups.com
Hi there,

Could you please help me identify the cause for the following error? The file was processed and sent successfully but every time it went through this channel, an error message was generated. How do I get rid of it?

Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\bots\communication.py", line 1414, in outcommunicate
    tofile.write(fromfile.read())
  File "C:\Python27\lib\site-packages\paramiko\file.py", line 339, in write
    self._write_all(data)
  File "C:\Python27\lib\site-packages\paramiko\file.py", line 456, in _write_all
    count = self._write(data)
  File "C:\Python27\lib\site-packages\paramiko\sftp_file.py", line 176, in _write
    self._reqs.append(self.sftp._async_request(type(None), CMD_WRITE, self.handle, long(self._realpos), data[:chunk]))
TypeError: long() argument must be a string or a number, not 'NoneType

Thanks,
Bel

henk-jan ebbers

unread,
Jan 21, 2015, 11:13:39 AM1/21/15
to bots...@googlegroups.com
hi Bel,

this is in the paramiko code (as you probably figured out).
I have never seen this error before.

it happens when files are send to the sftp/ssh server
are you sure all things are OK?

for some reason self._realpos is not OK.
might it be these are files with zero-length (just an idea)?

kind regards,
henk-jan
> --
> You received this message because you are subscribed to the Google Groups "Bots Open Source EDI Translator" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to botsmail+u...@googlegroups.com <mailto:botsmail+u...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Tom Westrick

unread,
Apr 9, 2015, 11:17:20 AM4/9/15
to bots...@googlegroups.com
Bel,

Were you able to figure this out? I am getting the exact error.

-Tom

Tom Westrick

unread,
Apr 10, 2015, 10:48:38 AM4/10/15
to bots...@googlegroups.com
I figured it out. Our VAN, GXS, doesn't support creating a file and then writing to it on their server. I created a communication script that overrides the outcommunication method for SFTP. I changed it to use the put command instead of open/write.

-Tom

henk-jan ebbers

unread,
Apr 10, 2015, 10:58:24 AM4/10/15
to bots...@googlegroups.com
hai Tom,

that is interesting!
can you send that change/patch, to see if it is 'general' usuable?

kind regards,
henk-jan
> > For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout>.

Tom Westrick

unread,
Apr 10, 2015, 11:11:34 AM4/10/15
to bots...@googlegroups.com
It should be usable. I took your code and just modified it. See attached for the file.

-Tom
gxs_upload.py

Gerhard Peters

unread,
Oct 12, 2017, 11:48:29 AM10/12/17
to Bots Open Source EDI Translator
Tom,
So how do I use the script you provided here. Keep in mind that we will have more than one sftp connection. Mind says that it is an authentication problem so maybe that is not the same problem

Tom Westrick

unread,
Oct 12, 2017, 1:08:24 PM10/12/17
to bots...@googlegroups.com
This script is for uploading files to GXS. It is a user script for the channel. Name the file whatever your GXS out channel is called and choose SFTP as the type. You should then see a "view" next to the user script.

I see you are getting an authentication error in your GXS IN channel so it would be a different issue. Maybe wrong username or password :)

-Tom

On Thu, Oct 12, 2017 at 11:48 AM, Gerhard Peters <gerha...@gmail.com> wrote:
Tom,
So how do I use the script you provided here. Keep in mind that we will have more than one sftp connection. Mind says that it is an authentication problem so maybe that is not the same problem

--
You received this message because you are subscribed to the Google Groups "Bots Open Source EDI Translator" group.
To unsubscribe from this group and stop receiving emails from it, send an email to botsmail+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/botsmail.

Gerhard Peters

unread,
Oct 12, 2017, 5:53:25 PM10/12/17
to Bots Open Source EDI Translator
Tom,
I will try this once I can authenticate

Gerhard Peters

unread,
Oct 13, 2017, 3:58:28 PM10/13/17
to Bots Open Source EDI Translator
Tom,
Now that we have it working with GXS we just tried sending an x12 file to them and it worked. No script needed. Perhaps you did something else. Here is out outgoing channel


Tom Westrick

unread,
Oct 13, 2017, 4:16:37 PM10/13/17
to bots...@googlegroups.com
Nice! Looks like you are connecting to a different server so maybe that server is set up differently than the one we were using.

-Tom

Alexander

unread,
Oct 12, 2018, 11:10:06 AM10/12/18
to Bots Open Source EDI Translator
Hi Tom,
hi all,

this script helped me passing the above mentioned error.
Thank you for that.

But then i got another one:

errortext: Traceback (most recent call last):

  File "C:\Python27\lib\site-packages\bots\botslib.py", line 333, in wrapper

    terug = func(*args,**argv)

  File "C:\Python27\lib\site-packages\bots\communication.py", line 84, in run

    comclass.run()

  File "C:\Python27\lib\site-packages\bots\communication.py", line 108, in run

    self.connect()

  File "C:\Python27\lib\site-packages\bots\communication.py", line 1421, in connect

    self.set_cwd()

  File "C:\Python27\lib\site-packages\bots\communication.py", line 1431, in set_cwd

    self.session.mkdir(self.dirpath)

  File "C:\Python27\lib\site-packages\paramiko\sftp_client.py", line 427, in mkdir

    self._request(CMD_MKDIR, path, attr)

  File "C:\Python27\lib\site-packages\paramiko\sftp_client.py", line 780, in _request

    return self._read_response(num)

  File "C:\Python27\lib\site-packages\paramiko\sftp_client.py", line 832, in _read_response

    self._convert_status(msg)

  File "C:\Python27\lib\site-packages\paramiko\sftp_client.py", line 865, in _convert_status

    raise IOError(text)

IOError: The operation failed


In my sftp.log i have the following:

INF [20181011-11:05:52.963] thr=2   paramiko.transport.sftp: [chan 0] Opened sftp connection (server version 3)
DEB [20181011-11:05:52.963] thr=2   paramiko.transport.sftp: [chan 0] stat('.')
DEB [20181011-11:05:53.102] thr=2   paramiko.transport.sftp: [chan 0] normalize('.')
DEB [20181011-11:05:53.243] thr=2   paramiko.transport.sftp: [chan 0] stat('/SomeDirectory/*BIN')
DEB [20181011-11:05:53.384] thr=2   paramiko.transport.sftp: [chan 0] mkdir('/SomeDirectory/*BIN', 511)
DEB [20181011-11:05:54.134] thr=3   paramiko.transport: EOF in transport thread

So it seems like Bots can't handle the path, that GXS requires me to upload the files in.
It can't find it and tries to create it..
The path looks somethink like /SomeDirectory/*BIN.
Without the *BIN it would work for BOTS (then i don't get the error) but not for GXS.
When i try to upload the files manually with WinSCP i can without any problems change to the requiered directory and upload the files.

@Tom: Does your path look similar?
What did you do to get it working?

Maybe anyone else has an idea?

Thanks to all in advance!


Kind regards
- Alexander

Eppye Bots

unread,
Oct 12, 2018, 11:21:41 AM10/12/18
to 'Chuck Turco' via Bots Open Source EDI Translator
think this is GXS?
what do you use as path in bots channel setting?


kind regards, Henk-Jan Ebbers


To unsubscribe from this group and stop receiving emails from it, send an email to botsmail+u...@googlegroups.com.

Tom Westrick

unread,
Oct 12, 2018, 11:28:25 AM10/12/18
to bots...@googlegroups.com
Unfortunately we don't use GXS anymore and I don't remember what we used for the path. Looking at my communication with GXS Support, it looks like you just upload to the root directory and they handle it on their end.

-Tom

Alexander

unread,
Oct 12, 2018, 11:37:09 AM10/12/18
to Bots Open Source EDI Translator
Hi Henk-Jan,

thank you.
Yes, this is GXS.
I use /ALDIS_DE_TSMG/*BIN as path in channel setting.

@Tom
Thank you.
Hm, we have to upload to a different directory.


King regards,
- Alexander

Eppye Bots

unread,
Oct 12, 2018, 11:46:47 AM10/12/18
to 'Chuck Turco' via Bots Open Source EDI Translator
try ALDIS_DE_TSMG/*BIN


kind regards, Henk-Jan Ebbers

Alexander

unread,
Oct 15, 2018, 9:50:57 AM10/15/18
to Bots Open Source EDI Translator
Hi Henk-Jan,

I have tried this and it worked, thank you!
But is this a special behavior of GXSs SFTP server(s)?
I always started my path with a leading / and never ran into problems.

Kind regards,
- Alexander

Eppye Bots

unread,
Oct 15, 2018, 9:56:37 AM10/15/18
to 'Chuck Turco' via Bots Open Source EDI Translator
hard to say.

GXS is very typical.
always has been.

kind regards, Henk-Jan Ebbers

BikeMike

unread,
Oct 16, 2018, 4:01:56 AM10/16/18
to Bots Open Source EDI Translator
so directory name is *BIN, how is this a legal name?
perhaps i it already existed first, it would work, but doing the MKDIR fails.

Alexander

unread,
Oct 16, 2018, 4:38:39 AM10/16/18
to Bots Open Source EDI Translator
Hi Mike,

I don't know.
What's also very interesting and odd is that i can change into any fictional directory underneath the ALDIS_DE_TSMG directory.
At least with WinSCP, probably with Bots, too..
So when i type e.g. ALDIS_DE_TSMG/hsdgf4sd3515fds4s or any other random stuff, WinSCP changes into that directory without any complain.
Using something instead of ALDIS_DE_TSMG results in an "Invalid path" error.

Kind regards,
- Alexander
Reply all
Reply to author
Forward
0 new messages