Bug 57461 - python project does not set current directory correctly
Summary: python project does not set current directory correctly
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: scriptproject (show other bugs)
Version: 3.0.0a4
Platform: RedHat Enterprise Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-20 02:27 UTC by Stuart
Modified: 2007-11-02 20:33 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stuart 2003-04-20 02:27:41 UTC
Version:           3.0.0a4 (using KDE KDE 3.1)
Installed from:    RedHat RPMs
OS:          Linux

after creating a new python project (well, 'importing' one actually) in Gideon 3.0.0a4 and running the python resulting the 'current directory' from the point of view of the python program is my home directory, NOT the project directory where the python program is.
This creates problems with importing python scripts in that project.
my project is in '/home/stuart/mtg2'
the mtg2.py python returns '/home/stuartw' from the call os.getcwd() and I cannot import scripts in that directory or subdirectories setup with relative python load paths.
this applies also when a shell windows is used to exectute the program.
Comment 1 Jens Dagerbo 2003-12-17 08:53:28 UTC
Verified. 

This should be easy to fix, but should it be? I don't do much script programming so I'd like some feedback here.. Is it preferable to set the current directory to the directory of the executing script?

I think it's too close to the release to fiddle around with settings for this, but a sane default wouldn't hurt.
Comment 2 Marcus Schwemer 2003-12-27 17:01:23 UTC
I can confirm this for kdevelop 3.0.0b2 from the SuSE 9.0 rpms.

I would prefer your suggestion to set the current directory to the directory of the executing program.
Comment 3 Amilcar do Carmo Lucas 2004-01-30 11:37:19 UTC
I'll take a look at this.
Comment 4 Stuart 2004-01-30 12:29:58 UTC
Subject: Re:  python project does not set current directory correctly

On Friday 30 January 2004 23:37, you wrote:
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
> You are a voter for the bug, or are watching someone who is.
>
> http://bugs.kde.org/show_bug.cgi?id=57461

> ------- Additional Comments From a.lucas@tu-bs.de  2004-01-30 11:37 -------
> I'll take a look at this.

Fantastic to hear! this bug is a big show-stopper for any serious python work.

Regards,
Stuart W

Comment 5 Amilcar do Carmo Lucas 2005-02-01 21:18:01 UTC
Sorry, I have null phyton knowlage and canot reproduce.
Please give a step by step description on how to reproduce.
And with which template/files.
Comment 6 Jens Dagerbo 2005-02-04 00:59:17 UTC
This is trivially reproducible, but this doesn't mean it's a bug.

I looked around a bit, and we do the exact same thing for Perl, Python, Ruby and Bash. Their scripts are all executed with "current working directory" set to $HOME.

Seeing how I know no python either, I asked a bit in #python-cleese on freenode, and got this answer:

"This isn't a python thing, it's a program-behavior thing :) If someone writes a program that expects to be executed in a particular directory, then it will do unexpected things when it is not run in that directory. The author of the bug report is blaming kdevelop for violating his expectations."

Which confirms my "suspicion" that while this might be a nice option to have for whatever reason while you're developing, our current lack isn't really a bug.

So, I'm filing this as a wish. 
Comment 7 Andreas Pakulat 2007-02-23 12:22:27 UTC
I think we implemented this in 3.4
Comment 8 João Vitor P. Moraes 2007-11-02 20:33:00 UTC
still dont know how to change the current directory for execution