473,769 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IDLE question

IDLE doesn't seem to honor PYTHONSTARTUP environment variable nor
sitecustomize.p y

How do you then customize in IDLE?

(basically I want to execute the statement
from btools import *
each time I restart IDLEs Python Shell)

Nov 22 '05 #1
18 3390

<bo*******@yaho o.com> schrieb im Newsbeitrag
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
IDLE doesn't seem to honor PYTHONSTARTUP environment variable nor
sitecustomize.p y

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\pyt honw.exe E:\Python24\Lib \idlelib\idle.p y -r
E:\Python24\sit ecustomize.py

or

C:\Python24\pyt honw.exe E:\Python24\Lib \idlelib\idle.p y -c "import os;
from path import path"

content of my sitecustomize.p y 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
Nov 22 '05 #2

<bo*******@yaho o.com> schrieb im Newsbeitrag
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
IDLE doesn't seem to honor PYTHONSTARTUP environment variable nor
sitecustomize.p y

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\pyt honw.exe E:\Python24\Lib \idlelib\idle.p y -r
E:\Python24\sit ecustomize.py

or

C:\Python24\pyt honw.exe E:\Python24\Lib \idlelib\idle.p y -c "import os;
from path import path"

content of my sitecustomize.p y 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
Nov 22 '05 #3
Okey I tried what you recommended

My C:\Python24\sit ecustomize.py looks like this:

# sitecustomize.p y
import os
from btools import *

When I enter
C:\Python24>C:\ Python24\python w.exe C:\Python24\Lib \idlelib\idle.p y -r
C:\Python24\sit ecustomize.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

Nov 22 '05 #4
Okey I tried what you recommended

My C:\Python24\sit ecustomize.py looks like this:

# sitecustomize.p y
import os
from btools import *

When I enter
C:\Python24>C:\ Python24\python w.exe C:\Python24\Lib \idlelib\idle.p y -r
C:\Python24\sit ecustomize.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

Nov 22 '05 #5
now a patch fixing it I have no good feeling about, but it works:

in PyShell.py in
def restart_subproc ess(self):

insert in section:
"
console.showpro mpt()
# 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*******@yaho o.com> schrieb im Newsbeitrag
news:11******** ************@f1 4g2000cwb.googl egroups.com...
Okey I tried what you recommended

My C:\Python24\sit ecustomize.py looks like this:

# sitecustomize.p y
import os
from btools import *

When I enter
C:\Python24>C:\ Python24\python w.exe C:\Python24\Lib \idlelib\idle.p y -r
C:\Python24\sit ecustomize.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

Nov 22 '05 #6
now a patch fixing it I have no good feeling about, but it works:

in PyShell.py in
def restart_subproc ess(self):

insert in section:
"
console.showpro mpt()
# 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*******@yaho o.com> schrieb im Newsbeitrag
news:11******** ************@f1 4g2000cwb.googl egroups.com...
Okey I tried what you recommended

My C:\Python24\sit ecustomize.py looks like this:

# sitecustomize.p y
import os
from btools import *

When I enter
C:\Python24>C:\ Python24\python w.exe C:\Python24\Lib \idlelib\idle.p y -r
C:\Python24\sit ecustomize.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

Nov 22 '05 #7
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

Nov 22 '05 #8
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

Nov 22 '05 #9

<bo*******@yaho o.com> schrieb im Newsbeitrag
news:11******** **************@ g43g2000cwa.goo glegroups.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.showpro mpt()
# 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
Nov 22 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1666
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 environment variable points to C:
5
2796
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 procrastinated. I finally have it available, and I gave it a try. I immediately encountered a basic problem for which I could not find a solution in the intro docs. I want to run a script in one directory that reads input from a file in another directory....
0
1043
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 non-admin user, I can edit files in ./misc (added by me) under either, or in ./Lib/site-packages/my_package or, of course, under My Documents. You did not specify the 'problems'. If it is saving (which is required to run a file), then perhaps...
0
961
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
0
9590
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9424
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10223
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
6675
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3968
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3571
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.