# Import file from FTP site

I would like to Import files from an FTP site. The code below works on a test site:

file = Import["ftp://test:test@ftp.secureftp-test.com/pigs.xml"];


But when I try to Import from a commercial site using similar code:

file = Import["ftp://user:pwrd@hosted.datascope.reuters.com/fldr/fname.csv"]


I get "FetchURL::conopen: The connection to URL [address above] cannot be opened. If the URL is correct, you might need to configure your firewall program, or you might need to set a proxy in the Internet connectivity tab of the Preferences dialog (or by calling SetInternetProxy). For HTTPS connections, you might need to inspect the authenticity of the server's SSL certificate and choose to accept it."

If I paste the same ftp string into a browser it loads the file I want. What's wrong here?

@halirutan-I think I am using the correct user name and password.
@J.M.-I'm using Win7.
@celtschi-I saw a the back slash too at some point. I think I deleted it to get the browser to work; don't remember clearly.
@all-Thanks for all this effort. I'm trying to digest this feedback.
@all-Tried again with various combinations of Element specifications with no success.
Also attempted to get a file list with no success.

• But you used the correct user and pwrd in the second example? You tried it in your browser after you deleted the cache with stored data and passwords? Can you maybe give an example with a real user and passwd combination which we may try here? – halirutan Sep 17 '12 at 2:14
• I just tried it with a file on my website and it worked. Is it possible, that it has something to do with this special website of yours? – halirutan Sep 17 '12 at 2:20
• What OS are you using? I get similar errors in Ubuntu Oneiric when trying to retrieve ExampleData[], e.g. ExampleData[{"Matrix", "WEST0479"}], since ExampleData[] seems to try to import things via FTP from the Matrix Market. – J. M.'s ennui Sep 17 '12 at 2:38
• @J.M. I have the same behavior on my Ubuntu 64 and MacOSX. – halirutan Sep 17 '12 at 10:35
• @J.M. Your pasted filename string still has one (or more) non-displayable chars in there. The last 8 bytes I see are 00000047h: 3F 3F 6D 74 78 2E 67 7A, but you may get another thing instead of those 3F 3F – Dr. belisarius Sep 17 '12 at 11:56

Here is the solution that worked for with the west0479.mtx example. I had the same behavior as pointed out in the comments which means both, ExampleData[{"Matrix", "WEST0479"}] and

Import["ftp://math.nist.gov/pub/MatrixMarket2/Harwell-Boeing/chemwest/west0479.mtx.gz"]


timed out with a FetchURL::conopen message.

Since my internet connectivity was fine (Edit->Preferences->Internet Connectivity->Test Internet Connectivity) I did a clean start of Mathematica. Here in Linux this goes by starting Mathematica from the console with -cleanstart option.

Import["ftp://math.nist.gov/pub/MatrixMarket2/Harwell-Boeing/chemwest/west0479.mtx.gz",
"Graphics"]


All credits for this go to the Wolfram support.

• I can confirm this worked in a fresh session (without needing a "clean start") under Mac OS x 10.8 – Verbeia Sep 24 '12 at 11:39