473,385 Members | 1,449 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

os.join Windows action

I am puzzled by the Windows XP usage below:

C:\Python23\Lib\site-packages\PyMatrix>c:python23\python
The system cannot find the path specified.

C:\Python23\Lib\site-packages\PyMatrix>c:python23\python.exe
The system cannot find the path specified.

C:\Python23\Lib\site-packages\PyMatrix>c:\python23\python.exe
Python 2.3.5 (#62, Feb 8 2005, 16:23:02) [MSC v.1200 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
^Z
C:\Python23\Lib\site-packages\PyMatrix>c:\python23\python
Python 2.3.5 (#62, Feb 8 2005, 16:23:02) [MSC v.1200 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.


C:\XXX is required, C:XXX is not acceptable.

The os.path.join doc has:

*join*( path1[, path2[, ...]])

Joins one or more path components intelligently. If any
component is an absolute path, all previous components are
thrown away, and joining continues. The return value is the
concatenation of path1, and optionally path2, etc., with exactly
one directory separator (|os.sep|) inserted between components,
unless path2 is empty. Note that on Windows, since there is a
current directory for each drive, os.path.join("c:", "foo")
represents a path relative to the current directory on drive C:
(c:foo), not c:\\foo.

How should os.path.join('C:', 'ugh') be treated?

Colin W.


Jul 18 '05 #1
2 2473
Colin J. Williams wrote:
C:\XXX is required, C:XXX is not acceptable.
C:XXX is acceptable, it just means something entirely different from
C:\XXX. There is a current working directory on each drive. C:XXX is
file XXX in the current directory on drive C:.
How should os.path.join('C:', 'ugh') be treated?


Exactly as it is? If you want other behavior, you want
os.path.join('C:\\', 'ugh').
--
Michael Hoffman
Jul 18 '05 #2

Michael Hoffman wrote:
Colin J. Williams wrote:
C:\XXX is required, C:XXX is not acceptable.


C:XXX is acceptable, it just means something entirely different from
C:\XXX. There is a current working directory on each drive. C:XXX is
file XXX in the current directory on drive C:.


Further notes for Colin:

On *x, /xxx is the xxx file in the root directory and xxx is the xxx
file in the current directory. Same perceived problem.

This is not a new feature in Windows XP; it has been as Michael
described ever since directories were introduced in MS-DOS 2.0. And of
course it applies to all file paths, irrespective of whether you want
to execute / read /write / etc.

As a matter of interest, do you normally run python with
"site-packages" as the current directory? Most folk would not do that,
with any software package, preferring the installed software to be just
that, and not "polluted" with their own data etc which should be kept
elsewhere in appropriately named and structured directories.

HTH,
John

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: B. Fongo | last post by:
I learned MySQL last year without putting it into action; that is why I face trouble in formulating my queries. Were it a test, then you would have passed it, because your queries did help me...
0
by: Pete | last post by:
hello i am a novice at database design and i'm having trouble doing a multi join in mysql, i was able to do a inner join with just the venues and productions tables below like so SELECT...
2
by: Ken Lindner | last post by:
I have a need to become familiar with SQL Server 2000 for work. Needless to say I am new to SQL Server any version, but not IT in general. My employer has provided me with the SQL Server 2000...
6
by: PW | last post by:
I've created an ASP application which uses an Access database. I've created an outer join query, but for some reason the "Property_Def" column is not aligning with the "ESPN" column. They should...
0
by: gxl034000 | last post by:
Hi, I have been trying to use a .net Forms control in my webpage to open up an application(notepad) on the client. The control works fine when embedded in a windows form, but I keep getting a...
60
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type?...
3
by: Annyka | last post by:
Platform: SQL Server 2000 (8.00.2040, SP4, Enterprise edition) I've got a complex query I'm trying to build, which will select all requests that have a status_code of 1, and who's related incident...
5
by: Sascha.Moellering | last post by:
Hi, I receive the error code SQL0338N if I try to compile this statement (part of the statement): .... left outer join lateral (SELECT * FROM LIZSYSABA.VWZL0359TBS WHERE tbs_name = CASE WHEN...
0
by: v1p3r | last post by:
I'm attempting to install Python 2.5.2 (python-2.5.2.amd64.msi) on my Vista SP1 x64 system, but the installer always crashes with a "Windows Installer has stopped working" error after clicking Next...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.