IDLE doesn't seem to honor PYTHONSTARTUP environment variable nor
sitecustomize.py
How do you then customize in IDLE?
(basically I want to execute the statement
from btools import *
each time I restart IDLEs Python Shell) 18 3336
<bo*******@yahoo.com> schrieb im Newsbeitrag
news:11**********************@f14g2000cwb.googlegr oups.com... IDLE doesn't seem to honor PYTHONSTARTUP environment variable nor sitecustomize.py
How do you then customize in IDLE?
(basically I want to execute the statement from btools import * each time I restart IDLEs Python Shell)
Following works for me:
C:\Python24\pythonw.exe E:\Python24\Lib\idlelib\idle.py -r
E:\Python24\sitecustomize.py
or
C:\Python24\pythonw.exe E:\Python24\Lib\idlelib\idle.py -c "import os;
from path import path"
content of my sitecustomize.py is:
"
import os
from path import path
"
and both ways of invoking IDLE have the same effect (apparently of faking
execution of not shown input line) of making the modules os and the class
path available at start of IDLE.
My question in this context:
Can the PyShell.py file in C:\Python24\Lib\idlelib directory be edited
somehow to achieve same effect?
Claudio
<bo*******@yahoo.com> schrieb im Newsbeitrag
news:11**********************@f14g2000cwb.googlegr oups.com... IDLE doesn't seem to honor PYTHONSTARTUP environment variable nor sitecustomize.py
How do you then customize in IDLE?
(basically I want to execute the statement from btools import * each time I restart IDLEs Python Shell)
Following works for me:
C:\Python24\pythonw.exe E:\Python24\Lib\idlelib\idle.py -r
E:\Python24\sitecustomize.py
or
C:\Python24\pythonw.exe E:\Python24\Lib\idlelib\idle.py -c "import os;
from path import path"
content of my sitecustomize.py is:
"
import os
from path import path
"
and both ways of invoking IDLE have the same effect (apparently of faking
execution of not shown input line) of making the modules os and the class
path available at start of IDLE.
My question in this context:
Can the PyShell.py file in C:\Python24\Lib\idlelib directory be edited
somehow to achieve same effect?
Claudio
Okey I tried what you recommended
My C:\Python24\sitecustomize.py looks like this:
# sitecustomize.py
import os
from btools import *
When I enter
C:\Python24>C:\Python24\pythonw.exe C:\Python24\Lib\idlelib\idle.py -r
C:\Python24\sitecustomize.py
in commad propmt IDLE starts up and automatically imports 'os' and all
names from my btools folder. So far so good. But when I hit Ctrl+F6 and
restart Python Shell both 'os' and names from btools are gone!
When I work with IDLE I typically start a new file (File/New Window)
and when I have written the code I hit (Ctrl+S) to Save and F5 to run.
This restarts Python Shell and my names from btools are gone. It's no
solution if I'm forced to go back to command prompt and enter the long
sequance again.
Bob
Okey I tried what you recommended
My C:\Python24\sitecustomize.py looks like this:
# sitecustomize.py
import os
from btools import *
When I enter
C:\Python24>C:\Python24\pythonw.exe C:\Python24\Lib\idlelib\idle.py -r
C:\Python24\sitecustomize.py
in commad propmt IDLE starts up and automatically imports 'os' and all
names from my btools folder. So far so good. But when I hit Ctrl+F6 and
restart Python Shell both 'os' and names from btools are gone!
When I work with IDLE I typically start a new file (File/New Window)
and when I have written the code I hit (Ctrl+S) to Save and F5 to run.
This restarts Python Shell and my names from btools are gone. It's no
solution if I'm forced to go back to command prompt and enter the long
sequance again.
Bob
now a patch fixing it I have no good feeling about, but it works:
in PyShell.py in
def restart_subprocess(self):
insert in section:
"
console.showprompt()
# restart subprocess debugger
# (-Patch)
# making additional modules available in IDLE directly after
re-start of it:
self.runsource("import os; from path import path")
# (Patch-)
if debug:
"
This will provide the modules also after restart.
Hope this will not crash elsewhere because of unexpected effects of
inserting the runsource() method at that point in the code without any other
commands which are maybe necessary to keep IDLE consistent.
So IDLE experts, HELP PLEASE !!!
Claudio
<bo*******@yahoo.com> schrieb im Newsbeitrag
news:11********************@f14g2000cwb.googlegrou ps.com... Okey I tried what you recommended
My C:\Python24\sitecustomize.py looks like this:
# sitecustomize.py import os from btools import *
When I enter C:\Python24>C:\Python24\pythonw.exe C:\Python24\Lib\idlelib\idle.py -r C:\Python24\sitecustomize.py
in commad propmt IDLE starts up and automatically imports 'os' and all names from my btools folder. So far so good. But when I hit Ctrl+F6 and restart Python Shell both 'os' and names from btools are gone!
When I work with IDLE I typically start a new file (File/New Window) and when I have written the code I hit (Ctrl+S) to Save and F5 to run. This restarts Python Shell and my names from btools are gone. It's no solution if I'm forced to go back to command prompt and enter the long sequance again.
Bob
now a patch fixing it I have no good feeling about, but it works:
in PyShell.py in
def restart_subprocess(self):
insert in section:
"
console.showprompt()
# restart subprocess debugger
# (-Patch)
# making additional modules available in IDLE directly after
re-start of it:
self.runsource("import os; from path import path")
# (Patch-)
if debug:
"
This will provide the modules also after restart.
Hope this will not crash elsewhere because of unexpected effects of
inserting the runsource() method at that point in the code without any other
commands which are maybe necessary to keep IDLE consistent.
So IDLE experts, HELP PLEASE !!!
Claudio
<bo*******@yahoo.com> schrieb im Newsbeitrag
news:11********************@f14g2000cwb.googlegrou ps.com... Okey I tried what you recommended
My C:\Python24\sitecustomize.py looks like this:
# sitecustomize.py import os from btools import *
When I enter C:\Python24>C:\Python24\pythonw.exe C:\Python24\Lib\idlelib\idle.py -r C:\Python24\sitecustomize.py
in commad propmt IDLE starts up and automatically imports 'os' and all names from my btools folder. So far so good. But when I hit Ctrl+F6 and restart Python Shell both 'os' and names from btools are gone!
When I work with IDLE I typically start a new file (File/New Window) and when I have written the code I hit (Ctrl+S) to Save and F5 to run. This restarts Python Shell and my names from btools are gone. It's no solution if I'm forced to go back to command prompt and enter the long sequance again.
Bob
I did as you suggested, however
after I make a new File (File/New Window) and save and then run (F5) I
get the following alert
The Python Shell is already executing a command; please waith until it
is finished
I also get the error message
Traceback (most recent call last):
File "<pyshell#1>", line 1, in -toplevel-
import os; from path import path
ImportError: No module named path
Bob
I did as you suggested, however
after I make a new File (File/New Window) and save and then run (F5) I
get the following alert
The Python Shell is already executing a command; please waith until it
is finished
I also get the error message
Traceback (most recent call last):
File "<pyshell#1>", line 1, in -toplevel-
import os; from path import path
ImportError: No module named path
Bob
<bo*******@yahoo.com> schrieb im Newsbeitrag
news:11**********************@g43g2000cwa.googlegr oups.com... I did as you suggested, however
after I make a new File (File/New Window) and save and then run (F5) I get the following alert
The Python Shell is already executing a command; please waith until it is finished
I also get the error message
Traceback (most recent call last): File "<pyshell#1>", line 1, in -toplevel- import os; from path import path ImportError: No module named path
Bob
Sure you have to replace "import os; from path import path"
with " from btools import *", than you avoid the error message
but not the problem you have got with the message box.
A "solution" to the problem with the message box may be as follows:
"
console.showprompt()
# restart subprocess debugger
# (-Patch)
# making additional modules available in IDLE directly after
re-start of it:
self.runsource("import os; from path import path")
time.sleep(0.1)
# (Patch-)
if debug:
"
If 0.1 doesn't work on your system, just increase the value, but this will
delay the response.
e.g. 0.001 doesn't work for me, but 0.1 does (Intel Pentium 4 running at 2.8
GHz).
Claudio
<bo*******@yahoo.com> schrieb im Newsbeitrag
news:11**********************@g43g2000cwa.googlegr oups.com... I did as you suggested, however
after I make a new File (File/New Window) and save and then run (F5) I get the following alert
The Python Shell is already executing a command; please waith until it is finished
I also get the error message
Traceback (most recent call last): File "<pyshell#1>", line 1, in -toplevel- import os; from path import path ImportError: No module named path
Bob
Sure you have to replace "import os; from path import path"
with " from btools import *", than you avoid the error message
but not the problem you have got with the message box.
A "solution" to the problem with the message box may be as follows:
"
console.showprompt()
# restart subprocess debugger
# (-Patch)
# making additional modules available in IDLE directly after
re-start of it:
self.runsource("import os; from path import path")
time.sleep(0.1)
# (Patch-)
if debug:
"
If 0.1 doesn't work on your system, just increase the value, but this will
delay the response.
e.g. 0.001 doesn't work for me, but 0.1 does (Intel Pentium 4 running at 2.8
GHz).
Claudio
Here a correction of the code snippet:
console.text.mark_gravity("restart", "left")
# (-Patch)
# making additional modules available in IDLE directly after
re-start of it:
self.runsource("import os; from path import path")
time.sleep(0.1)
# (Patch-)
console.showprompt()
# restart subprocess debugger
I have no slightest idea why does it make a difference.
What would make much more sense for me is to wait until
self.tkconsole.executing
is False
but this resulted in an endless loop ...
Claudio
"Claudio Grondi" <cl************@freenet.de> schrieb im Newsbeitrag
news:3u************@individual.net... <bo*******@yahoo.com> schrieb im Newsbeitrag news:11**********************@g43g2000cwa.googlegr oups.com... I did as you suggested, however
after I make a new File (File/New Window) and save and then run (F5) I get the following alert
The Python Shell is already executing a command; please waith until it is finished
I also get the error message
Traceback (most recent call last): File "<pyshell#1>", line 1, in -toplevel- import os; from path import path ImportError: No module named path>> Bob Sure you have to replace "import os; from path import path" with " from btools import *", than you avoid the error message but not the problem you have got with the message box. A "solution" to the problem with the message box may be as follows:
" console.showprompt() # restart subprocess debugger
# (-Patch) # making additional modules available in IDLE directly after re-start of it: self.runsource("import os; from path import path") time.sleep(0.1) # (Patch-)
if debug: " If 0.1 doesn't work on your system, just increase the value, but this will delay the response. e.g. 0.001 doesn't work for me, but 0.1 does (Intel Pentium 4 running at
2.8 GHz).
Claudio
Here a correction of the code snippet:
console.text.mark_gravity("restart", "left")
# (-Patch)
# making additional modules available in IDLE directly after
re-start of it:
self.runsource("import os; from path import path")
time.sleep(0.1)
# (Patch-)
console.showprompt()
# restart subprocess debugger
I have no slightest idea why does it make a difference.
What would make much more sense for me is to wait until
self.tkconsole.executing
is False
but this resulted in an endless loop ...
Claudio
"Claudio Grondi" <cl************@freenet.de> schrieb im Newsbeitrag
news:3u************@individual.net... <bo*******@yahoo.com> schrieb im Newsbeitrag news:11**********************@g43g2000cwa.googlegr oups.com... I did as you suggested, however
after I make a new File (File/New Window) and save and then run (F5) I get the following alert
The Python Shell is already executing a command; please waith until it is finished
I also get the error message
Traceback (most recent call last): File "<pyshell#1>", line 1, in -toplevel- import os; from path import path ImportError: No module named path>> Bob Sure you have to replace "import os; from path import path" with " from btools import *", than you avoid the error message but not the problem you have got with the message box. A "solution" to the problem with the message box may be as follows:
" console.showprompt() # restart subprocess debugger
# (-Patch) # making additional modules available in IDLE directly after re-start of it: self.runsource("import os; from path import path") time.sleep(0.1) # (Patch-)
if debug: " If 0.1 doesn't work on your system, just increase the value, but this will delay the response. e.g. 0.001 doesn't work for me, but 0.1 does (Intel Pentium 4 running at
2.8 GHz).
Claudio
This works!
Thanks Claudio
For complete happiness I would also like to know what's hapening. Is
there anywhere I can read about PyShell.py.
Bob
This works!
Thanks Claudio
For complete happiness I would also like to know what's hapening. Is
there anywhere I can read about PyShell.py.
Bob
<bo*******@yahoo.com> wrote This works!
Thanks Claudio
I am glad, that the time I put into it was not wasted.
For complete happiness I would also like to know what's hapening. Is there anywhere I can read about PyShell.py.
Not that I would know about (except reading the source code).
Maybe this below is the right place to ask further questions (2004 there was
a discussion about IDLE): http://mail.python.org/mailman/listinfo/tutor
but I have to admit, I haven't used this forum myself yet.
From my experience with learning Python I suppose, that it will be not very
easy to fully understand what is going on in IDLE (i.e. in PyShell.py)
because this probably requires full understanding of the Tkinter interface
and some insight into deep Python internals. Perhaps this is the reason why
noone knowledgable in this area has responded here expecting from a response
more trouble than success?
Claudio
<bo*******@yahoo.com> wrote This works!
Thanks Claudio
I am glad, that the time I put into it was not wasted.
For complete happiness I would also like to know what's hapening. Is there anywhere I can read about PyShell.py.
Not that I would know about (except reading the source code).
Maybe this below is the right place to ask further questions (2004 there was
a discussion about IDLE): http://mail.python.org/mailman/listinfo/tutor
but I have to admit, I haven't used this forum myself yet.
From my experience with learning Python I suppose, that it will be not very
easy to fully understand what is going on in IDLE (i.e. in PyShell.py)
because this probably requires full understanding of the Tkinter interface
and some insight into deep Python internals. Perhaps this is the reason why
noone knowledgable in this area has responded here expecting from a response
more trouble than success?
Claudio
I made bat file called startidle.bat which I put in C:\Python24
directory. This is how it looks
@echo off
start C:\Python24\pythonw.exe C:\Python24\Lib\idlelib\idle.py -r
C:\Python24\sitecustomize.py
exit
Now I put a shortcut of startidle.bat in Quick Launch. The only thing I
have to do now is to click on the shortcut icon in the Quick Launch and
I'm up and running.
Alla Tua Salute Claudio
Bob
I made bat file called startidle.bat which I put in C:\Python24
directory. This is how it looks
@echo off
start C:\Python24\pythonw.exe C:\Python24\Lib\idlelib\idle.py -r
C:\Python24\sitecustomize.py
exit
Now I put a shortcut of startidle.bat in Quick Launch. The only thing I
have to do now is to click on the shortcut icon in the Quick Launch and
I'm up and running.
Alla Tua Salute Claudio
Bob This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: tony.ha |
last post by:
Hello,
I have a question about Python IDLE, when I run a Python script under the
Edit Window of IDLE, i.e Run -> Run Module,
I have the following Message:
IDLE 1.0.3
>>>
Warning: HOME...
|
by: Russ P. |
last post by:
I've been programming in python for a few years using XEmacs on
Solaris and Linux. I've been thinking about trying IDLE for a long
time, but either it wasn't available on my system or I...
|
by: Terry Reedy |
last post by:
Murphy.MarkS@epamail.epa.gov wrote:
I have both 2.5.2 and 3.0b2 loaded for all users on stock xp with all
upgrades. I put /Python25 and /Python30 under Program Files instead of
C:. As normal...
|
by: Terry Reedy |
last post by:
Sebastian Bassi wrote:
Depending on the answer you get here, you might send the same
observation and question to webmaster@python.org
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |