Re: Webware/Apache Threading Problem?

Gary Perez <gary.perez-kSqzKFmFPN9Wk0Htik3J/[email protected]>
Newsgroups gmane.comp.python.webware
Message-ID <[email protected]>
On Sep 14, 2006, at 1:53 PM, Mark Phillips wrote:

> On Sep 13, 2006, at 10:16 AM, Gary Perez wrote:
>
>> At Chris' suggestion, removing the chdir calls in the two modules
>> fixes the problem, and everything works as expected.
>
> What did you do? or where did you move it to?

Parts of my file upload modules were using os.chdir() to switch to a  
directory and create a new directory inside where the files would  
ultimately be copied.

So instead of:

os.chdir(PARENT_DIR)
os.mkdir(NEW_DIR)

... I replaced it with:

os.mkdir(os.path.join(PARENT_DIR, NEW_DIR))

To actually write a file inside the new directory, instead of:

os.chdir(NEW_DIR )
file = open('index', 'wb')

... I replaced it with:

file = open(os.path.join(PARENT_DIR, NEW_DIR, filename), 'wb')

Basically, I took out any and all calls to os.chdir() - and that was  
the magic bullet.

HTH,
-Gary

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.