Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Import Text.txt file contents from a windows computer to sagecell.

Hello,

The following code will work on my Linux computer if I use the "/usual path/" in Linux but I cannot get Sage to recognize my Windows path. My code

with open('C:\Users\miram\OneDrive\Documents\Programming\Original.txt", 'r') as f: 
    L = f.readlines()

I have also tried the path

with open('C:\\Users\\miram\\OneDrive\\Documents\\Programming\\Original.txt", 'r') as f: 
        L = f.readlines()

I have also tried the path

 with open('C:\\Text\\22.PE.Orig.List.txt", 'r') as f: 
            L = f.readlines()

and with one backslash.

I get the following error:

IOError: [Errno 2] No such file or directory: 'C:\\Text\\22.PE.Orig.List.txt'

What I want to do, as can be seen, is import a text file into SageMath so that I can work with the list created.

I am following: https://ask.sagemath.org/question/28765/turning-a-txt-file-into-a-list-in-sagemathpython/ and have followed the advice for my Linux machine and have not had a problem. I need to do it on my Windows computer, though.

Import Text.txt file contents from a windows computer to sagecell.

Hello,

The following code will work on my Linux computer if I use the "/usual path/" in Linux but I cannot get Sage to recognize my Windows path. My code

with open('C:\Users\miram\OneDrive\Documents\Programming\Original.txt", 'r') as f: 
    L = f.readlines()

I have also tried the path

with open('C:\\Users\\miram\\OneDrive\\Documents\\Programming\\Original.txt", 'r') as f: 
        L = f.readlines()

I have also tried the path

 with open('C:\\Text\\22.PE.Orig.List.txt", 'r') as f: 
            L = f.readlines()

and with one backslash.

I get the following error:

IOError: [Errno 2] No such file or directory: 'C:\\Text\\22.PE.Orig.List.txt'

What I want to do, as can be seen, is import a text file into SageMath so that I can work with the list created.

I am following: https://ask.sagemath.org/question/28765/turning-a-txt-file-into-a-list-in-sagemathpython/ and have followed the advice for my Linux machine and have not had a problem. I need to do it on my Windows computer, though.

I think my problem is that I am using a sagecell server. Is that true?

Import Text.txt file contents from a windows computer to sagecell.

Hello,

The following code will work on my Linux computer if I use the "/usual path/" in Linux but I cannot get Sage to recognize my Windows path. My code

with open('C:\Users\miram\OneDrive\Documents\Programming\Original.txt", open('C:\Users\miram\OneDrive\Documents\Programming\Original.txt', 'r') as f: 
    L = f.readlines()

I have also tried the path

with open('C:\\Users\\miram\\OneDrive\\Documents\\Programming\\Original.txt", open('C:\\Users\\miram\\OneDrive\\Documents\\Programming\\Original.txt', 'r') as f: 
        L = f.readlines()

I have also tried the path

 with open('C:\\Text\\22.PE.Orig.List.txt", open('C:\\Text\\22.PE.Orig.List.txt', 'r') as f: 
            L = f.readlines()

and with one backslash.

I get the following error:

IOError: [Errno 2] No such file or directory: 'C:\\Text\\22.PE.Orig.List.txt'

What I want to do, as can be seen, is import a text file into SageMath so that I can work with the list created.

I am following: https://ask.sagemath.org/question/28765/turning-a-txt-file-into-a-list-in-sagemathpython/ and have followed the advice for my Linux machine and have not had a problem. I need to do it on my Windows computer, though.

I think my problem is that I am using a sagecell server. Is that true?