Python Forum
Windows/DOS python script cannot create a directory name beginning an @ at-sign
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Windows/DOS python script cannot create a directory name beginning an @ at-sign
#1
Dear forum readers,

DOS refuses the creation of a directory which name begins with an "@" (at-sign / at sign).

Unfortunately, I have to create a directory named "@eaDir" (hi, synology photo station users !) within a python script that I want to execute on windows.

The following line raises an error.
os.mkdir("@eaDir")

Does anyone have an idea about how to achieve the creation of directory with an @ at sign at the beginning in a python script executed on windows ?

Thank you !
Reply
#2
rewrite windows
Reply
#3
@volcano63
trolling windows is always fun !
but trolling...
Reply
#4
LucRhan Wrote:The following line raises an error.
What error?
It work for me.
C:\bar
λ ptpython
>>> import os
>>> os.mkdir("@eaDir")
>>> exit()

C:\bar
λ dir
'@eaDir'/  ren.py

C:\bar
λ cd @eaDir
C:\bar\@eaDir
Reply
#5
(May-08-2017, 11:55 AM)snippsat Wrote:
LucRhan Wrote:The following line raises an error.
What error?
It work for me.
C:\bar
λ ptpython
>>> import os
>>> os.mkdir("@eaDir")
>>> exit()

C:\bar
λ dir
'@eaDir'/  ren.py

C:\bar
λ cd @eaDir
C:\bar\@eaDir

In fact I am executing a python script from a cmd.exe DOS shell.
I have got the same error when trying to create the directory with a DOS command :
Test> mkdir @eaDir
Le fichier spécifié est introuvable (cannot find specified file)
or with a call to python
[url=http://stackoverflow.com/users/205580/eryksun][/url]Test> python.exe -c "import os; os.mkdir('@eaDir')"
Traceback (most recent call last): File "<string>", line 1, in <module> FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable: '@eaDir'
Reply
#6
What version of Windows? I just tried, and it works without issue on Windows 10.
Reply
#7
(May-08-2017, 11:38 AM)LucRhan Wrote: @volcano63
trolling windows is always fun !
but trolling...
I did not say anything  Naughty

But while we are at it - probably it was French thing Rolleyes
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Just beginning dalekeel 2 161 Apr-15-2024, 11:49 AM
Last Post: Pedroski55
  Triggering a ps1 script in remote windows server via http python request jasveerjassi 1 362 Jan-26-2024, 07:02 PM
Last Post: deanhystad
  working directory if using windows path-variable chitarup 2 720 Nov-28-2023, 11:36 PM
Last Post: chitarup
  Does @ at sign used for tother than decorators? ggpython000 1 533 Oct-12-2023, 09:08 AM
Last Post: buran
  Python rule about the space character surrounding the equal sign ineuw 10 1,611 Sep-21-2023, 09:17 AM
Last Post: ineuw
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,172 Jun-29-2023, 11:57 AM
Last Post: gologica
  Python script running under windows over nssm.exe JaroslavZ 0 703 May-12-2023, 09:22 AM
Last Post: JaroslavZ
  create a default path with idle to a specific directory greybill 0 873 Apr-23-2023, 04:32 AM
Last Post: greybill
  Program doesnt return beginning bilisim19 2 922 Feb-15-2023, 06:23 PM
Last Post: Larz60+
  Running script with subprocess in another directory paul18fr 1 3,681 Jan-20-2023, 02:33 PM
Last Post: paul18fr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020