Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV.write somehow cannot write file with name con.csv in Windows?! #1111

Open
mzy2240 opened this issue Aug 22, 2023 · 5 comments
Open

CSV.write somehow cannot write file with name con.csv in Windows?! #1111

mzy2240 opened this issue Aug 22, 2023 · 5 comments

Comments

@mzy2240
Copy link

mzy2240 commented Aug 22, 2023

MWE:

using DataFrames, CSV

df = DataFrame(:a => [1,2])
CSV.write("C:/Users/zmao/Desktop/test/con.csv", df)

Julia version: 1.9.2
Windows version: Windows 10 Enterprise 22H2

@quinnj
Copy link
Member

quinnj commented Aug 22, 2023

Can you share the error you're seeing?

@mzy2240
Copy link
Author

mzy2240 commented Aug 22, 2023

No error but the generated file does not exist

@mzy2240
Copy link
Author

mzy2240 commented Aug 23, 2023

@mzy2240
Copy link
Author

mzy2240 commented Aug 23, 2023

then why there is no error?

@hhaensel
Copy link

hhaensel commented Sep 6, 2023

These names behave like files, i.e. they support open, write and read, but they do different things than you expect, see e.g. https://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx.

There is simply no way to generate a file on Win-Os that with the basename "con". Renaming also doesn't work.
If you want to make sure that such name is not used, check beforehand, e.g.

if lowercase(splitext(basename(filename))[1]) == "con"
  @info "Filename '$(uppercase(basename(filename)))' not supported under Windows"
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants