cancel
Showing results for 
Search instead for 
Did you mean: 

os.chdir(myPath) is not working.

tc_2018
Contributor

os.chdir(myPath) is not working.

Hi,

I have the code below and it works fine with the IDLE; however, it is not working with T.C.

 

import os

myPath = 'O:\\myDir' #this is my mapped network drive

os.chdir(myPath)

 

Can someone please shed a light!

7 REPLIES 7
Marsha_R
Community Hero

Re: os.chdir(myPath) is not working.

What happens when you try it?

tc_2018
Contributor

Re: os.chdir(myPath) is not working.

I got error message:

 

Python runtime error.

FileNotFoundError

[WinError3] The system cannot find the specific path specified: 'O:\\\\'

Marsha_R
Community Hero

Re: os.chdir(myPath) is not working.

If you hard code the path in the os.chdir line, does it work?  That will tell you if it is a syntax problem with the second line or a permissions problem and TestComplete can't get to that directory.

 

 

tc_2018
Contributor

Re: os.chdir(myPath) is not working.

Hardcoded is not working either. For example:

 

os.chdir('O:\\myFolder')

 

It works fine when running with IDLE, but not with T.C. and I don't know why.How do know if it's a permission problem with T.C?

Marsha_R
Community Hero

Re: os.chdir(myPath) is not working.

Are you able to browse to that folder and open the file from the machine where TC is installed?

tc_2018
Contributor

Re: os.chdir(myPath) is not working.

Yes, I can. I am an admin of the system where T.C. is installed.

 

I used IDLE on the same machine, and did not have any problem.

Marsha_R
Community Hero

Re: os.chdir(myPath) is not working.

Can we see your actual code please?  It's hard to tell what's going on from made up examples.

New Here?
Join us and watch the welcome video:
Announcements