Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
    
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
3  
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. 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
    
I just tried it with the ExampleData, too, and also got an error (Linux). However when I copied the URL into a browser, I noticed that before the file, there was an extra backslash which isn't displayed; fetching that URL from the browser failed (error 500) while without the slash it worked (for reference, the URL as copy/pasted is ftp://math.nist.gov/pub/MatrixMarket2/Harwell-Boeing/chemwest/\ west0479.mtx.gz). Further pasting into a terminal reveals that actually it's an escaped newline character (the browser removed the newline character, but not the `\`). Without that, the URL works. –  celtschk Sep 17 '12 at 10:56

1 Answer 1

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"]

Mathematica graphics

All credits for this go to the Wolfram support.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.