PROBLEM SOLVED BY RETYPING
I am suddenly no longer able to find files in c# or python. I have a simple program that attempts to read a file in both c# and python.
I have posted both c# and python code, as I think this problem probably is not in the actual code but in some system configuration on my computer. Has anyone experienced something similar and know what the cause of this issue may be?
Thank you in advance, code follows below:
When I run the following c# code, it appears that c# is reading @"?C:Users
klaDesktoplookingForMe.txt"
as
'C:Users
klasource
eposConsoleApp1ConsoleApp1inDebug
etcoreapp3.1?C:Users
klaDesktoplookingForMe.txt''
string testValue = @"?C:Users
klaDesktoplookingForMe.txt";
var enumLines = File.ReadLines(testValue);
Error received:
System.IO.IOException: 'The filename, directory name, or volume label syntax is incorrect. : 'C:Users
klasource
eposConsoleApp1ConsoleApp1inDebug
etcoreapp3.1?C:Users
klaDesktoplookingForMe.txt''
when I attempt the same thing in python, I also get an error.
Python program:
files = r"?C:Users
klaDesktoplookingForMe.txt"
f = open(files, "r")
contents = f.read()
print(contents)
output:
"C:Program FilesArcGISProinPythonenvsarcgispro-py3python.exe" "C:/Users/nkla/Desktop/ArcGIS Python Projects/Module01/test.py"
Traceback (most recent call last):
File "C:/Users/nkla/Desktop/ArcGIS Python Projects/Module01/test.py", line 3, in
f = open(files, "r")
OSError: [Errno 22] Invalid argument: 'u202aC:Users
klaDesktoplookingForMe.txt'
question from:
https://stackoverflow.com/questions/65840931/c-sharp-and-python-no-longer-able-to-find-files 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…