Re: [Tutor] Spell checking source code?

2009-06-02 Thread ALAN GAULD

> From: "wormina...@gmail.com" 
> To: Alan Gauld 
> Sent: Tuesday, 2 June, 2009 1:09:39 AM
> Subject: Re: [Tutor] Spell checking source code?
> 
> In vim,
> 
> :set spell
> :set nospell
> :help spell


But that will check the whole file. The OP only wanted to spell
check the comments. Unless I'm missing something?
 
Alan Gauld
Author of the Learn To Program website
http://www.alan-g.me.uk/
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Text.index()

2009-06-02 Thread prasad rao
Hello
 I created a gui app.I am finding it impossible to
use Text.insert().please some one give an example of using it.

def fshow():
x=entry1.get()

try:
  value1,value2=x.split(',')

  text.insert(len(myfiles(value1,value2)),myfiles(value1,value2))
except:
text.insert(len(myfiles(value1,value2)),myfiles(x))

>>> import example4
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python26\lib\lib-tk\Tkinter.py", line 1410, in __call__
return self.func(*args)
  File "C:\Python26\example4.py", line 37, in fshow
text.insert(len(myfiles(value1,value2)),myfiles(x))
  File "C:\Python26\lib\lib-tk\Tkinter.py", line 3001, in insert
self.tk.call((self._w, 'insert', index, chars) + args)
TclError: bad text index "178"

 import example4
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python26\lib\lib-tk\Tkinter.py", line 1410, in __call__
return self.func(*args)
  File "C:\Python26\example4.py", line 37, in fshow
text.insert(None,myfiles(x))
  File "C:\Python26\lib\lib-tk\Tkinter.py", line 3001, in insert
self.tk.call((self._w, 'insert', index, chars) + args)
TclError: wrong # args: should be ".18428952.18430232 insert index chars
?tagList chars tagList ...?"
I cant understand what these error messages are telling.

Thanking you

Prasad
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] delphi, pascal and Python

2009-06-02 Thread Andy Cheesman
After Much Looking and pointers from the author, There is this most
excellent post by the same author at

http://wiki.lazarus.freepascal.org/Developing_Python_Modules_with_Pascal

This nearly works but I have issue with the linking of the new module. The
error is

Linking PyMinMod.so
/usr/bin/ld: Python: No such file: No such file or directory

I've no clue what the issue is and I don't understand what should be going
on. I'm running 64bit ubuntu. I know this might be a bit off topic, but if
someone could point me in the right direction, I would be rather grateful

Thanks
Andy



>
> "Marc Tompkins"  wrote
>
>>>  Is there a Method for wrapping delphi and/or pascal code into python
>>> like
 SWIG?
>>> http://membres.lycos.fr/marat/delphi/python.htm
>>
>> That's a package to let you embed Python in Delphi; the OP wants to go
>> the
>> other direction.
>
> So it is, I didn't read the OP question closely enough.
>
> On Windows you could create a DLL and use ctypes to access it,
> but thats not the same as creating an importable module as could
> be done with SWIG
>
> Alan G.
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Text.index()

2009-06-02 Thread Lie Ryan
prasad rao wrote:
> Hello
>  I created a gui app.I am finding it impossible to
> use Text.insert().please some one give an example of using it.
>  

In Tkinter.Text, insert's argument is a string of the form
"line.collumn" instead of a number.

>>> tb.insert("2.6", 'abc')


you usually use %-formatting to create such string.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Spell checking source code?

2009-06-02 Thread W W
On Tue, Jun 2, 2009 at 3:15 AM, ALAN GAULD wrote:

>
> > From: "wormina...@gmail.com" 
> > To: Alan Gauld 
> > Sent: Tuesday, 2 June, 2009 1:09:39 AM
> > Subject: Re: [Tutor] Spell checking source code?
> >
> > In vim,
> >
> > :set spell
> > :set nospell
> > :help spell
>
>
> But that will check the whole file. The OP only wanted to spell
> check the comments. Unless I'm missing something?


Shouldn't be too difficult to write a vim script to check only # to EOL, '
to ', " to ", ''' to ''' and "" to """. I think that's the only non-code
available?
-Wayne
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Text.index()

2009-06-02 Thread Alan Gauld


"prasad rao"  wrote


I created a gui app.I am finding it impossible to
use Text.insert().please some one give an example of using it.


Look in my tutorial at event driven programming and the Case study. Both 
use the Text widget.



For more detailed info try this introduction:

http://www.linuxjournal.com/article/7357

Or for more detailed info:

http://www.pythonware.com/library/tkinter/introduction/x7883-concepts.htm


 text.insert(len(myfiles(value1,value2)),myfiles(value1,value2))


I'm not sure what you expected this to do but it looks like you are trying 
to locate
the cursor at the positionn defined by the lengths of your myfiles? But 
then you

don't actually provide any data to insert!

Did you read the Tkinter tutorial on the Text widget?



   self.tk.call((self._w, 'insert', index, chars) + args)
TclError: bad text index "178"

 File "C:\Python26\example4.py", line 37, in fshow
   text.insert(None,myfiles(x))
 File "C:\Python26\lib\lib-tk\Tkinter.py", line 3001, in insert
   self.tk.call((self._w, 'insert', index, chars) + args)
TclError: wrong # args: should be ".18428952.18430232 insert index chars
?tagList chars tagList ...?"
I cant understand what these error messages are telling.


They are both telling you that you are passing the wrong information to 
Text.
It expects an index (in the form of a decimal as dwescribed in the links 
above)

and some text, plus optionally some flags.

Please read the documentation then ask some specific questions
about what you don't understand. The Text widget is immensley powerful
so you need to spend some time studying it to get the best out of it.


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] serious problem with graphics module

2009-06-02 Thread roberto
On Tue, May 26, 2009 at 12:28 AM, Gregor Lingl  wrote:
>
>
> roberto schrieb:
> Do you use Python from the command line (terminal) or do you use IDLE?
> I ask this, because these two show different behaviour.
i use IDLE, in Python 3.0

>>
>> i have a problem with python 3.0 graphics module:
>>
>> no problem while importing the module
>>
>
> import turtle
>
>>
>> but when i issue any command like:
>>
>
> t = turtle.pen()
>
>
> After performing this command you should be able to observe
> a blank window with a tiny black arrow - it's the turtle
yes, i can see it but each time i try to get into that window, the
mouse pointer switch to the hourglass look and i cannot do anything
over the windwow;
moreover, if i try to click or move it, WS Xp tells me the program
pythonw.exe is not responding
>
> pen() is a function in the module turtle. It returns a dictionary
> of the attributes of the turtle's pen. Have a look at it:
>
 print(t)
> {'pensize': 1, 'resizemode': 'noresize', 'pendown': True, 'fillcolor':
> 'black',
> 'speed': 3, 'shown': True, 'outline': 1, 'tilt': 0.0, 'pencolor': 'black',
> 'stretchfactor': (1.0, 1.0), 'shearfactor': 0.0}

yes, i get a very similar answer

>
> t = turtle.forward(60)
>
>>
>> nothing appears on the screen, only a blank window, with nothing inside;
>> may you give me some hint ?
>>
>
>
> What happens if you do this?
>
 from turtle import *
 for i in range(4):
>       forward(100)
>       left(90)
>
as i wrote before, i can see the arrow inside the graphic window but i
cannot do anything inside it, i mean i cannot move or resize the
window etc.

anyway, yes i can see the arrow moving and drawing the square correctly

ps: i'll answer to your other mails also, thank you very much Gregor
-- 
roberto
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] serious problem with graphics module

2009-06-02 Thread roberto
On Tue, May 26, 2009 at 12:45 AM, Gregor Lingl  wrote:
> I know one situation in which can happen what you describe:
>
> If you use IDLE, issue the above commands and your Idle-shell-window
> covers the graphics window - then you have to move the shell window in order
> to see what's on the graphics window. Alas, in this situation the graphics
> window may get nonresponsive (to the Windows-event-queue) and may not
> be refreshed. So it remains apparentl empty. You may also experience
> problems when trying to close the window (because of the same reasons).
right !

>
> *Remedy*: if you use the turtle module interactively, you have to use Idle
> with the -n flag, which prevents it from using subprocesses for executing
> scripts.
>
> I recommend to prepare a special shortcut on your desktop, something
> like this:
>
> C:\Python30\pythonw.exe C:\Python30\Lib\idlelib\idle.pyw -n
>
> When you fire up Idle with this link you will get the text:
>
>  No Subprocess 
>
> above your first input prompt.
> Now you can enter your commands and everything should work fine.
>
ok, it works all right now

the minor issue is that i could not create the shortcut with the -n
flag as you pointed out, that's why i issued both commands:
C:\Python30\pythonw.exe
C:\Python30\Lib\idlelib\idle.pyw -n

via the C: prompt

and the graphic window finally worked correctly

thank you again

-- 
roberto
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] python workspace

2009-06-02 Thread roberto
hello,
i'd like to ask if there is anything in python which helps to see what
variables have been defined and their type and their dimension etc;

if any of you has ever used Matlab, i mean something really similar to
its workspace, where all the user created variables are stored and
constantly updated

thank you
-- 
roberto
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python workspace

2009-06-02 Thread Gökhan SEVER
Hi,

Have you tried Ipython?

https://launchpad.net/ipython

And also there is and on-going work called pydee (
http://code.google.com/p/pydee/) which they plan to integrate Ipython into a
GUI very similar to the one in Matlab.

Gökhan


On Tue, Jun 2, 2009 at 10:54 AM, roberto  wrote:

> hello,
> i'd like to ask if there is anything in python which helps to see what
> variables have been defined and their type and their dimension etc;
>
> if any of you has ever used Matlab, i mean something really similar to
> its workspace, where all the user created variables are stored and
> constantly updated
>
> thank you
> --
> roberto
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] serious problem with graphics module

2009-06-02 Thread Lie Ryan
roberto wrote:
> On Tue, May 26, 2009 at 12:45 AM, Gregor Lingl  wrote:
>> I know one situation in which can happen what you describe:
>>
>> If you use IDLE, issue the above commands and your Idle-shell-window
>> covers the graphics window - then you have to move the shell window in order
>> to see what's on the graphics window. Alas, in this situation the graphics
>> window may get nonresponsive (to the Windows-event-queue) and may not
>> be refreshed. So it remains apparentl empty. You may also experience
>> problems when trying to close the window (because of the same reasons).
> right !
> 
>> *Remedy*: if you use the turtle module interactively, you have to use Idle
>> with the -n flag, which prevents it from using subprocesses for executing
>> scripts.
>>
>> I recommend to prepare a special shortcut on your desktop, something
>> like this:
>>
>> C:\Python30\pythonw.exe C:\Python30\Lib\idlelib\idle.pyw -n
>>
>> When you fire up Idle with this link you will get the text:
>>
>>  No Subprocess 
>>
>> above your first input prompt.
>> Now you can enter your commands and everything should work fine.
>>
> ok, it works all right now
> 
> the minor issue is that i could not create the shortcut with the -n
> flag as you pointed out, that's why i issued both commands:
> C:\Python30\pythonw.exe
> C:\Python30\Lib\idlelib\idle.pyw -n
> 
> via the C: prompt
> 
> and the graphic window finally worked correctly
> 
> thank you again
> 

Be aware though that using IDLE without subprocess also has its own
problems such as leaked variables from previous execution. Although IDLE
tries to clear itself up sometimes there are things that still leaves
various odd effects here and there especially with Tkinter itself. The
real solution would be to give up IDLE and use python from cmd.exe

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python workspace

2009-06-02 Thread Lie Ryan
roberto wrote:
> hello,
> i'd like to ask if there is anything in python which helps to see what
> variables have been defined and their type and their dimension etc;
> 
> if any of you has ever used Matlab, i mean something really similar to
> its workspace, where all the user created variables are stored and
> constantly updated
> 
> thank you

You can use pdb (python debugger) module; and if you're using IDLE the
Debugger Window will keep track and show variables. Personally, I
usually simply sprawl print here and there.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python workspace

2009-06-02 Thread roberto
On Tue, Jun 2, 2009 at 6:07 PM, Gökhan SEVER  wrote:
> Hi,
>
> Have you tried Ipython?
>
> https://launchpad.net/ipython
not yet

>
> And also there is and on-going work called pydee
> (http://code.google.com/p/pydee/) which they plan to integrate Ipython into
> a GUI very similar to the one in Matlab.
great ! that is probably what i was looking for
but it still runs on python 2.x, isn't it ?
i do not hope so :)

>
> Gökhan
>
>
> On Tue, Jun 2, 2009 at 10:54 AM, roberto  wrote:
>>
>> hello,
>> i'd like to ask if there is anything in python which helps to see what
>> variables have been defined and their type and their dimension etc;
>>
>> if any of you has ever used Matlab, i mean something really similar to
>> its workspace, where all the user created variables are stored and
>> constantly updated
>>
>> thank you
>> --
>> roberto
>> ___
>> Tutor maillist  -  tu...@python.org
>> http://mail.python.org/mailman/listinfo/tutor
>
>



-- 
roberto
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python workspace

2009-06-02 Thread Emile van Sebille

On 6/2/2009 8:54 AM roberto said...

hello,
i'd like to ask if there is anything in python which helps to see what
variables have been defined and their type and their dimension etc;


In appropriate contexts, you may be able to use a variant of:

from pprint import pprint
pprint (locals())

HTH,

Emile




if any of you has ever used Matlab, i mean something really similar to
its workspace, where all the user created variables are stored and
constantly updated

thank you


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] How o convert spaces into tabs??

2009-06-02 Thread jyotsna guleria
Hello every one,

I am trying to parse a file:

I want to convert all the spaces in between the characters to single tab.

e.g: my file has contents like:

1G579011  10  2   0  00
0   0   00
5Ht-2  60459  11  0   0  00
0   0   00


I want them to be separated by a single tab not with spaces..

It should look like:

1G5790111020000000
5Ht-2604591100000000

each separated by Tab...

It is a text file containing such a data ..


Thanks
-- 
Jyotsna Guleria
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How o convert spaces into tabs??

2009-06-02 Thread W W
On Tue, Jun 2, 2009 at 12:42 PM, jyotsna guleria
wrote:

>
> Hello every one,
>
> I am trying to parse a file:
>
> I want to convert all the spaces in between the characters to single tab.
>
> e.g: my file has contents like:
>
> 1G579011  10  2   0  00
> 0   0   00
> 5Ht-2  60459  11  0   0  00
> 0   0   00
>
>
> I want them to be separated by a single tab not with spaces..
>
> It should look like:
>
> 1G5790111020000000
> 5Ht-2604591100000000
>
> each separated by Tab...
>
> It is a text file containing such a data ..
>

Easiest way I know of goes something like this:

for line in myfile:
   newline = '\t'.join(line.split())

Consider:

In [16]: x = 'the quick brownfox   ate   some   spam and eggs'

In [17]: x.split()
Out[17]: ['the', 'quick', 'brown', 'fox', 'ate', 'some', 'spam', 'and',
'eggs']

In [18]: '\t'.join(x.split())
Out[18]: 'the\tquick\tbrown\tfox\tate\tsome\tspam\tand\teggs'

In [19]: print '\t'.join(x.split())
the quick   brown   fox ate somespamand eggs


HTH,
Wayne
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python workspace

2009-06-02 Thread Dave Angel

roberto  wrote:


On Tue, Jun 2, 2009 at 10:54 AM, roberto  wrote:
  

>>
>> hello,
>> i'd like to ask if there is anything in python which helps to see what
>> variables have been defined and their type and their dimension etc;
>>
>> if any of you has ever used Matlab, i mean something really similar to
>> its workspace, where all the user created variables are stored and
>> constantly updated
>>
>> thank you
>> --
>> roberto
  
You could use the commercial Komodo IDE.  It's got a debugger that runs 
the Python code as a separate process, so it can be used for GUI 
debugging as well as console work.  I use it with wxPython, and Python 2.6.2


http://www.activestate.com/komodo/



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How o convert spaces into tabs??

2009-06-02 Thread vince spicer
regex will do it


import re

line = re.sub(r"\s+", "\t", line)

print line



Vince

On Tue, Jun 2, 2009 at 11:42 AM, jyotsna guleria
wrote:

>
> Hello every one,
>
> I am trying to parse a file:
>
> I want to convert all the spaces in between the characters to single tab.
>
> e.g: my file has contents like:
>
> 1G579011  10  2   0  00
> 0   0   00
> 5Ht-2  60459  11  0   0  00
> 0   0   00
>
>
> I want them to be separated by a single tab not with spaces..
>
> It should look like:
>
> 1G5790111020000000
> 5Ht-2604591100000000
>
> each separated by Tab...
>
> It is a text file containing such a data ..
>
>
> Thanks
> --
> Jyotsna Guleria
>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python workspace

2009-06-02 Thread Gökhan SEVER
In Ipython If you just type local() you get a pretty printed out without a
need for an explicit pprint call.

Secondly, Ipython works only for 2.4-5-6  as of now. Here what the
documentation says:

"We have not begun to test IPython on Python 2.6 or 3.0, but we expect it
will work with some minor changes."

Gökhan


On Tue, Jun 2, 2009 at 12:47 PM, Emile van Sebille  wrote:

> On 6/2/2009 8:54 AM roberto said...
>
>> hello,
>> i'd like to ask if there is anything in python which helps to see what
>> variables have been defined and their type and their dimension etc;
>>
>
> In appropriate contexts, you may be able to use a variant of:
>
> from pprint import pprint
> pprint (locals())
>
> HTH,
>
> Emile
>
>
>
>> if any of you has ever used Matlab, i mean something really similar to
>> its workspace, where all the user created variables are stored and
>> constantly updated
>>
>> thank you
>>
>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How o convert spaces into tabs??

2009-06-02 Thread शंतनू (Shantanoo)



jyotsna guleria wrote:

Hello every one,

I am trying to parse a file:

I want to convert all the spaces in between the characters to single tab.

e.g: my file has contents like:

1G579011  10  2   0  0
0   0   0   00
5Ht-2  60459  11  0   0  0
0   0   0   00



I want them to be separated by a single tab not with spaces..

It should look like:

1G5790111020000000
5Ht-2604591100000000

each separated by Tab...

It is a text file containing such a data ..


You can try re module.
More info at:
http://docs.python.org/library/re.html
http://www.regular-expressions.info/python.html

--
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How o convert spaces into tabs??

2009-06-02 Thread jyotsna guleria
Thank you very much..:)

On Tue, Jun 2, 2009 at 1:22 PM, W W  wrote:

> On Tue, Jun 2, 2009 at 12:42 PM, jyotsna guleria <
> jyotsna.gule...@gmail.com> wrote:
>
>>
>> Hello every one,
>>
>> I am trying to parse a file:
>>
>> I want to convert all the spaces in between the characters to single tab.
>>
>> e.g: my file has contents like:
>>
>> 1G579011  10  2   0  00
>> 0   0   00
>> 5Ht-2  60459  11  0   0  00
>> 0   0   00
>>
>>
>> I want them to be separated by a single tab not with spaces..
>>
>> It should look like:
>>
>> 1G5790111020000000
>> 5Ht-2604591100000000
>>
>> each separated by Tab...
>>
>> It is a text file containing such a data ..
>>
>
> Easiest way I know of goes something like this:
>
> for line in myfile:
>newline = '\t'.join(line.split())
>
> Consider:
>
> In [16]: x = 'the quick brownfox   ate   some   spam and eggs'
>
> In [17]: x.split()
> Out[17]: ['the', 'quick', 'brown', 'fox', 'ate', 'some', 'spam', 'and',
> 'eggs']
>
> In [18]: '\t'.join(x.split())
> Out[18]: 'the\tquick\tbrown\tfox\tate\tsome\tspam\tand\teggs'
>
> In [19]: print '\t'.join(x.split())
> the quick   brown   fox ate somespamand eggs
>
>
> HTH,
> Wayne
>



-- 
Jyotsna Guleria
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python workspace

2009-06-02 Thread Emile van Sebille

On 6/2/2009 11:34 AM Gökhan SEVER said...
In Ipython 


Good for IPYTHON -- I wasn't presuming that.

Emile

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How o convert spaces into tabs??

2009-06-02 Thread Martin Walsh
vince spicer wrote:
> 
> regex will do it
> 
> 
> import re
> 
> line = re.sub(r"\s+", "\t", line)
> 
> print line

The above replaces the newline, which reminds me that even seemingly
trivial uses of 're' can become not-so-trivial in a hurry.

In [1]: import re
In [2]: line = '1  2  3  4  5\n'
In [3]: re.sub('\s+', '\t', line)
Out[3]: '1\t2\t3\t4\t5\t'

Maybe this is closer to your intent, but I refuse to guarantee it ;)
Better to stick with str methods whenever possible.

In [4]: re.sub('[ ]+', '\t', line)
Out[4]: '1\t2\t3\t4\t5\n'

HTH,
Marty







___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Spell checking source code?

2009-06-02 Thread David

ALAN GAULD wrote:


But that will check the whole file. The OP only wanted to spell
check the comments. Unless I'm missing something?


"Allen Fowler"  wrote 
Are there any utilities to help "spell check" source code?  (Docstrings, etc)



I came up with this;
[sample file]
#!/usr/bin/python

def doc_test():
"""Do notheing, but document it.

No, really, it doesn't do anything.
"""
pass
[test program]
#!/usr/bin/python
from doc_function_test import doc_test
from enchant.checker import SpellChecker

doc_string = doc_test.__doc__
doc_string = str(doc_string)
chkr = SpellChecker("en_US")
chkr.set_text(doc_string)
for err in chkr:
print "Error:", err.word

[results]
python spell_check_doc.py
Error: notheing




--
Powered by Gentoo GNU/Linux
http://linuxcrazy.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python workspace

2009-06-02 Thread W W
On Tue, Jun 2, 2009 at 1:30 PM, Dave Angel  wrote:

> roberto  wrote:
>
>  On Tue, Jun 2, 2009 at 10:54 AM, roberto  wrote:
>>
>>
>>> >>
>>> >> hello,
>>> >> i'd like to ask if there is anything in python which helps to see what
>>> >> variables have been defined and their type and their dimension etc;
>>> >>
>>> >> if any of you has ever used Matlab, i mean something really similar to
>>> >> its workspace, where all the user created variables are stored and
>>> >> constantly updated
>>> >>
>>> >> thank you
>>> >> --
>>> >> roberto
>>>
>>
>>
> You could use the commercial Komodo IDE.  It's got a debugger that runs the
> Python code as a separate process, so it can be used for GUI debugging as
> well as console work.  I use it with wxPython, and Python 2.6.2
>
> http://www.activestate.com/komodo/


Wingware also has a commercial IDE, and most of the functionality is
included in the free student/personal use version. They were also generous
enough to donate I think it was 4 or 8 commercial licensees to our
PyArkansas un-conference. I played around with it a bit and it seemed like
quite a solid IDE.

HTH,
Wayne
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Suggested source code folder layout

2009-06-02 Thread Allen Fowler

Hello,

I'm looking for some suggestions as to the filesystem source code layout for a 
new project.

Here is what I am thinking so far:

root_folder/
- app/ -- Code for our pylons/django/TG/etc web app
- web/ -- Public static web files (and wsgi / fastCGI connector files)
- db/ -- SQlite DB
- scripts/ -- Various custom programs that will also interact with the DB / 
app. (Some cron, some interactive.)

However, I am still wondering about a couple of items:

1) Where to create the virtualpython installation that will be used by both the 
app and the scripts. 

2) Where to put our in-house created python modules that will be imported by 
both the app and scripts.

Thank you,
:)



  

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python workspace

2009-06-02 Thread Alan Gauld

"roberto"  wrote


i'd like to ask if there is anything in python which helps to see what
variables have been defined and their type and their dimension etc;


Bear in mind that Python variables are simply names so they 
have no type or dimension information. That belongs to the 
objects to which they refer.



if any of you has ever used Matlab, i mean something really similar to
its workspace, where all the user created variables are stored and
constantly updated


That having been said most debugger envioronments will show you 
the current variables in scope and their values. Certainly IDLE, 
Pythonwin and Eclipse/PyDev can all do that.


HTH,

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] serious problem with graphics module

2009-06-02 Thread Gregor Lingl



Lie Ryan schrieb:

roberto wrote:
  

On Tue, May 26, 2009 at 12:45 AM, Gregor Lingl  wrote:


I know one situation in which can happen what you describe:
  

...

ok, it works all right now

the minor issue is that i could not create the shortcut with the -n
flag as you pointed out, that's why i issued both commands:
C:\Python30\pythonw.exe
C:\Python30\Lib\idlelib\idle.pyw -n

via the C: prompt

and the graphic window finally worked correctly

thank you again



Be aware though that using IDLE without subprocess also has its own
problems such as leaked variables from previous execution. 
That's certainly true, and it was the reason for introducing Idle's 
feature to execute scripts

in their own subprocesses with Python 2.3

Despite of this I like to use Idle when working interactively with the 
turtle module and

also when developing small programs as it is much more comfortable than a
cmd-shell window. But I reglularly run them (during development)
from the 'normal' Idle (or from a cmd-shell) to assure that effects like 
those you mention

below are not present.

Does anyone have experience with using IPython with Tkinter?

Regards,
Gregor



Although IDLE
tries to clear itself up sometimes there are things that still leaves
various odd effects here and there especially with Tkinter itself. The
real solution would be to give up IDLE and use python from cmd.exe

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


  

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] serious problem with graphics module

2009-06-02 Thread W W
On Tue, Jun 2, 2009 at 7:12 PM, Gregor Lingl  wrote:

> 
> Does anyone have experience with using IPython with Tkinter?


Plenty, and it works wonderfully. I've never had any errors (that I know of)
that weren't of my own making ;)

My personal development environment consists of ipython for trying out
snippets, vim for writing my main blocks of code, and bazaar for version
control.

HTH,
Wayne
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor