Discussion:
[Pyzo] Run File (Interactive mode) changes the working directory
i***@gmail.com
2017-07-03 07:37:35 UTC
Permalink
Hello

I've installed Pyzo 4.4.0 for windows and when I use "Run File" the CWD is changed to the file's directory.

How to prevent that ?

Ido
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Almar Klein
2017-07-03 07:54:11 UTC
Permalink
Hi Ido,

This behaviour was changed in the last year because it seemed more often useful than not, and results in a behaviour similar to Matlab (and Spyder?). I think it makes sense to add an option to turn this behaviour on/off. Could you please make an issue for this on Github?

For reference, what is the use-case in which Pyzo’s current behaviour is limiting?

Regards,
Almar



From: ***@gmail.com
Sent: 03 July 2017 09:38
To: Pyzo
Subject: [Pyzo] Run File (Interactive mode) changes the working directory

Hello

I've installed Pyzo 4.4.0 for windows and when I use "Run File" the CWD is changed to the file's directory.

How to prevent that ?

Ido
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
i***@gmail.com
2017-07-03 08:11:53 UTC
Permalink
Post by i***@gmail.com
Hello
I've installed Pyzo 4.4.0 for windows and when I use "Run File" the CWD is changed to the file's directory.
How to prevent that ?
Ido
Thanks Almar.

1. This change is not yet updated in the pyzo web site:
http://www.pyzo.org/interactive_vs_script.html

2. My use case is:
I have a package pkg1 in <root>/pkg1 with modules m1.py m2.py ...
when my WD is set to <root> I can write in m1.py :
import pkg1
or
import pkg1.m2

But now, when the WD is automatically changed into pkg1 - these lines don't work.

Thanks, Ido.
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Almar Klein
2017-07-03 11:22:49 UTC
Permalink
Fixed in https://github.com/pyzo/pyzo/commit/129afc8df2efd9584ac7948de5a9ed0255558fce
I will also update the website (but push these changes with the next release).

Thanks!

From: ***@gmail.com
Sent: 03 July 2017 10:11
To: Pyzo
Subject: [Pyzo] Re: Run File (Interactive mode) changes the working directory
Post by i***@gmail.com
Hello
I've installed Pyzo 4.4.0 for windows and when I use "Run File" the CWD is changed to the file's directory.
How to prevent that ?
Ido
Thanks Almar.

1. This change is not yet updated in the pyzo web site:
http://www.pyzo.org/interactive_vs_script.html

2. My use case is:
I have a package pkg1 in <root>/pkg1 with modules m1.py m2.py ...
when my WD is set to <root> I can write in m1.py :
import pkg1
or
import pkg1.m2

But now, when the WD is automatically changed into pkg1 - these lines don't work.

Thanks, Ido.
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Dietrich Pescoller
2017-07-04 07:45:59 UTC
Permalink
In your scenario wouldn't it be better to put your root folder to python's
path?
I find the rule of change directory before running a script very useful and
more strightforward...
... anyway to have a configurable option will be the best solution for this.

Bye,
diti
Post by i***@gmail.com
Post by i***@gmail.com
Hello
I've installed Pyzo 4.4.0 for windows and when I use "Run File" the CWD
is changed to the file's directory.
Post by i***@gmail.com
How to prevent that ?
Ido
Thanks Almar.
http://www.pyzo.org/interactive_vs_script.html
I have a package pkg1 in <root>/pkg1 with modules m1.py m2.py ...
import pkg1
or
import pkg1.m2
But now, when the WD is automatically changed into pkg1 - these lines don't work.
Thanks, Ido.
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
i***@gmail.com
2017-07-04 08:46:32 UTC
Permalink
In your scenario wouldn't it be better to put your root folder to python's path?
I find the rule of change directory before running a script very useful and more strightforward...
... anyway to have a configurable option will be the best solution for this.
Bye,
diti
I Agree to the path and usefulness notes.
I got confused since the pyzo site did not describe the change and I suspected that maybe something is wrong.

Thanks a lot - Ido
Post by i***@gmail.com
Hello
I've installed Pyzo 4.4.0 for windows and when I use "Run File" the CWD is changed to the file's directory.
How to prevent that ?
Ido
Thanks Almar.
http://www.pyzo.org/interactive_vs_script.html
I have a package pkg1 in <root>/pkg1 with modules m1.py m2.py ...
import pkg1
or
import pkg1.m2
But now, when the WD is automatically changed into pkg1 - these lines don't work.
Thanks, Ido.
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...