Re: newbie - How do I import automatically?

2005-11-16 Thread Claudio Grondi
Just edit the first lines of %SystemDrive%\Python24\Lib\idlelib\PyShell.py yourself (not tested, but I have customized Idle intitial message using it and it worked ok - after new Python installation I overwrite this file with my own version to keep this customization.) Hope this helps. Claudio

Re: newbie - How do I import automatically?

2005-11-16 Thread bobueland
I tried to put the line from btools import * in several places in PyShell.py but to now avail. It does not work, IDLE does not execute it??? Bob -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie - How do I import automatically?

2005-11-16 Thread Claudio Grondi
[EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED]... I tried to put the line from btools import * in several places in PyShell.py but to now avail. It does not work, IDLE does not execute it??? Bob I have to give up here :-( . The best solution I am able to come up with is:

Re: newbie - How do I import automatically?

2005-11-16 Thread bobueland
Where do I put def runsource(self, source): if(source == ''): source = 'from btools import *' Extend base class method: Stuff the source in the line cache first filename = self.stuffsource(source) Do I put it in Pyshell.py or somewhere else? Bob --

Re: newbie - How do I import automatically?

2005-11-16 Thread Claudio Grondi
Probably you have inbetween already found the 'def runsource(' line in the PyShell.py , but maybe you still wait for a reply, so here it is: yes, you put the two lines at the beginning of in PyShell.py existing runsource() method of the class ModifiedInterpreter(InteractiveInterpreter) If in my

Re: newbie - How do I import automatically?

2005-11-16 Thread Steve M
The file C:\Python24\Lib\sitecustomize.py (which I think doesn't exist by default) executes every time Python starts. (This means not just your IDLE session but every time you run any Python script.) One use for this file is to invoke sys.setdefaultencoding because that name gets deleted during

newbie - How do I import automatically?

2005-11-15 Thread bobueland
When I start Python Shell I can see that some names or loaded automatically, ready for me to use dir() ['__builtins__', '__doc__', '__name__'] I have written some functions in a file called btools.py. I would like to import them automatically when I start up Python shell. Today I must do it by

Re: newbie - How do I import automatically?

2005-11-15 Thread Brett Hoerner
I have written some functions in a file called btools.py. I would like to import them automatically when I start up Python shell. Today I must do it by hand like this from btools import * dir() ['__builtins__', '__doc__', '__name__', 'func1', 'func2', 'func3'] Is there a way to do

Re: newbie - How do I import automatically?

2005-11-15 Thread Mike Meyer
[EMAIL PROTECTED] writes: I have written some functions in a file called btools.py. I would like to import them automatically when I start up Python shell. Today I must do it by hand like this from btools import * dir() ['__builtins__', '__doc__', '__name__', 'func1', 'func2', 'func3']

Re: newbie - How do I import automatically?

2005-11-15 Thread bobueland
I've tried as you said but it doesn't work. I'm working with Windows XP. I right click at my computer go to Advanced, choose Environment Variables and set PYTHONSTARTUP variable to C:\Python24\binit.py. It looks like this # binit.py from btools import * I've restarted the computer and started

Re: newbie - How do I import automatically?

2005-11-15 Thread bobueland
I also checked in command prompt, and there it works!, but not in IDLE. And it's in IDLE that I work all the time. Can anything be done to get it to work there? Bob -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie - How do I import automatically?

2005-11-15 Thread Mike Meyer
[EMAIL PROTECTED] writes: I've tried as you said but it doesn't work. I'm working with Windows XP. I right click at my computer go to Advanced, choose Environment Variables and set PYTHONSTARTUP variable to C:\Python24\binit.py. It looks like this # binit.py from btools import * I've