Re: python os.chdir() Windows Error 2

2019-04-02 Thread grossmudda
Ahhh now I see!! I actually was trying to import a file, now I know it´s just changing the directory. Next time I´d better read the description of the tool carefully... Thank you so much!! You helped a lot! -- https://mail.python.org/mailman/listinfo/python-list

Re: python os.chdir() Windows Error 2

2019-04-01 Thread eryk sun
On 4/1/19, grossmu...@gmail.com wrote: > > os.chdir('C:\\Users\\Ayla\\Documents\\Uni\\Master_Umweltingenieurwesen\\ > Study_Project\\kerschbaum_input') > os.chdir('C:/Users/Ayla/Documents/Uni/Master_Umweltingenieurwesen/ > Study_Project/kerschbaum_input') These

Re: python os.chdir() Windows Error 2

2019-04-01 Thread Calvin Spealman
What are you actually trying to do? os.chdir() simply changes the current working directory of your process. It doesn't read any data or "import" or really have any affect on its own. The current directory is the directory you ran the script from in the first place, which is wher

python os.chdir() Windows Error 2

2019-04-01 Thread grossmudda
Hey guys, I´ve got a problem importing a file with os.chdir. I´ve done a lot of research but still I can´t fix it. For any suggestions I would be so thankful! This is what I´ve tried so far: import os import numpy as np import matplotlib.pyplot as plt os.chdir('C:\Users\Ayla\Document

Re: File names with slashes [was Re: error in os.chdir]

2018-07-05 Thread Gene Heskett
On Thursday 05 July 2018 11:57:18 Mikhail V wrote: > Steven D'Aprano wrote: > > In Explorer and the open-file dialog of most applications, they will > > see paths like this: > > > > directory\file name with spaces > > > > with the extension (.jpg, .pdf, .docx etc) suppressed. So by your > > ar

File names with slashes [was Re: error in os.chdir]

2018-07-05 Thread Mikhail V
Steven D'Aprano wrote: > In Explorer and the open-file dialog of most applications, they will see > paths like this: > > directory\file name with spaces > > with the extension (.jpg, .pdf, .docx etc) suppressed. So by your > argument, Python needs to accept strings without quotes: > > open

Re: File names with slashes [was Re: error in os.chdir]

2018-07-04 Thread Steven D'Aprano
On Thu, 05 Jul 2018 00:56:22 +0300, Mikhail V wrote: > for the user it is most important to > *see* and copy-paste the path string exactly as it is displayed > everywhere else on windows. So in Windows, you see: dir directory\file.pdf so in Python, we have to use exactly the same path with

Re: File names with slashes [was Re: error in os.chdir]

2018-07-04 Thread Gregory Ewing
Mikhail V wrote: There is one issue that I can't write \ on the end: r"C:\programs\util\" But since I know it's a path and not a file, I just write without trailing \. Indeed. There's never a need to put a backslash on the end of a path, as long as you always use os.path functions or equivalen

File names with slashes [was Re: error in os.chdir]

2018-07-04 Thread Mikhail V
ChrisA wrote: > Mikhail V wrote: >> Yes, and the answer was a week ago: just put "r" before the string. >> r"C:\programs\util" >> >> And it worked till now. So why should I replace backslashes with >> forward slashes? >> There is one issue that I can't write \ on the end: >> r"C:\programs\util\"

Re: File names with slashes [was Re: error in os.chdir]

2018-07-04 Thread Mark Lawrence
On 04/07/18 21:30, Chris Angelico wrote: On Thu, Jul 5, 2018 at 6:25 AM, Mikhail V wrote: Joe Pfeiffer wrote: On Windows a path is e.g.: C:\programs\util\ So what is reasonable about using forward slashes? It happens to me that I need to copy-paste real paths like 100 times a day into scripts

Re: File names with slashes [was Re: error in os.chdir]

2018-07-04 Thread Chris Angelico
On Thu, Jul 5, 2018 at 6:25 AM, Mikhail V wrote: > Joe Pfeiffer wrote: > >>> On Windows a path is e.g.: >>> C:\programs\util\ >>> So what is reasonable about using forward slashes? >>> It happens to me that I need to copy-paste real paths like 100 times >>> a day into scripts - do you propose to c

File names with slashes [was Re: error in os.chdir]

2018-07-04 Thread Mikhail V
Joe Pfeiffer wrote: >> On Windows a path is e.g.: >> C:\programs\util\ >> So what is reasonable about using forward slashes? >> It happens to me that I need to copy-paste real paths like 100 times >> a day into scripts - do you propose to convert to forward slashes each time? > That's what starte

Re: File names with slashes [was Re: error in os.chdir]

2018-07-04 Thread Joe Pfeiffer
Mikhail V writes: > [Steven D'Aprano] > >> (The same applies to Unix/Linux systems too, of course.) But while you're >> using Python to manipulate files, you should use Python rules, and that >> is "always use forward slashes". >> >> Is that reasonable? >> >> Under what circumstances would a user

Re: File names with slashes [was Re: error in os.chdir]

2018-07-03 Thread Thomas Jollans
On 2018-07-03 14:06, Mikhail V wrote: > Greg wrote: > >> Mikhail V wrote: >>> s= "\"s\"" -> >>> s= {"s"} >> >> But now you need to find another way to represent set literals. > > > I need to find? That comment was not about (current) Python but > rather how I think string should have been

File names with slashes [was Re: error in os.chdir]

2018-07-03 Thread Mikhail V
Greg wrote: > Mikhail V wrote: > > s= "\"s\"" -> > > s= {"s"} > > But now you need to find another way to represent set literals. I need to find? That comment was not about (current) Python but rather how I think string should have been from the beginning. So you already like it and want

Re: File names with slashes [was Re: error in os.chdir]

2018-07-03 Thread Gregory Ewing
Mikhail V wrote: s= "\"s\"" -> s= {"s"} But now you need to find another way to represent set literals. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

File names with slashes [was Re: error in os.chdir]

2018-07-02 Thread Mikhail V
[Chris A] > [Mikhail] > > So Imo default syntax should be something like: > > > > S = "A:{x41}B:{x42}" > > > > instead of backslashes and Co. > > So how do you represent brace characters in a string? \{ and \} just kidding :-D I would be ok with {L} and {R} - easy on eye and easy to rememb

Re: File names with slashes [was Re: error in os.chdir]

2018-07-02 Thread MRAB
On 2018-07-02 18:16, Richard Damon wrote: On 7/2/18 9:20 AM, Mikhail V wrote: [Richard Damon] The one major issue with backslashes is that they are a special character in string literals, so you either need to use raw literals a remember the few cases they still act as special characters, or r

Re: File names with slashes [was Re: error in os.chdir]

2018-07-02 Thread Richard Damon
On 7/2/18 9:20 AM, Mikhail V wrote: > [Richard Damon] > >> The one major issue with backslashes is that they are a special >> character in string literals, so you either need to use raw literals a >> remember the few cases they still act as special characters, or remember >> to convert them to doub

Re: File names with slashes [was Re: error in os.chdir]

2018-07-02 Thread Chris Angelico
On Tue, Jul 3, 2018 at 2:20 AM, Mikhail V wrote: > [Richard Damon] > >> The one major issue with backslashes is that they are a special >> character in string literals, so you either need to use raw literals a >> remember the few cases they still act as special characters, or remember >> to conver

Re: File names with slashes [was Re: error in os.chdir]

2018-07-02 Thread Mikhail V
[Richard Damon] > The one major issue with backslashes is that they are a special > character in string literals, so you either need to use raw literals a > remember the few cases they still act as special characters, or remember > to convert them to double back slashes, at a minimum for all the >

Re: File names with slashes [was Re: error in os.chdir]

2018-07-02 Thread Karsten Hilbert
Eryk, thanks for your to-the-point in-depth posts. Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https://mail.python.org/mailman/listinfo/python-list

Re: File names with slashes [was Re: error in os.chdir]

2018-07-01 Thread eryk sun
On Sun, Jul 1, 2018 at 4:30 PM, eryk sun wrote: > On Sun, Jul 1, 2018 at 8:51 AM, Steven D'Aprano > >> spam/eggs [...] >> And how would that file be displayed in the Windows GUI file explorer? > > I suppose if a file system allowed forward slash in names that > Explorer would just display it.

Re: File names with slashes [was Re: error in os.chdir]

2018-07-01 Thread Gregory Ewing
eryk sun wrote: Python 2 raw strings are half-baked. Obviously the "r" actually stand for "rare". -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: File names with slashes [was Re: error in os.chdir]

2018-07-01 Thread eryk sun
On Sun, Jul 1, 2018 at 4:00 PM, Abdur-Rahmaan Janhangeer wrote: > one common scenario is > > C:\Users\ > > where \U is taken as a unicode litteral This one is especially annoying in Python 2, since it makes raw unicode strings useless for common path literals. For example: >>> ur'C:\User

Re: File names with slashes [was Re: error in os.chdir]

2018-07-01 Thread eryk sun
On Sun, Jul 1, 2018 at 8:51 AM, Steven D'Aprano wrote: > On Sun, 01 Jul 2018 03:18:23 +, eryk sun wrote: > >> Bear in mind that forward slash is just a name character in NT. > > So, using Python, how could you open, write to, and then read from, a > file with a slash in its name? Say, somethi

Re: File names with slashes [was Re: error in os.chdir]

2018-07-01 Thread Abdur-Rahmaan Janhangeer
one common scenario is C:\Users\ where \U is taken as a unicode litteral Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ > > > -- https://mail.python.org/mailman/listinfo/python-list

Re: File names with slashes [was Re: error in os.chdir]

2018-07-01 Thread Richard Damon
On 7/1/18 6:49 AM, Mikhail V wrote: > [Steven D'Aprano] > >> (The same applies to Unix/Linux systems too, of course.) But while you're >> using Python to manipulate files, you should use Python rules, and that >> is "always use forward slashes". >> >> Is that reasonable? >> >> Under what circumstan

Re: error in os.chdir

2018-07-01 Thread eryk sun
On Sun, Jul 1, 2018 at 8:50 AM, Steven D'Aprano wrote: > On Sun, 01 Jul 2018 03:18:23 +, eryk sun wrote: > >> The Windows API handles this, but not for a path that begins with \\?\. > > But what about the *Python* API? The Python open() function, and all the > high-level os.* and os.path.* fun

File names with slashes [was Re: error in os.chdir]

2018-07-01 Thread Mikhail V
[Steven D'Aprano] > (The same applies to Unix/Linux systems too, of course.) But while you're > using Python to manipulate files, you should use Python rules, and that > is "always use forward slashes". > > Is that reasonable? > > Under what circumstances would a user calling open(pathname) in Pyt

Re: error in os.chdir

2018-07-01 Thread Peter J. Holzer
On 2018-07-01 08:50:22 +, Steven D'Aprano wrote: > On Sun, 01 Jul 2018 03:18:23 +, eryk sun wrote: > > On Sun, Jul 1, 2018 at 1:44 AM, Steven D'Aprano > > wrote: > >> I guess that if the user is using a path beginning with \\?\ they may > >> or may not need to use backslashes, but I have n

File names with slashes [was Re: error in os.chdir]

2018-07-01 Thread Steven D'Aprano
On Sun, 01 Jul 2018 03:18:23 +, eryk sun wrote: > Bear in mind that forward slash is just a name character in NT. So, using Python, how could you open, write to, and then read from, a file with a slash in its name? Say, something like: spam/eggs in your home directory. (Is that still

Re: error in os.chdir

2018-07-01 Thread Steven D'Aprano
On Sun, 01 Jul 2018 03:18:23 +, eryk sun wrote: > On Sun, Jul 1, 2018 at 1:44 AM, Steven D'Aprano > wrote: >> On Sat, 30 Jun 2018 23:36:40 +, eryk sun wrote: >> >>> Only use forward slashes for legacy DOS paths passed to Windows API >>> functions. Do not use forward slashes for paths in c

Re: error in os.chdir

2018-06-30 Thread Steven D'Aprano
On Sun, 01 Jul 2018 02:22:41 +, eryk sun wrote: > I use the native API a lot, so for me registry and file paths are just > paths. It's only the Windows API that separates the two and only the > Windows API that allows forward slash as a path separator in file paths. Not being a Windows user,

Re: error in os.chdir

2018-06-30 Thread eryk sun
On Sun, Jul 1, 2018 at 1:44 AM, Steven D'Aprano wrote: > On Sat, 30 Jun 2018 23:36:40 +, eryk sun wrote: > >> Only use forward slashes for legacy DOS paths passed to Windows API >> functions. Do not use forward slashes for paths in command line >> arguments, \\?\ prefixed paths, or registry pa

Re: error in os.chdir

2018-06-30 Thread Chris Angelico
On Sun, Jul 1, 2018 at 12:43 PM, eryk sun wrote: > On Sun, Jul 1, 2018 at 2:28 AM, Chris Angelico wrote: >> On Sun, Jul 1, 2018 at 12:22 PM, eryk sun wrote: So what if, internally, that's done by converting them to backslashes? No Python program needs to care. In fact, there are other

Re: error in os.chdir

2018-06-30 Thread eryk sun
On Sun, Jul 1, 2018 at 2:28 AM, Chris Angelico wrote: > On Sun, Jul 1, 2018 at 12:22 PM, eryk sun wrote: >>> So what if, internally, that's done by converting them to backslashes? >>> No Python program needs to care. In fact, there are other conversions, >>> too - the underlying file system is mo

Re: error in os.chdir

2018-06-30 Thread Chris Angelico
On Sun, Jul 1, 2018 at 12:22 PM, eryk sun wrote: >> So what if, internally, that's done by converting them to backslashes? >> No Python program needs to care. In fact, there are other conversions, >> too - the underlying file system is most likely using UTF-16 paths, >> but your Python program nee

Re: error in os.chdir

2018-06-30 Thread eryk sun
On Sun, Jul 1, 2018 at 1:58 AM, Chris Angelico wrote: > On Sun, Jul 1, 2018 at 10:20 AM, eryk sun wrote: >> On Sat, Jun 30, 2018 at 11:42 PM, Chris Angelico wrote: >>> "Legacy" implies that it's the old standard that is now deprecated, >> >> I did not mean to imply that DOS paths are deprecated.

Re: error in os.chdir

2018-06-30 Thread Chris Angelico
On Sun, Jul 1, 2018 at 10:20 AM, eryk sun wrote: > On Sat, Jun 30, 2018 at 11:42 PM, Chris Angelico wrote: >> "Legacy" implies that it's the old standard that is now deprecated, > > I did not mean to imply that DOS paths are deprecated. That's not what > legacy means to me. Unless you are Humpty

Re: error in os.chdir

2018-06-30 Thread Steven D'Aprano
On Sat, 30 Jun 2018 23:36:40 +, eryk sun wrote: > Only use forward slashes for legacy DOS paths passed to Windows API > functions. Do not use forward slashes for paths in command line > arguments, \\?\ prefixed paths, or registry paths. I don't see why this is relevant, or at least not the "c

Re: error in os.chdir

2018-06-30 Thread eryk sun
0 >>>> down vote >>>> favorite >>>> >>>> I need to change directory to my local working directory in windows and >>>> then open a file for processing. >>>> Its just a 3 lines code, as below: >>>> import csv >>>

Re: error in os.chdir

2018-06-30 Thread Terry Reedy
lines code, as below: import csv import os os.chdir('D:\Projects\Initiatives\machine learning\programs\assertion') The error is as follows: WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: 'D:\Projects\Initiatives\machine learning\progr

Re: error in os.chdir

2018-06-30 Thread Chris Angelico
ange directory to my local working directory in windows and >>> then open a file for processing. >>> Its just a 3 lines code, as below: >>> import csv >>> import os >>> os.chdir('D:\Projects\Initiatives\machine learning\programs\assertion') >&

Re: error in os.chdir

2018-06-30 Thread eryk sun
e for processing. >> Its just a 3 lines code, as below: >> import csv >> import os >> os.chdir('D:\Projects\Initiatives\machine learning\programs\assertion') >> The error is as follows: >> WindowsError: [Error 123] The filename, directory name, o

Re: error in os.chdir

2018-06-30 Thread Jim Lee
On 06/30/18 07:34, Sharan Basappa wrote: sorry. I mean why my code worked in one case but did not in the other one. This worked - os.chdir('D:\Projects\Initiatives\machine learning\programs') This did not work - os.chdir('D:\Projects\Initiatives\machine learning\programs\as

Re: error in os.chdir

2018-06-30 Thread Karsten Hilbert
On Sat, Jun 30, 2018 at 07:34:46AM -0700, Sharan Basappa wrote: > sorry. I mean why my code worked in one case but did not in the other one. > > This worked - os.chdir('D:\Projects\Initiatives\machine learning\programs') > > This did not work - os.chdir('D

Re: error in os.chdir

2018-06-30 Thread Sharan Basappa
in the first place. > > For that you'll have to read up on strings and escaping. > > https://docs.python.org/2/tutorial/introduction.html#strings > > Karsten > -- > GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B sorry. I mean why my code worked in on

Re: error in os.chdir

2018-06-30 Thread Karsten Hilbert
On Sat, Jun 30, 2018 at 05:46:59AM -0700, Sharan Basappa wrote: > > >> The quick fix: > > >> > > >> put an r in front of the directory string: r'...' > > > > Please don't do that. It's the wrong solution -- all you are doing is > > postponing failure. It will *seem* to work, until one day you w

Re: error in os.chdir

2018-06-30 Thread Sharan Basappa
failure. Chris gave you the right solution: > use forward slashes instead of backslashes for all paths. > > os.chdir('D:/Projects/Initiatives/machine learning/programs') > > > > > -- > Steven D'Aprano > "Ever since I learned about confirmatio

Re: error in os.chdir

2018-06-30 Thread Steven D'Aprano
will *seem* to work, until one day you will write something like this: directory = r'D:\directory\' and you will get a mysterious failure. Chris gave you the right solution: use forward slashes instead of backslashes for all paths. os.chdir('D:/Projects/Initiatives/machin

Re: error in os.chdir

2018-06-30 Thread Abdur-Rahmaan Janhangeer
for user input, a replace might be the solution, using / in internal code Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ Use forward slashes instead of backslashes for all paths. > > os.chdir('D:/Projects/Initiatives/machine learning/programs') > &g

Re: error in os.chdir

2018-06-30 Thread Sharan Basappa
a 3 lines code, as below: > > import csv > > import os > > os.chdir('D:\Projects\Initiatives\machine learning\programs\assertion') > > The error is as follows: > > WindowsError: [Error 123] The filename, directory name, or volume label > > syntax is incorrec

Re: error in os.chdir

2018-06-30 Thread Chris Angelico
On Sat, Jun 30, 2018 at 9:05 PM, Sharan Basappa wrote: > > 0 > down vote > favorite > > I need to change directory to my local working directory in windows and then > open a file for processing. > Its just a 3 lines code, as below: > import csv > import os >

Re: error in os.chdir

2018-06-30 Thread Karsten Hilbert
On Sat, Jun 30, 2018 at 04:05:22AM -0700, Sharan Basappa wrote: > I need to change directory to my local working directory in windows and then > open a file for processing. > Its just a 3 lines code, as below: > import csv > import os > os.chdir('D:\Projects\Initiatives\ma

error in os.chdir

2018-06-30 Thread Sharan Basappa
0 down vote favorite I need to change directory to my local working directory in windows and then open a file for processing. Its just a 3 lines code, as below: import csv import os os.chdir('D:\Projects\Initiatives\machine learning\programs\assertion') The error is as follows: Wi

Re: Problem with os.chdir()

2009-03-11 Thread van Asselt
Hello, In order to prevent this type of problems, I alway do the following: import path path = something path = os.path.normpath(path) os.chdir(path) This prevents a lot of problems for me. Regards, Henk "Tim Golden" wrote in message news:mailman.1646.1236751732.1174

Re: Problem with os.chdir()

2009-03-11 Thread Tim Golden
Hendrik van Rooyen wrote: "Tim Golden" wrote: Well, a little bit of experimentation shows that you can *create* paths this deep (say, with os.mkdir). But you can't actually set the current directory to it. So the Is this also true if you try to go there by a succession of shorter hops of the

Re: Problem with os.chdir()

2009-03-11 Thread Hendrik van Rooyen
"Tim Golden" wrote: > Well, a little bit of experimentation shows that you can > *create* paths this deep (say, with os.mkdir). But you > can't actually set the current directory to it. So the Is this also true if you try to go there by a succession of shorter hops of the ./next_level kind? - H

Re: Problem with os.chdir()

2009-03-11 Thread Gabriel Genellina
En Wed, 11 Mar 2009 11:59:57 -0200, venutaurus...@gmail.com escribió: On Mar 11, 6:41 pm, Tim Golden wrote: venutaurus...@gmail.com wrote: > On Mar 11, 5:19 pm, Tim Golden wrote: Well, the source for os.chdir under Windows uses the Win32 SetCurrentDirectoryW API as expected. What is

Re: Problem with os.chdir()

2009-03-11 Thread Tim Golden
etting the exception: Traceback (most recent call last): File "C:\JPDump\test.py", line 29, in renameStubs(file) File "C:\JPDump\test.py", line 12, in renameStubs os.chdir (path) WindowsError: [Error 206] The filename or extension is too long: u'\\\ \?

Re: Problem with os.chdir()

2009-03-11 Thread venutaurus...@gmail.com
> >>> athLevel10\DeepPathLevel11\DeepPathLevel12\DeepPathLevel13\DeepPathLevel14\ > >>> DeepPathLevel15\DeepPathLevel16\DeepPathLevel172.txt' > >>> I am still getting the exception: > >>> Traceback (most recent call last): > &g

Re: Problem with os.chdir()

2009-03-11 Thread Tim Golden
\JPDump\test.py", line 29, in renameStubs(file) File "C:\JPDump\test.py", line 12, in renameStubs os.chdir (path) WindowsError: [Error 206] The filename or extension is too long: u'\\\ \?\\C:\\TestDataSet\\DeepPaths\\DeepPathLevel01\\DeepPathLevel02\ \Deep

Re: Problem with os.chdir()

2009-03-11 Thread venutaurus...@gmail.com
athLevel08\DeepPathLevel09\DeepP > > athLevel10\DeepPathLevel11\DeepPathLevel12\DeepPathLevel13\DeepPathLevel14\ > > DeepPathLevel15\DeepPathLevel16\DeepPathLevel172.txt' > > > I am still getting the exception: > > > Traceback (most recent call last): > >   F

Re: Problem with os.chdir()

2009-03-11 Thread Tim Golden
uot;C:\JPDump\test.py", line 12, in renameStubs os.chdir (path) WindowsError: [Error 206] The filename or extension is too long: u'\\\ \?\\C:\\TestDataSet\\DeepPaths\\DeepPathLevel01\\DeepPathLevel02\ \DeepPathLevel03\\DeepPathLevel04\\DeepPathLevel05\\DeepPathLevel06\ \DeepPathLevel07\\Deep

Re: Problem with os.chdir()

2009-03-11 Thread venutaurus...@gmail.com
\test.py", line 29, in renameStubs(file) File "C:\JPDump\test.py", line 12, in renameStubs os.chdir (path) WindowsError: [Error 206] The filename or extension is too long: u'\\\ \?\\C:\\TestDataSet\\DeepPaths\\DeepPathLevel01\\DeepPathLevel02\ \DeepPathLevel03\\DeepPathLevel

Re: Problem with os.chdir()

2009-03-11 Thread Tim Golden
Here is my code snippet which you will be interested in: Indeed. file = ur'\\?\C:\\TestDataSet\DeepPaths \DeepPathLevel01\DeepPathLevel02\DeepPathLevel03\DeepPathLevel04\DeepPathLevel05\DeepPathLevel06\DeepPathLevel07\DeepPathLevel08\DeepPathLevel09\DeepPathLevel10\DeepPathLevel11\DeepPathLeve

Re: Problem with os.chdir()

2009-03-11 Thread venutaurus...@gmail.com
>>> then supported normally by the Windows OS (>255). So I am appending "\ > >>> \?\" to do so. But when I use the path in the above fashion with > >>> os.chdir() it is unable to recognize my folder and throwing an error: > >>> Traceback (most rec

Re: Problem with os.chdir()

2009-03-11 Thread Tim Golden
use the path in the above fashion with os.chdir() it is unable to recognize my folder and throwing an error: Traceback (most recent call last): File "C:\JPDump\test.py", line 31, in renameStubs(file) File "C:\JPDump\test.py", line 15, in renameStubs os.chdir (pa

Re: Problem with os.chdir()

2009-03-11 Thread venutaurus...@gmail.com
so. But when I use the path in the above fashion with > > os.chdir() it is unable to recognize my folder and throwing an error: > > > Traceback (most recent call last): > >   File "C:\JPDump\test.py", line 31, in > >     renameStubs(file) > >   File "C:\J

Re: Problem with os.chdir()

2009-03-10 Thread Tim Golden
venutaurus...@gmail.com wrote: Hello all, I am writing a python script which has to access deep paths then supported normally by the Windows OS (>255). So I am appending "\ \?\" to do so. But when I use the path in the above fashion with os.chdir() it is unable to recogn

Problem with os.chdir()

2009-03-10 Thread venutaurus...@gmail.com
Hello all, I am writing a python script which has to access deep paths then supported normally by the Windows OS (>255). So I am appending "\ \?\" to do so. But when I use the path in the above fashion with os.chdir() it is unable to recognize my folder and throwing an erro

os.ChDir() not thread-safe; was : Is tempfile.mkdtemp() thread-safe?

2008-08-29 Thread Gabriel Rossetti
reads, each call has to be from a different directory. Thank you, Gabriel I think I found what was wrong, I was using os.chDir(), and the current directory is shared by all threads : http://www.biais.org/blog/index.php/2007/01/23/19-python-threads-and-oschdir http://bugs.python.org/issue136

Re: os.chdir

2008-03-08 Thread rbossy
Quoting "Martin v. Löwis" <[EMAIL PROTECTED]>: > >> os.chdir("~/dir1") > > > > It is not mentioned in the documentation but I'm pretty sure os.dir() > doesn't do > > tilde expansion since this is usually performed by a shell. &

Re: os.chdir

2008-03-08 Thread Martin v. Löwis
>> os.chdir("~/dir1") > > It is not mentioned in the documentation but I'm pretty sure os.dir() doesn't > do > tilde expansion since this is usually performed by a shell. > > You should use instead: > > os.chdir(os.join(os.environ['HO

Re: os.chdir

2008-03-08 Thread rbossy
Quoting Maryam Saeedi <[EMAIL PROTECTED]>: > I have a problem using os.chdir on linux. What should I do if I want to > change to root directory? The below does not work: > > os.chdir("~/dir1") It is not mentioned in the documentation but I'm pretty sure os.dir()

Re: os.chdir

2008-03-07 Thread Michael Wieher
2008/3/7, Maryam Saeedi <[EMAIL PROTECTED]>: > > I have a problem using os.chdir on linux. What should I do if I want to > change to root directory? The below does not work: > > os.chdir("~/dir1") > > Thanks > > -- > http://mail.python.org/mailman

os.chdir

2008-03-07 Thread Maryam Saeedi
I have a problem using os.chdir on linux. What should I do if I want to change to root directory? The below does not work: os.chdir("~/dir1") Thanks -- http://mail.python.org/mailman/listinfo/python-list

RE: Using os.popen and os.chdir together

2007-05-08 Thread Looney, James B
May 08, 2007 4:17 PM To: python-list@python.org Subject: Using os.popen and os.chdir together Within a script on a *nix machine, I use os.chdir then os.popen, and it appears to me as though the os.chdir had no effect so far as the os.popen is concerned. Why's that? Here's what

Using os.popen and os.chdir together

2007-05-08 Thread Looney, James B
Within a script on a *nix machine, I use os.chdir then os.popen, and it appears to me as though the os.chdir had no effect so far as the os.popen is concerned. Why's that? Here's what I'm doing: >>> import os >>> os.path.realpath( os.curdir ) '/home/j

Re: os.chdir doesn't accept variables sometimes

2006-06-02 Thread DataSmash
A simple way to get all the files throughout the directory sturcture... You may have to rewrite the "CONVERTING" part. import os, glob for root, dirs, files in os.walk(os.getcwd()): for file in files: if file.endswith(".mp3"): print "File: " + os.path.abspath(os.path.join(

Re: os.chdir doesn't accept variables sometimes

2006-06-02 Thread Donn Cave
In article <[EMAIL PROTECTED]>, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > #!/usr/bin/python > > from os import * > > chdir("/home/chainlynx/Desktop/Music") > for artist in listdir(getcwd()): > print "===ARTIST: "+artist > chdir(artist) > for album in listdir(getcw

Re: os.chdir doesn't accept variables sometimes

2006-06-02 Thread BartlebyScrivener
>> for album in listdir(getcwd()): doesn't listdir give you subdirectories AND files? So, then if you try to: chdir(album) If album is a file, it chokes? Just a guess. I'm on Windows, not Linux. rd -- http://mail.python.org/mailman/listinfo/python-list

os.chdir doesn't accept variables sometimes

2006-06-02 Thread [EMAIL PROTECTED]
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 * chdir("/home/chainlynx/Desktop/Music") for artist in listdir(getcwd()): print "===ARTIST: "+artist chdir

os.chdir + GUI question

2005-12-03 Thread Philippe C. Martin
Hi, I do not know whether this is a Python, wxPython, Windows, or coding question ... I have a program that changes disk/directory using os.chdir (verified OK with os.getcwd) then opens a file dialog box using wx.FileDialog with "" as default dir. I expected to be in my chdir dir