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 3327
<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: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |