Tried executing os.chdir("c:\twill") from a python Tk shell and got
the error message:
WindowsError: [Error 123] The filename, directory name, or volume
label syntax is incorrect: 'c:\twill'.
I have the directory exists as I copied the name from the explorer
window that was open to it.
What is wrong with the syntax?
thanks,
jh 5 10501
HMS Surprise napisał(a):
Tried executing os.chdir("c:\twill") from a python Tk shell and got
the error message:
WindowsError: [Error 123] The filename, directory name, or volume
label syntax is incorrect: 'c:\twill'.
I have the directory exists as I copied the name from the explorer
window that was open to it.
What is wrong with the syntax?
Unescaped '\' character. Try with raw string (r"c:\twill") or escape it
("c:\\twill").
--
Jarek Zgoda http://jpa.berlios.de/
On May 8, 3:54 pm, HMS Surprise <j...@datavoiceint.comwrote:
Tried executing os.chdir("c:\twill") from a python Tk shell and got
the error message:
WindowsError: [Error 123] The filename, directory name, or volume
label syntax is incorrect: 'c:\twill'.
I have the directory exists as I copied the name from the explorer
window that was open to it.
What is wrong with the syntax?
thanks,
jh
Use
os.chdir(r"c:\twill")
instead.
The "\t" character is the escape character for a tab. You can avoid
such a faux pas by using the raw string construct of the form r"some
string". Otherwise, any backslashes in in your string will be
interpreted as escape characters.
-Basilisk96
On Tuesday 08 May 2007 22:54:39 HMS Surprise wrote:
WindowsError: [Error 123] The filename, directory name, or volume
label syntax is incorrect: 'c:\twill'.
What is wrong with the syntax?
Try 'c:\\twill' because the '\' character is the escape character.
Eg: \n is new-line (aka crlf)
\t is tab etc.
To understand how these work, try this:
print 'hello\nworld'
and you get:
hello
world
On Tue, 2007-05-08 at 12:54 -0700, HMS Surprise wrote:
Tried executing os.chdir("c:\twill") from a python Tk shell and got
the error message:
WindowsError: [Error 123] The filename, directory name, or volume
label syntax is incorrect: 'c:\twill'.
Backslash-t is a tab character, so you're trying to chdir to
C:<tab>will, which is not a valid path name. Use a forward slash, double
up the backslash, or use a raw string literal:
os.chdir("c:/twill")
os.chdir("c:\\twill")
os.chdir(r"c:\twill")
HTH,
--
Carsten Haese http://informixdb.sourceforge.net
On May 8, 3:06 pm, Carsten Haese <cars...@uniqsys.comwrote:
On Tue, 2007-05-08 at 12:54 -0700, HMS Surprise wrote:
Tried executing os.chdir("c:\twill") from a python Tk shell and got
the error message:
WindowsError: [Error 123] The filename, directory name, or volume
label syntax is incorrect: 'c:\twill'.
Backslash-t is a tab character, so you're trying to chdir to
C:<tab>will, which is not a valid path name. Use a forward slash, double
up the backslash, or use a raw string literal:
os.chdir("c:/twill")
os.chdir("c:\\twill")
os.chdir(r"c:\twill")
HTH,
--
Carsten Haesehttp://informixdb.sourceforge.net
Thanks all. Windows bytes me again. I know better just wasn't
thinking. \n This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Andrew Crowe |
last post by:
Hi guys,
We're using the ISAPI version of PHP with IIS5.0
On some websites for some reason any php file in the websites root is given
the path winnt/system32 (getcwd() returns...
|
by: Nicholas Geraldi |
last post by:
I have a script that uses the chdir() function. I know the script works (
works perfectly on my host ), but when I put the script on my server here at
work I get the following error.
Warning:...
|
by: Jon Schull |
last post by:
I find that cgitb fails to show error context if I've changed my
default directory, so I tried to subclass cgitb and get it to save the
directory we were in when the program started. Didn't work. ...
|
by: Yun Mao |
last post by:
Hi,
How to make changes to os.environ and os.path.chdir still effective after
I run the script? Currently, the changes are only good within my script. I
would like the shell who called python...
|
by: Tom McDavid |
last post by:
I'm trying to learn more Python and have come across a strange
behavior.
I have Python2.3 installed on a Win2K machine. If I start the python
command line, I can do the following:
Python 2.3.2...
|
by: Chris |
last post by:
Hi,
For info I am using VS 2005 beta 2
I have a Console App and I want it to do the equivalent of a Change
Directory (CD) command that you would do in normal command line mode as
follows:
...
|
by: dannycolligan |
last post by:
I have a strange problem with os.chdir... here is my script that I am
using to edit the filenames of my music library:
#!/usr/bin/python
from os import *
...
|
by: Julien Biezemans |
last post by:
Hi everyone,
I've written a file:// scheme stream wrapper that acts like chroot()
(but is more flexible, does not require root privileges and works on any
platform). Everything works just fine...
|
by: rdoneil |
last post by:
I am in unix and in my perl program, I am trying to move back to the directory the program was originally started in. Obviously, at somepoint in my program it has to move to another directory, and...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |