Re: Sourcing Python Developers

2007-01-29 Thread Kartic
Paul Rubin sayeth,  on 01/29/2007 03:44 PM:
> Kartic <[EMAIL PROTECTED]> writes:
>> In any case, we have immediate requirements for a Pythonista with C++,
>> MySQL, XML, Debian expertise. Please email resume to:
> 
> Generally it's ok to post here to the newsgroup with Python jobs.  But
> you should describe the specific openings you're trying to fill, and
> their locations.  

Paul - Thanks for the clarification; will use the list _sparingly_ post 
jobs.

The skills I listed are the once I have (Py, MySQL, C++, XML, Debian). 
Location: Torrance CA.
Compensation: Commensurate with Experience.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sourcing Python Developers

2007-01-29 Thread Kartic
Current requirements in US only.

Kartic sayeth,  on 01/29/2007 01:56 PM:
> Hello,
> 
> My company has quite a few opening involving python expertise. We are 
> always looking for python resources (and find it difficult filling these 
> positions, might I add). Is there any place to find developers' resumes 
> (like finding jobs from http://python.org/community/jobs/)? If any one 
> knows of a resume repository (other than Monster, Dice, 
> Costs-an-arm-and-leg job site) please share.
> 
> In any case, we have immediate requirements for a Pythonista with C++, 
> MySQL, XML, Debian expertise. Please email resume to: 
> python-resumes(at)temporaryforwarding.com
> 
> Thank you,
> --Kartic
-- 
http://mail.python.org/mailman/listinfo/python-list


Sourcing Python Developers

2007-01-29 Thread Kartic
Hello,

My company has quite a few opening involving python expertise. We are 
always looking for python resources (and find it difficult filling these 
positions, might I add). Is there any place to find developers' resumes 
(like finding jobs from http://python.org/community/jobs/)? If any one 
knows of a resume repository (other than Monster, Dice, 
Costs-an-arm-and-leg job site) please share.

In any case, we have immediate requirements for a Pythonista with C++, 
MySQL, XML, Debian expertise. Please email resume to: 
python-resumes(at)temporaryforwarding.com

Thank you,
--Kartic
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Any python based "Live Web Chat Support"

2007-01-12 Thread Kartic
johnny sayeth,  on 01/12/2007 11:11 AM:
 > Is there any open source "live web chat support" program or script out
 > there?  Any you can recommend?

Why don't you install ejabberd (a Jabber server implemented in erlang) 
and install Muckl (http://zeank.in-berlin.de/muckl/), an AJAX client for 
multi-user chat (or Jwchat for one on one chat). Both Muckl and JWChat 
are embeddable in a web page, as they use just HTML/Javascript, with 
some work.

Other than that, if you want to stick to a Python solution, I do believe 
Nevow project comes with a live chat demo, which you can customize.

--Kartic
-- 
http://mail.python.org/mailman/listinfo/python-list


[OT] Exciting Job Opporunity : Python and Configuration Management

2006-08-09 Thread Kartic
Hello,

We are looking for an experienced configuration management engineer for 
a client based in Cincinnati, Ohio. Below is a summary of the job. 
Kindly email resumes to email address shown below.

Thank you,
--Kartic

Job Title:  Configuration Management Engineer
Job Reference: OHCM

Job description:
o Fully responsible for change management processes
o Configuration management of sources, binaries as well as documentation


The ideal candidate will have:
o over two years of experience in change management and source code control
o over two years of experience in version control and related SDLC tasks
o over two years experience in configuration management tools for 
source, binary as well as document control.
o over two years of Python programming experience
o over five years of experience in application development (using 
languages like Python, Java, C, VB etc) as well as code maintenance
o strong analytical and problem-solving skills
o experience (desired but not required) in managing and administering 
server-based systems

Interested persons please email resume with cover letter to 
resumes(at)sfyi.com.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: html source

2006-02-14 Thread Kartic
Hi Steve (Young),

Here is my take. It is possible that the web page you are accessing 
dynamically generates the page using the user-agent.

The user-agent when used from urllib2 will be set to Python-urllib/x.x. 
If the page were generated dynamically, this would go into the "else" 
part (of the page-generation logic) and yield a page without all the 
fancy scripts.

Why don't you try setting the user-agent to same as the browser you are 
using and see if you get the same HTML source this time.

Refer http://diveintopython.org/http_web_services/user_agent.html on 
setting the user-agent.

Thanks,
--Kartic

The Great 'Steve Holden' uttered these words on 2/13/2006 4:53 PM:
> Steve Young wrote:
> 
>> Hi, I was wondering why when I use urllib2.build_opener().open(url), 
>> it doesn't give me the same thing as if I would just click on view--> 
>> source on my web browser. It gives me most of html on the page but 
>> leaves out lots of scripts and some of the link's urls are truncated. 
>> Is there something out there in python that gives me EXACTALLY the 
>> same thing as if you were to just do view-->source on the web browser? 
>> Thanks for the help.
>>
> If this observation is truly correct it should qualify as a bug. Can you 
> give us a URL and some code which demonstrate your assertion?
> 
> regards
>  Steve
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: FTP status problems. (Again)

2005-09-17 Thread Kartic
> Unfortunatly I stiill get the same error. :-(

The same "metaclass bases[]" error??

> Here is the code:
> import ftplib
-snip-
> if __name__ == '__main__':
>   ftp = ftplib.FTP("ftp.sadpanda.cjb.cc")
>   ftp.login("sadpanda","PASSWORDEDITIEDOUT")
>   filename = "/FrenchBrochure.pages.zip"
>   ftp.storbinary("STOR " + filename, ProgressFile(filename, "rb"), 1024)
> 
>   ftp.quit()


Your code works for me.. I just made one minor change.

I gave a different target name:

  filename = "/FrenchBrochure.pages.zip"
  target = "FrenchBrochure.pages.zip"
  ftp.storbinary("STOR " + target, ProgressFile(filename, "rb"), 1024)

Thanks,
-Kartic
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: FTP status problems. (Again)

2005-09-17 Thread Kartic
Hello,

 >  file = "/FrenchBrochure.pages.zip"
 >  ftp.storbinary("STOR " + file, ProgressFile(file, "rb"), 1024)

You are using file = "/FrenchBrochure.pages.zip" (sorry I did not notice 
earlier).

You can not use file as variable name like you have, as it represents a 
file object in python.

Please change your variable name from file to filename.

Thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: FTP status problems. (Again)

2005-09-17 Thread Kartic
That is because you have just taken marduk's program and included your 
ftp code... please see what he has done in the if __name__ == '__main__' 
part.

He expects the file name as an commandline argument (sys.argv[1]) and 
since you just copied his code, you are invoking the script *without* 
the argument. This is what the exception means when it says "list index 
out of range".

To make ProgressFile class work for you with the filename you have 
hardcoded... make the following modification to the "if __name ==" part:

if __name__ == '__main__':
ftp = ftplib.FTP("ftp.sadpanda.cjb.cc")
ftp.login("sadpanda","s4dp4nd4b1g")
file = "/FrenchBrochure.pages.zip.gz"
ftp.storbinary("STOR " + file, ProgressFile(file, "rb"), 1024)
ftp.quit()

Thanks,
-Kartic

The Great 'Nainto' uttered these words on 9/17/2005 9:08 AM:
> When I execute  the folllowing code with all of the address, username,
> and passwords filled out I gt an error saying:
> "/Library/Frameworks/Python.framework/Versions/2.4/Resources/Python.app/Contents/MacOS/Python"
> "/Users/zacim/Documents/FireUpFTP/foramttedthing" ; exit
> Traceback (most recent call last):
>   File "/Users/zacim/Documents/FireUpFTP/foramttedthing", line 26, in ?
> fname = sys.argv[1]
> IndexError: list index out of range
> logout
> [Process completed]
> 
> This is the code:
> 
> import ftplib
> class ProgressFile(file):
>   def read(self, size = None):
>   from sys import stdout
> 
>   if size is not None:
>   buff = file.read(self, size)
>   if buff:
>   stdout.write('.')
>   else:
>   stdout.write('\n')
>   return buff
>   else:
>   buff = ''
>   while True:
>   new_str = file.read(self, 1024)
>   stdout.write('.')
>   if new_str:
>   buff = buff + new_str
>   else:
>   stdout.write('\n')
>   break
>   return buff
> if __name__ == '__main__':
>   import sys
>   fname = sys.argv[1]
>   f = ProgressFile(fname)
>   f.read()
> 
> ftp = ftplib.FTP("ftp.sadpanda.cjb.cc")
> ftp.login("sadpanda","s4dp4nd4b1g")
> file = "/FrenchBrochure.pages.zip.gz"
> ftp.storbinary("STOR " + file, ProgressFile(file, "rb"), 1024)
> ftp.quit()
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problems with Python for Windows extensions

2005-09-07 Thread Kartic
The Great 'KK' uttered these words on 9/7/2005 7:57 AM:
> Hello,
> I guess you could reproduce my problem, Kartic. I have tried the one u
> suggested, but sadly it didn't work for me. I think the COM of pywin is
> quite tricky, or it might be a bug. I have some friends who also had
> experience of weird behaviors of pywin32, which makes me skeptical of
> using it in real app.
> 
> Thanks
> KK
> 

Actually, I have created some robust win32com applications (using Word 
and Excel) that work consistently on all installed machines.

Could it be an Office 2003 quirk? Did some other app of yours crash 
while using COM? Such crashes could produce unpredictable results in COM 
related code, from my experience.

So, if you think it is worth your time, you could probably investigate 
it a bit more or better contact Mark Hammond to see if he can help. I 
don't know if there is a win32com mailing list; if there is one, please 
post your question there too.

Thanks,
-Kartic
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python compiled?

2005-09-05 Thread Kartic
> One of the greatest problem that may discourage a new user to choose Python 
> language is it's interpreted nature.

Strange.. this is one reason I love Python :-)

> Another important problem is that no interpreter is installed on Windows 
> machine by default and this makes harder to distribute the software.
> Does it is planned that, in a far future, Python will implement a form of 
> compilation?
> This would be awesome. 

py2exe (http://starship.python.net/crew/theller/py2exe/) and pyinstaller 
(http://pyinstaller.hpcf.upr.edu/pyinstaller/) compile python programs 
into .exe files that can be executed on any Win32 machine.

So you can develop the code using the python interpreter and deploy it 
using either of these. I have used py2exe and nsis installer to create 
setup versions of my applications and it deployment is really smooth, 
just like any compiled software.

-Kartic
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problems with Python for Windows extensions

2005-09-04 Thread Kartic
Hi,

Invoking Execute as shown below works.. I have no explanation why your 
VB to Py converted code did not work.

wdFindContinue = 1
objSelection.Find.Execute('Contosa', False, True, False, False, True, 
True, wdFindContinue, True, 'Fabrikam', wdReplaceAll, False, False, 
False, False)

This finds 'Contosa' and replaces all occurances with 'Fabricam'.

For a full explanation about the arguments to Execute, look it up in the 
VBA Help.

Thanks,
-Kartic


The Great 'KK' uttered these words on 9/3/2005 11:14 AM:
> the code below is taken from M$ technet as an example on using vb
> script to do a replace all in word:
> 
> Const wdReplaceAll  = 2
> 
> Set objWord = CreateObject("Word.Application")
> objWord.Visible = True
> 
> Set objDoc =
> objWord.Documents.Open("K:\Development\Fabricbase\prod\Test.doc")
> Set objSelection = objWord.Selection
> 
> objSelection.Find.Text = "Contoso"
> objSelection.Find.Forward = True
> objSelection.Find.MatchWholeWord = True
> 
> objSelection.Find.Replacement.Text = "Fabrikam"
> objSelection.Find.Execute ,,wdReplaceAll
> 
> 
> 
> 
> I did a rewrite and made it pythonic:
> 
> from win32com.client import *
> 
> wdReplaceAll  = 2
> 
> objWord = Dispatch("Word.Application")
> objWord.Visible = True
> 
> objDoc =
> objWord.Documents.Open("K:\Development\Fabricbase\prod\Test.doc")
> objSelection = objWord.Selection
> 
> objSelection.Find.Text = "Contoso"
> objSelection.Find.Forward = True
> objSelection.Find.MatchWholeWord = True
> 
> objSelection.Find.Replacement.Text = "Fabrikam"
> objSelection.Find.Execute (Replace = wdReplaceAll)
> 
> 
> However, the document juz loaded up in word but no action was taken. I
> am using Word 2003. Any ideas?
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Access lotus notes using Python

2005-05-23 Thread Kartic
The Great 'Michael Ströder' uttered these words on 5/23/2005 2:43 PM:
> Kartic wrote:
> 
>>The Great 'Sateesh' uttered these words on 5/23/2005 7:14 AM:
>>
>>
>>>Is it possible to access Lotus notes using Python? Can anyone provide me
>>>some pointers?
>>
>>Yes, you can... You need the win32all distribution installed and you can
>>access Notes using the COM interface (win32com.client).
> 
> 
> There could be even more cross-platform programming options depending
> what "access Lotus Notes" really means for the original poster.
> 
> Depending on configuration a Domino server might have several Internet
> protocol services for accessing Notes data (POP3, IMAP, LDAP, etc.).
> 
> Ciao, Michael.


So I guess it upto the Sateesh to tell whether he needs more information 
or not.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Access lotus notes using Python

2005-05-23 Thread Kartic
The Great 'Sateesh' uttered these words on 5/23/2005 7:14 AM:
> Hi,
> Is it possible to access Lotus notes using Python? Can anyone provide me
> some pointers?
> 
> Thanks
> Sateesh
> 
> 

Yes, you can... You need the win32all distribution installed and you can 
access Notes using the COM interface (win32com.client).

Google for "Lotus Notes Python" gave the following as the first match.

http://www.dominopower.com/issuesprint/issue28/command.html

Dig around.

Win32-perl has some nice COM examples for accessing Notes also. You can 
convert the Perl-win32 examples to  Python rather easily without knowing 
much perl.

Cheers,
-Kartic
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: reg mail sending without smtp module

2005-05-11 Thread Kartic
The Great 'praba kar' uttered these words on 5/11/2005 10:06 AM:
> Dear All,
> 
>  Is it possible to send a message as a mail
> with out smtplib module?  If you find out any module
> for mail sending(without smtplib) kindly mail me.
> 
> regards
> Prabahar


twistedmatrix.com, Twisted Mail project.

smtplib module is really good; I have no idea why you want an 
alternative. If it is regarding that Received from "nobody", that is 
really not an issue. The mail get delivered and not marked as spam 
because of the nobody. Moreover, the receiving server resolves it correctly.

Thanks,
-Kartic
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: is there a python object which can interpret java-script?

2005-05-09 Thread Kartic
The Great 'Alexander Fillips' uttered these words on 5/9/2005 7:34 AM:
> Hi,
> 
> my short question:
> 
> is there a python object which can interpret java-script?
> 
> the whole story ;-)
> 
> I wrote some streaming-scripts for the xbox mediaplayer which supports 
> python. for a new script i tried to filter the stream-url from an 
> website. it seems, that the site ist using java-script and the url is 
> only visible if the java-script was interpreted. i am using urllib to 
> retrieve the page.. but it seems that urllib is not ready for 
> java-script...

http://wwwsearch.sourceforge.net/python-spidermonkey/ is a 
Python-Javascript bridge.

To do what you are trying, you will have to execute the Javascript in 
that web page in the context of the page you are downloading...I am not 
quite sure how you will go about doing that without re-inventing what a 
Javascript-enabled browser does.

Knowing nothing about the Xbox environment, here is a suggestion that I 
feel will make your task easier. Can you not use javascript-enabled 
links text browser to access the page and capture the output HTML source 
from links into Python? (Or if you can use win32all, you can automate IE 
to view source and process that source in Python to get your URL)

Thanks,
-Kartic
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How close program in the wxPython?

2005-05-02 Thread Kartic
The Great 'Tian' uttered these words on 5/2/2005 2:00 PM:
> I have made a program in wxpython, but how could i exit the program? I
> am using wxFrame for my window, what is the function to close the
> program?
> 
> Thanks!!
> 

Tian,

See below:

--- CloseDemo.pyw 

import wx

class MainFrame(wx.Frame):
def __init__(self, parent, id, title, size, pos,\
style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE):
wx.Frame.__init__(self, parent, id, title, size, pos, style)
# Bind close event here
self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
self.Show(True)

#OnCloseWindow is executed when EVT_CLOSE is received

def OnCloseWindow(self, evt):
print 'OnCloseWindow() called'
#Do other clean up action
#and destroy frame
self.Destroy()

app = wx.PySimpleApp()
frame = MainFrame(None, -1, "Test Close Event", (-1,-1), (-1,-1))
app.MainLoop()  

--

Hope that helped.

Thanks,
-Kartic
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [newbie] Embedding Flash OCX object

2005-04-30 Thread Kartic
The Great 'Exeem' uttered these words on 4/30/2005 11:37 AM:
Kartic,
Thanks for your reply,
I already use the wxPython to embbed my flash animation
###
from wxPython.lib.activexwrapper import MakeActiveXClass
ActiveXWrapper = MakeActiveXClass(flashActiveXLib.ShockwaveFlash, 
eventClass=None, eventObj=self)

Flash = ActiveXWrapper( self, -1, style=wxSUNKEN_BORDER)

It work fine and i can control my flash animation from Python without 
problem..

But the Wrapper need the flash.ock to be installed on the user system in 
order to work,
and i would like to make an executable application that include the 
flash.ocx or load it on startup for
users who doesn't have the flash player installed.
I would like also to be able to load a flash animation from memory and not 
to load it from external file.

Don't know if you understand me.. Take a look at 
http://www.flashplayercontrol.com/ .. I'd like such a solution for Python,
don't know if i can use that dll from Python or make a module myself..

Anyway, thank a lot for your interest
Dan

Dan,
Ah! I see what you are trying to do. While I don't have a working piece 
of code to share with you, I can give you a few ideas that you could 
consider:

1. Supply the Macromedia OCX with your app. Try to use the wxActivex 
class and if that fails, register your copy of the OCX. You can do this 
either using a batch file invoking regsvr32 or use Win32 to register. 
The flip side: The flash will be loaded from a file rather than memory.

2. Wrap the flashplayercontrol.com's DLL in an Activex control using VB 
and distribute your OCX. And then use wxActivex to access your OCX.

3. Use SWIG to generate Python bindings for the DLL. I have never done 
this and I am sure some of the more erudite members of the newsgroup can 
shed some light.

4. Call the supplied DLL using Ctypes. In this case, you can convert the 
example under the "Features" link of that site in DLL calls using 
Ctypes. Question: How will that integrate with wx?

Hope that helped a bit.
Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: [newbie] Embedding Flash OCX object

2005-04-30 Thread Kartic
The Great 'Exeem' uttered these words on 4/29/2005 2:11 PM:
Hi All,
I'm trying to find a way to embbed the flash.ocx object in a Windows Python 
application,
I've successfully integrated a flash object with the ocx already installed 
on the system using the Activex Wrapper,
but i would like to embbed it inside my application in order to distribute 
my application without the need for the user to install the flash player.
It would like also to embbed the flash animation inside my application 
without loading it .. i mean directly from the memory.

I've seen that it was possible in C++ or in Delphi, using the 
http://www.flashplayercontrol.com/ .. but don't know how to make it in 
Python.

Any ideas are welcome
Dan. 

Dan,
wxPython has the capability to embed Flash inside a wxPython panel. It 
uses Macromedia's Flash ocx that is installed when installing flash 
player on Windows. And it is pretty nifty; take a look at the demo.

From your message, it is appears you are using win32gui functions but I 
am unable to tell. So using Win32, I do not know how you can do what you 
are trying. But yeah, look into wxPython!

Please let me know if you need more assistance.
Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: why "import wx" doesn't work?

2005-04-28 Thread Kartic
The Great 'monkey' uttered these words on 4/28/2005 5:50 PM:
Which version of wxPython are you running? What do you mean by "does not
work"...does the import fail or is your code giving errors?

It is the current new version 2.6. The error message said that the class
wxApp is not defined...
But when using the default "from wxPython.wx import *", it works.

See my previous post for examples... you are mixing the new import style 
and old style of using the classes. That will not work.

Thanks,
-K
--
http://mail.python.org/mailman/listinfo/python-list


Re: why "import wx" doesn't work?

2005-04-28 Thread Kartic
The Great 'monkey' uttered these words on 4/28/2005 5:30 PM:
It is the current version of wxPython(2.6). But follow you instruction it
still can't work...
But if using the default "from wxPython.wx import *", it work, don't know
what is the problem. May be this is an old example that cannot work with
"import wx". Because I get another example and it is ok.

I suspect you are mixing program code for the namespace version (import 
wx) with the old method of importing (from wxPython.wx import *).

Here are two version of a very simple app... try both and see if you get 
any errors. And if so, _please_ post the exact error you get.

--- BEGIN The "new" namespace version 
import wx
class MainFrame(wx.Frame):
def __init__(self, parent, id=-1, title="Test Wx", size=(-1, -1), 
pos=(-1,-1), style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE):
wx.Frame.__init__(self, parent, id, title, size, pos, style)
self.Show(True)

app = wx.PySimpleApp()
frame = MainFrame(None, -1, "Test Wx NameSpace Style")
app.MainLoop()
--- END The "new" namespace version 
--- BEGIN The old style import 
from wxPython.wx import *
class MainFrame(wxFrame):
def __init__(self, parent, id=-1, title="Test Wx", size=(-1, -1), 
pos=(-1,-1), style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE):
wxFrame.__init__(self, parent, id, title, size, pos, style)
self.Show(True)

app = wxPySimpleApp()
frame = MainFrame(None, -1, "Test Wx Old Style")
app.MainLoop()
--- END The old style import 
Hope that helped!
Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: OOP

2005-04-28 Thread Kartic
The Great '[EMAIL PROTECTED]' uttered these words on 4/28/2005 
1:34 PM:
Hey yall,
I'm new to Python and I love it. Now I can get most of the topics
covered with the Python tutorials I've read but the one thats just
stumping me is Object Orientation. I can't get the grasp of it. Does
anyone know of a good resource that could possibly put things in focus
for me? Thanks.
I thought the Object Orientation chapter (Chapter 5) of Python in a 
Nutshell by Alex Martelli, gave a good overview for Classes in Python. 
Please take a peek at it and see if it helps you any.

Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: why "import wx" doesn't work?

2005-04-28 Thread Kartic
The Great 'monkey' uttered these words on 4/28/2005 2:09 PM:
I just learn to make a blank windows frame with python and wxpython. I found
the statment "import wx" cannot work as the original "from wxPython.wx
import *". I see in the readme file of wxpython that if I install it as the
default one, I can use "import wx" instead of the long one. What is wrong?
The code pasted below:
import wx   # the default is "from wxPython.wx import *", I change it and it
just can't work.

Which version of wxPython are you running? What do you mean by "does not 
work"...does the import fail or is your code giving errors?
--
http://mail.python.org/mailman/listinfo/python-list


Re: App suggestion please: blog / forum software in Python

2005-04-26 Thread Kartic
The Great 'Stewart Midwinter' uttered these words on 4/26/2005 6:18 PM:
I'm starting up a new website for a small community of local sports
enthusiasts.  I want to be able to create pages of information easily
(i.e. a content management system), but also allow for discussion on
multiple topics (i.e. a forum). Numerous people should be able to log
in and create or update content, under the guidance of an admin
naturally.
Call me perverse, but I don't want to use phpBB for the forum.  I'm
not seeing anything available in Python though - except for Karrigell.
is that the only option, or am I missing something?
Dear Stewart,
http://snakelets.sourceforge.net/frog/index.html - "Frog - a Python Web 
Logging tool".

I have no experience with Snakelets or CherryPy. Apparently you can run 
Snakelets behind your existing webserver, so integrating it should be 
rather straight forward. You can probably proxy requests to the blog 
piece to the Snakelets process, while the rest of your site is served by 
CherryPY.

Googling "Python Web Logging Application" brought up 
http://www.kryogenix.org/code/vellum/ as well.

Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: Parsing data from URL

2005-04-25 Thread Kartic
"The Great 'Harlin Seritt' uttered these words" on 4/24/2005 8:24 PM:
How can I make sure that I get the actual html data instead of the data
from redirected URL?
thanks,
Harlin
Harlin,
I am not sure I understand what you are asking but please see if the 
below mentioned link will help you. I am just sending the URL that I 
believe is relevant to you. You may want to read the entire chapter if 
you are interested.

http://diveintopython.org/http_web_services/redirects.html
(Dive into Python's Chapter 11.7. Handling redirects)
Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: web based file manager in python

2005-04-25 Thread Kartic
"The Great 'Ksenia Marasanova' uttered these words" on 4/25/2005 1:04 PM:
Hi,
I didn't suceed in finding any kind of standard web based file
manager, written in Python. There are quite a lot for PHP (the nicest

Any hints? 

Thanks!
Ksenia - I recently came across this python web-based FM:
http://snakelets.sourceforge.net/filemgr/index.html
It is by Irmen De Jong, the author of Snakelets.
Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: Decent Win32All Documentation

2005-04-24 Thread Kartic
The Great Harlin Seritt uttered these words on 4/24/2005 5:20 AM:
Does anyone know of any decent documenation on Mark Hammond's win32all
modules? I have tried looking at the documentation .chm file that comes
with it, Python Programming On Win32 (OReilly book) and ActiveState's
documentation and have found them all lacking -- yes I need it broken
down to me.
What I am hoping to do is to work on some Python versions of PSTools. I
think the win32 modules will be perfect for helping me do this,
however, I am having a (more than it should be) difficult time making
sense of the win32process module.

Harlin,
I usually first refer to MSDN for the win32 API and other functions. If 
some definitions are not clear and also to make sure that the Python 
version of the function call corresponds to the C function, I refer to 
Activestate's Win23all documentation.

Typically what I do is import win32process, dir(win32process), pick out 
a function and google it; the first couple of matches are usually the 
MSDN documentation for that function. The left bar on the MSDN page 
lists all the functions in the process API, so you can get click happy 
and read away.

HTH,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: GUI woes

2005-04-23 Thread Kartic
The Great jeff elkins uttered these words on 4/23/2005 5:45 PM:
test.py crashes with the error below. Any clues?  

===
Running test.py: 

Traceback (most recent call last):
  File "./test.py", line 87, in ?
app = MyApp(0) # Create an instance of the application class
  File "/usr/lib/python2.3/site-packages/wxPython/wx.py", line 1951, in 
__init__
_wxStart(self.OnInit)
  File "./test.py", line 76, in OnInit
frame = MyFrame(None, -1, "This is a test")
  File "./test.py", line 26, in __init__
self.Bind(wx.EVT_SIZE, self.OnSize)
AttributeError: MyFrame instance has no attribute 'Bind'
Jeff - Could you please post your code?
From what you have posted it looks like your MyFrame class does not 
inherit from wx.Frame.

Your class should be defined like this:
class MyFrame(wx.Frame):
def __init__(self, parent, id, title, pos, size, style):
wx.Frame.__init__(self, parent, id, title, pos, size, style)
self.Bind(wx.EVT_SIZE, self.OnSize)
self.Show(True)
Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: permission

2005-04-13 Thread Kartic
James said the following on 4/12/2005 11:00 PM:
Is it possible to check if you have permission to access and or change a
directory or file?

James - You can use the access() in the os module.
import os
print os.access('C:\\', os.R_OK | os.W_OK) # check for read/write access
# hopefully print True
print os.access('C:\\noexist.file', os.R_OK) # Check no existent file
# will print False
print os.access('C:\\Docume~1\\anotheruser\\Mydocu~1', os.R_OK) # Read 
another users documents folder
# should print False if no read access

Please read http://docs.python.org/lib/os-file-dir.html for more info.
Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: Is it possible to distinguish between system environment variables and the user ones?

2005-04-05 Thread Kartic
There is nothing that plainly differentiates whether an environment
variable is the system's or the current user's.

What you could do is:
1. Get the list of environment variables for the user the script is
executing as.
2. Use the pywin32 extensions to access the registry key
HKCU\Environment
3. Lookup the environment variables present in the list (Item 1)  that
appear as string values under HKCU\Environment.
4. The intersecting list belongs to the user, the rest can be surmised
as belonging to the system environment.

Thanks,
--Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


ANN : Columbus OH Meetup Group

2005-04-05 Thread Kartic
Announcing the creation of a Columbus/Dublin Ohio Meetup group.

http://python.meetup.com/161/

Hope to see Pythonistas from the Columbus/Dublin areas, and vicinity,
sign up for this group and enrich our collective Python experience!

Thanks,
--Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: enter key event in wxpython

2005-03-01 Thread Kartic
Raghul said the following on 2/28/2005 11:59 PM:
hi,
   I am developing a jabber client.What I need is whrn i enter text in
the text area and when I press return key. The following text should be
send.I found the way to send the message, the only thing is I want to
handle the enter key event.how to do this? so that when i press enter
key, The key id or the event to be handled. Help me pls.
Take a look at the KeyEvents demo code under Processes and Events of the 
wxPython Demo application.

In a nutshell, you have to handle the KEY_DOWN and KEY_UP events for the 
window.

Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: cannot open file in write mode, no such file or directory

2005-02-28 Thread Kartic
Could you please post your entire program, if possible?

Thanks!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: cannot open file in write mode, no such file or directory

2005-02-28 Thread Kartic
> I'm having a problem where when trying to open a file in write mode,
I
> get an IOError stating no such file or directory.  I'm calling an
> external program which takes an input file and produces an output
file
> repeatedly, simulating the input file separately for each replicate.
> The error occurs when trying to open the input file to write out the
> new data.  The problem is difficult to reproduce since it only shows
up
> once every few thousand replicates.  I've tried using both os.system

I am afraid you need to give more information that just IOError,
calling an external program.

Please post the exact message including the input filename at the time
the program went down. If you don't print the filename, please modify
your program to do so.

A shot in the dark solution to your problem might be that you are
dynamically  generating a filename and that filename probably contains
characters not allowed by the local file system OR you generate a path
that does not exist. For open() to work with the 'w' flag, the path
where the file you say should be created should exist.

Thanks,
-Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Controlling Pc From Server?

2005-02-27 Thread Kartic
Kartic said the following on 2/27/2005 8:54 AM:
For a homegrown solution, if I am not mistaken, you will have to use 
libpcap (or pypcap) to monitor the packets being sent and received, 
taking care to exclude the local subnet (or your reporting will be 
skewed as packets sent to the monitoring server will also be included!). 
You can check http://www.monkey.org/~dugsong/pypcap/ for more 
details...and may be for more ideas.
http://winpcap.polito.it/docs/man/html/group__remote__help.html
- Should help. This uses the Winpcap library. Not sure if the same can 
be done using the Python bindings for pcap.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Controlling Pc From Server?

2005-02-27 Thread Kartic
[EMAIL PROTECTED] said the following on 2/27/2005 8:40 AM:
Hello Kartic & NG,
 Thank you for your prompt answer. In effect, I'm trying to work on
a NT network of 6 PC (plus the server). Sorry to not have been clearer.
Ideally, I'm trying to monitor the Internet activity of each client (PC)
on this network (but I'm not a boss trying to control my emplyees, I'm just
curious on it). I would like to know which PC is connected to Internet (by
starting something like a "timer" for every PC, and then periodically check
if a particular PC is connected or not). This should be done from the main
server. 
Did I make myself clear? Do you think it would be a huge task?

Sorry, it may be a very basic question, but thank you for your help.
Andrea.

Sounds like you are spying :-D
Your requirement may sound basic but I don't *think* it is simple to do. 
 Since you are using NT, you can probably see if there is some Network 
Usage auditing tool. This might cost you some $$ or may be you can find 
some shareware.

For a homegrown solution, if I am not mistaken, you will have to use 
libpcap (or pypcap) to monitor the packets being sent and received, 
taking care to exclude the local subnet (or your reporting will be 
skewed as packets sent to the monitoring server will also be included!). 
You can check http://www.monkey.org/~dugsong/pypcap/ for more 
details...and may be for more ideas.

Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: Controlling Pc From Server?

2005-02-27 Thread Kartic
[EMAIL PROTECTED] said the following on 2/27/2005 4:44 AM:
Hello NG,
I am trying to find some information about the possibility to control
two (or more) clients (PCs) via a Python application running on a main server.
Ideally, this application should be able to monitor (almost in real time)
the "activity" of these clients (which applications are launched, closed
and so on, if this is even possible, obviously). Does anyone have to share
some information/pointer?
Thank you a lot.
Andrea.

Andrea,
Since you have not specified any operating system, my suggestion is for 
you to go for a generic solution like pyheartbeat. Pyheartbeat is a 
program with server and client components and uses UDP to monitor which 
client computers are down and which, active.

You can modify pyheartbeat to do what you are wanting, by wrapping your 
monitoring functions and sending that information back to the server. To 
make things more elegant, you could probably come up with an XML schema 
(or other formatted text like JSON or use Pickle to 
serialize/de-serialze data structures) so that the information is 
machine-friendly but you still can translate the XML for a pretty 
display on the server.

Pyheartbeat can be found at 
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52302

If you are using Windows NT-based technology, you can setup your clients 
so that all activity is logged to the server; I believe there are 3rd 
pary applications available that can do this for you. Sorry, I don't 
know the specifics on how to do it.

For *nix OSes, you can have the syslog daemon log to a remote machine 
instead of the local. So, you can log all activity to the UNIX server. 
(Though, to me, it appears that you are looking for remote top like 
functionality for networked PCs).

Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: how to use property

2005-02-25 Thread Kartic
[EMAIL PROTECTED] said the following on 2/25/2005 5:25 AM:
(B> My question is how should I use "property" which wraps up
(B> __get_channel() and __set_channel()in the following program.
(B> I tried the program that written below, and it worked. Then I tried:
(B> channel = property(__get_channel,__set_channel) as in comment 1, 2,
(B> and 3,
(B> 
(B> but it generates the error:
(B> Traceback (most recent call last):
(B>   File "C:/WINDOWS/desktop/test.py", line 41, in -toplevel-
(B> main()
(B>   File "C:/WINDOWS/desktpo/test.py", line 37, in main
(B> tv.change_channel(choice)
(B>   File "C:/WINDOWS/desktop/test.py", line 27, in change_channel
(B> self.channel(choice)
(B> TypeError: 'int' object is not callable
(B> 
(B> I am now studying class, so want to use property.
(B> This program simulates changing channel number 1 through 10 on TV.
(B> How should I use property here?
(B> 
(B>   def change_channel(self, choice):
(B> self.__set_channel(choice)
(B> print self.__get_channel()
(B> 
(B> #comment2: self.channel(choice)
(B
(B
(BYou see comment#2... You say self.channel(choice). self.channel is an
(Bint object that you are trying to call - channel(choice) - and that is
(Bwhat your exception states when it says 'int object is not callable'.
(B
(BYou probably meant self.channel = choice
(B
(BAlso, there is a problem in your posted version. You have not defined
(Bvolume before usage. So I added it to __init__(..,.., volume=120) to
(Bmake it work.
(B
(BCheers,
(B-Kartic
(B-- 
(Bhttp://mail.python.org/mailman/listinfo/python-list

Re: wxpython tutorials

2005-02-25 Thread Kartic
Raghul said the following on 2/25/2005 12:24 AM:
hi,
I want to learn Wxpython to work in windows.Is there any tutorials
available?Pls specify the link that will be easy to learn for beginers
like me

Raghul - If you have the patience, you can look at the demo source code. 
A good thing about the latest wxPython Demo version is that you can 
change the demo code in the *running* demo and execute the changed code 
to to see the results right away. I love that feature!

So, my suggestion to you is to start reading tutorials. A nice tutorial 
to get your feet wet is 
http://www-106.ibm.com/developerworks/library/l-wxpy/

Once you feel comfortable with drawing a basic frame with a menu bar and 
able to handle events, you can build complex apps using a demo as your 
guide. Also, there is a weapon in your arsenal in the form of the 
wxWidgets Help Manual that is installed with wxPython. It is geared 
towards the wxWidget C++ library but the information can be used to 
build wxPython apps rather easily. The Help also annotates differences 
between the C++ class and wxPython (and wxPerl) usage where approporiate.

Have fun!
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python Online Programming Contest

2005-02-24 Thread Kartic
Harlin Seritt said the following on 2/24/2005 8:30 PM:
Actually MIT is an abbreviation and not an acronym in the true sense of
the word :)
Yes...I was caught unawares by the previous poster. But in a strange way 
 I was using the abbreviation MIT to talk about the acronym MIT (M* 
Institute of Technology) :-D
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python Online Programming Contest

2005-02-24 Thread Kartic
Will Stuyvesant said the following on 2/24/2005 5:10 PM:
[Varun]
For details about samhita http://www.samhita.info/

"The Madras Institute of Technology (MIT)" it says there.
The MIT acronym is taken already guys..
Will - It is a local acronym!
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python Modules for Various Internet Protocols?

2005-02-24 Thread Kartic
Efrat Regev wrote:
> Hello,
>
> I was wondering whether there are any Python modules for various
> Internet protocols, e.g., is there something similar to
>


Erfat...yes...batteries included!

http://docs.python.org/lib/internet.html

Thanks,
-Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Working FTP server based on Twisted framework.

2005-02-24 Thread Kartic
Mateusz SoĂ…tysek said the following on 2/23/2005 4:45 AM:
Hi call,
Does anybody know, if there is any opensource, working FTP server 
implementation based on Twisted framework?

Greetings
Mateusz,
I don't believe there is a ready-to-go FTP server in Twisted (actually 
google did not return anything obvious for my search string).

If you are looking a simple implementation of FTP server in Twisted, you 
can create an FTP server in seconds in mktap (or the GUI equivalent). 
Both of these are installed when you install the Twisted framework.

For help on mktap, see : 
http://twisted.sourceforge.net/TwistedDocs-1.1.0/man/mktap-man.html
(ftp is explained)

If you have no reason to use Twisted, may be you can take a look at 
http://www.mythi.cx/python/pyFTPdrop.py but this is for UNIXish 
operating systems.

HTH!
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: email-adress

2005-02-24 Thread Kartic
Courtis Joannis said the following on 2/24/2005 5:06 AM:
Hello Python-team,
please could you delete my email-adress from your mailing list.
Thanks Joannis
Courtis
On emails sent to the python mailing list, the signature should contain 
an unsubscribe email address. Please follow instructions on the 
signature to unsubscribe.

Or else visit http://mail.python.org/mailman/listinfo/python-list to 
unsubscribe yourself.

If you are talking about "unsubscribing" from c.l.p, you will have to 
change the settings on your service provider if it is web based (e.g. 
with Google groups you can choose whether or not to receive emails).

Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: reading only new messages in imaplib

2005-02-23 Thread Kartic
Raghul said the following on 2/22/2005 11:24 PM:
Is it posssible to read only the new messages or unread messages using
imaplib in python? If it is possible pls specify the module or give a
sample code.
Thanks in advance

import imaplib, sys
conn = imaplib.IMAP4_SSL(host='mail.example.com')
# or conn =imaplib.IMAP4(host='mail.example.com') for no SSL
try:
	(retcode, capabilities) = conn.login('user', 'pass')
except:
	print sys.exc_info()[1]
	sys.exit(1)
conn.select(readonly=1) # Select inbox or default namespace
(retcode, messages) = conn.search(None, '(UNSEEN)')
if retcode == 'OK':
	for message in messages[0].split(' '):
		print 'Processing :', message
		(ret, mesginfo) = conn.fetch(message, '(BODY[HEADER.FIELDS (SUBJECT 
FROM)])')
		if ret == 'OK':
			print mesginfo,'\n',30*'-'
conn.close()

Please also go thru the IMAP RFC to learn more about the flags field and 
the IMAP protocol in general. If you're developing something serious 
using IMAP, it will be very beneficial to you to understand the protocol.

http://www.imap.org/papers/biblio.html
Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: searching pdf files for certain info

2005-02-22 Thread Kartic
rbt said the following on 2/22/2005 8:53 AM:
Not really a Python question... but here goes: Is there a way to read 
the content of a PDF file and decode it with Python? I'd like to read 
PDF's, decode them, and then search the data for certain strings.

Thanks, rbt
Hi,
Try pdftotext which is part of the XPdf project. pdftotext extracts 
textual information from a PDF file to an output text file of your 
choice. I have used it in the past (not with Python) to do what you are 
attempting. It is a small program and you can invoke from python and 
search for the string/pattern you want.

You can download for your OS from:
http://www.foolabs.com/xpdf/download.html
Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: problem with tutor mailing

2005-02-16 Thread Kartic
Ah...I see your predicament after reading Brian's response.  I mistook
your post to be about getting spammed.

Sorry fella, if you are on a mailing list you are going to get ALL
mails addressed to the list (whether or not they are responses to your
questions).  Your only option is to turn off mail delivery completely,
but that means you will not get any answers related to your questions
either.

Believe me, it is not a bad idea or an inconvenience to receive other
emails on the list; you will learn a thing or two!

Thanks,
-Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Using 'in' with a Dict

2005-02-16 Thread Kartic
This is what I did 

>>> import compiler
>>> exec1 = compiler.compile('''if "foo" in m:  print "sweet"''', '',
'exec')
>>> exec2 = compiler.compile('''if m.has_key("foo"):  print "dude"''',
'', 'exec')
>>> exec1.co_code
'd\x01\x00e\x00\x00j\x06\x00o\t\x00\x01d\x02\x00GHn\x01\x00\x01d\x00\x00S'
>>> exec2.co_code
'e\x00\x00i\x01\x00d\x01\x00\x83\x01\x00o\t\x00\x01d\x02\x00GHn\x01\x00\x01d\x00\x00S'
>>> exec2 = compiler.compile('''if m.has_key("foo"):  print "sweet"''',
'', 'exec')
>>> exec2.co_code
'e\x00\x00i\x01\x00d\x01\x00\x83\x01\x00o\t\x00\x01d\x02\x00GHn\x01\x00\x01d\x00\x00S'
>>> exec(exec2)
sweet
>>> exec(exec1)
sweet
>>> exec1.co_varnames
('m',)
>>> exec2.co_varnames
('m', 'has_key')
>>>

The code generated with the has_key() version is slightly large (3
bytes) than the one with the membership test. The co_varnames for the
two code objects vary, as the second one has the has_key method also,
which the other version does not.

Thanks,
-Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: problem with tutor mailing

2005-02-16 Thread Kartic
> but, i frequently get mails which aren't related with my question.

You mean spam?! This is not the first time you are using email, is it?

> how should i stop it?

Well, it depends. If you are on *nix machine, you can install
Spamassassin locally for your id and filter emails out.

If you are on a Windows machine and use outlook, you can install
Spambayes for Outlook. See http://starship.python.net/crew/mhammond/
for more info.

If you are using OE, I would recommend installing Thunderbird and using
the built-in junk mail controls. It is pretty cool and works well.

I am sure you will get a lot of other ideas from the other fine people
on this list.

HTH!
-Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: win32 extension install hiccup

2005-02-13 Thread Kartic
MM said the following on 2/13/2005 4:50 PM:
Hi,
I downloaded the latest win32all build 202 and tried to install under 
win2000 with Py2.4. Install complains about 'couldn't open py2.4 to run 
script pywin32-preinstall.py'. I checked the directories and there was 
no sign of this file (preinstall.py) so I presume this is why it bombed. 
How do I fix this? Thanks, matthew.
Add the location of Python.exe to the Path (System 
Properties->Advanced->Environment Variables) and run your win32all 
install. It will work like a charm!
--
http://mail.python.org/mailman/listinfo/python-list


Re: Trouble using telentlib

2005-02-12 Thread Kartic
Nitin Chaumal said the following on 2/11/2005 5:41 PM:
I sarched the existing threads but didnt find an answer to this.
I am writing simple script which uses telentlib to open a session with
a unix machine and run "tail -f logfile.txt" on one of the logfiles.
import telnetlib
HOST = "192.X.X.X"
user = "myname"
password = "mypass"
tn = telnetlib.Telnet(HOST)
tn.read_until("login: ")
tn.write(user + "\n")
if password:
tn.read_until("Password: ")
tn.write(password + "\n")
tn.write("tail -f /tmp/logfile.txt\n")
# what do i write here ? #
tn.write("exit\n")
Nitin,
You can not have two writes together. Reads and writes should alternate.
To get the log file this is what you should do:
# Modified my working version for your purpose.
# Hope there are not errors!
def SaveLog(user, password):
telnet_resp = []
tn = telnetlib.Telnet(host)
tn.read_until("login: ")
tn.write(user + "\n")
if password:
telnet_resp.append( tn.read_until("Password: ") )
tn.write(password + "\n")
tn.read_until("$ ")
tn.write("tail -f /tmp/logfile.txt\n")
telnet_resp.append(tn.read_until("$ "))
tn.write("exit\n")
telnet_resp.append(tn.read_all() )
tn.close()
telnet_out = open(OUTPUT, 'a')
    telnet_out.write('\n'.join(telnet_resp))
telnet_out.close()
Alternatively, if your box has FTP access, you can FTP the log file to a 
CStringIO file and operate on it.

Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python UPS / FedEx Shipping Module

2005-02-12 Thread Kartic
Gabriel Cooper said the following on 2/11/2005 2:23 PM:
I've made UPS and FedEx shipping rate request modules in python using 
XML. Is there an interest in putting this on the web?
I am interested in it for educational value, if not anything else. 
Please post the web address from which to download.

Thanks!
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: Help: retrieving e-mail from yahoo pop server. what's wrong?

2005-02-09 Thread Kartic
Andre said the following on 2/9/2005 7:28 PM:
Thank, Kartic
I actually tried doing it with several other accounts, notably mail.com and
netscape.com
When i do it with netscape the dialog goes like the following:
The username and password are naturally valid, but something else is wrong.
Do you know if Netscape also doesn't allow POP access? Is there a free
e-mail provider who does?

Okay..this OT now!
Gmail provides pop access. Or you can use fastmail.fm, they hae a free 
account option with POP3 as well as IMAP access.

Before you post any Python code, first try with some email client and 
then try with Python code.

-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: Help: retrieving e-mail from yahoo pop server. what's wrong?

2005-02-09 Thread Kartic
Andre,

Do you have a premium Yahoo account? Only premium users can access
Yahoo mail via POP3. If you are a premium account holder and it still
is not working, print out your password to see if you typed the correct
password.

Have you tried accessing your Yahoo from an email client? Does that
work?

Thanks,
-Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and version control

2005-02-09 Thread Kartic
I use PVCS for version control and use IDLE or Vim (depending on my
mood :-)) to write the programs.

So far I have had no issues, works pretty well. Somehow, and it is just
me, I don't care much for version control integrated with the IDE.

Thanks,
-Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python mail filter

2005-02-08 Thread Kartic
I just read your requirement of a pass through...  Writing the email
back into sys.stdout from your script might do the trick of passing it
through to the original intended recipient.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python mail filter

2005-02-08 Thread Kartic
Mika,

Somebody else had a similar situation of having a script receive the
email and process it.

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/1f26452835e51c71/e4d6c1efc9a71e39?q=&_done=%2Fgroups%3Fq%3D%26start%3D10%26enc_author%3DVUzGiykAAAD-rgSwZjnUEp_UDWM1Zk6AXwyJTPpMwlh8flm6PB9npBRJrLIi5sMmhFscvSzxHxE%26&_doneTitle=Back+to+Search&&d#e4d6c1efc9a71e39

This is my response to that post and the latter half may help you.

One thing you must remember is once you pipe the email to your script,
it is considered delivered. If you want to script to process and also
receive the email into a user account, you have to list the recipients
in your .forward file. If you want to process the email through your
script and _then_ send it to a user, I think the only way would be to
send the email from your script to next intended recipient.

Thank you,
-Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python connect to server using SSH protocol

2005-02-08 Thread Kartic

[EMAIL PROTECTED] wrote:
> How can python connect to server which use SSH protocol?
> Is it easy since my python has to run third party vendor, write data,
> read data inside the server (supercomputer).
>
> Any suggestion?
>
> Sincerely Yours,
> Pujo Aji

Pujo,

There are two Python oriented SSH solutions.
1. pyssh (pyssh.sf.net) which is a library for programmatically
controlling ssh.
2. Paramiko (http://www.lag.net/paramiko/) which are python bindings
for the SSH2 protocol.

I have used neither of these packages, so I am in no position to
recommend anything.

Of course, you have the usual popen() functions that you can use to
invoke SSH.

Thanks,
-Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Big development in the GUI realm

2005-02-07 Thread Kartic
Is there a "GPL for Dummies" out there??? :-)

Sorry if I am asking a question that has already been asked/answered in
another form.

In any case, let's say I use Python to create an application that uses
some module that is GPL. So what are my options?
1. Distribute my app as closed source but with source, available upon
request and clearly stated so in my license, for the GPL'ed module. But
the code to my app only is not available as it is closed source.
2. Distribute my app with the source code available upon request, along
with the code of any other GPL'ed modules that my app uses.

I don't know if any other option is possible. Do my stated options
cover the possibilities and if so, which of these are the correct legal
one that I would follow?

Thanks,
-Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: socket question

2005-02-07 Thread Kartic

Philippe C. Martin wrote:
> >> My problem is that I cannot connect to my server if the client is
not on
> >> the same PC (although I'm doing the above).


Does the machine running the server code also have a firewall installed
that blocks access to the server port from outside? That is the only
possibility I can think of that prevents a non-local client from
connecting.

Also, please do a netstat -a on the machine running the server and see
the IP addresses to which the listening port is bound.

Thanks,
-Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python versus Perl ?

2005-02-06 Thread Kartic
ue, there are a few Python "shops" but there are many jobs that ask 
for knowledge of Python, especially testing positions. The few Python 
shops are places you will die to work for - like Google may be?

Other aspects that support adoption of Python are consistent syntax, 
great OO, code maintainability and short development time (proportional 
to the complexity of the design).

Good that you asked this question as part of due diligence. These are 
the factors I can point out. If I have missed something or misquoted, 
gurus out there can correct me.

Hope that helped!
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: Possibly OT: Controlling winamp with Python

2005-02-04 Thread Kartic
Brent,

Question : how will your python script distinguish between a commercial
and a song?

I can understand if you are writing a streaming client in Python; in
that case you can analyze the audio stream and decide if it is a
commercial or a song/music.

Did you check to see if there is already a Winamp plugin that would
achieve this for you?

Thanks,
-Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: newbie: Syntax error

2005-02-04 Thread Kartic
Chad,

The usage is like this:
- if :
- 
- elif :
- 
- else:
- 

So, your code should be:
if tries == 1:

elif tries == 2:


(You have 'else' followed by a condition...hence a syntax error. else
is what it means - "if no other condition is satisfied". You should use
'elif' for subsequent conditions after 'if'.)

Thanks,
-Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Converting strings to dates

2005-02-04 Thread Kartic
py>  import time
py> date_str = time.strftime('%Y-%m-%d', time.localtime())
py> date_str
'2005-02-04'
py> time.strptime(date_str, '%Y-%m-%d')
(2005, 2, 4, 0, 0, 0, 4, 35, -1)

That work?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Thread in python

2005-02-04 Thread Kartic
Ah! I forgot about this link the slideshow is very informative.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Thread in python

2005-02-04 Thread Kartic
[EMAIL PROTECTED] wrote:
> Hello, is any one knows websites which give a python thread tutorial
?
>
> Sincerely Yours,
> Pujo Aji

Pujo Aji,

I have not come across a tutorial but found this link rather helpful -
http://www.faqts.com/knowledge_base/index.phtml/fid/263 - to get
started.

Also, there are good recipes in ASPN -
http://aspn.activestate.com/ASPN/Cookbook/Python?kwd=Threads

And last but not least, the chapter on Threads in Python Standard
Library by Fredrik Lundh - http://effbot.org/zone/books.htm

Thanks,
-Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: why are LAMP sites slow?

2005-02-04 Thread Kartic
Paul Rubin said the following on 2/3/2005 10:00 PM:
I have the idea that the Wikipedia implementers know what they're doing,
but I haven't looked into it super closely.
Absolutely, hence my disclaimer about not viewing the Mediawiki code.
Hmm, I wasn't aware that Apache 2.x gave any significant speedups
over 1.3 except under Windows.  Am I missing something?
Architectural differences. Apache 1.3 spawns a new process for every 
request and before you know, it brings your resources to their knees. I 
don't know what effect Apache 1.3-Win32 has on Windows. Apache 2.x from 
what little I have used is pretty stable on windows and resource 
friendly. (I use Freebsd for serious work)

Hmm, I'm not familiar with Nevow.  Twisted is pretty neat, though
confusing.  I don't see how to scale it to multiple servers though.
I'm asking this question mainly as it relates to midrange or larger
sites, not the very simplest ones (e.g. on my personal site I just use
Python cgi's, which are fine for the few dozen or so hits a week that
they get).  So, the complexity of twisted is acceptable.

True - That is why I can't wait for the twisted sessions during PyCon 
'05 :-)


Yes, good point about html tables, though I'm concerned primarily
about server response.  (It's off-topic, but how do you use CSS to get
the effect of tables?)
My thinking is that all these pieces must fit in well. For example, your 
server response might have been good but the table-driven site could be 
slowing your browser down. The best way to test whether it is the server 
 response that is slow and/or table-driven page is to load that page in 
Lynx.

The CSS way is using  placement of the elements. Actually  
gives better control over placement than with HTML tables. And with CSS, 
since you style the various HTML tags, you can create different "skins" 
for your site too. This is definitely OT, like you said, but if you are 
interested, please contact me directly. I don't pretend to be a CSS 
expert but I can help you as much as I can.

Thanks,
--Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: OT: why are LAMP sites slow?

2005-02-03 Thread Kartic
Paul Rubin said the following on 2/3/2005 7:20 PM:
LAMP = Linux/Apache/MySQL/P{ython,erl,HP}.  Refers to the general
class of database-backed web sites built using those components.  This
being c.l.py, if you want, you can limit your interest to the case the
P stands for Python.
I notice that lots of the medium-largish sites (from hobbyist BBS's to
sites like Slashdot, Wikipedia, etc.)  built using this approach are
painfully slow even using seriously powerful server hardware.  Yet
compared to a really large site like Ebay or Hotmail (to say nothing
of Google), the traffic levels on those sites is just chickenfeed.
If you are talking about Wikipedia as a prime example, I agree with you 
that it is *painfully* slow.

And the reason for that I probably because of the way the language is 
used (PHP) (this is a shot in the dark as I have not looked into 
Mediawiki code), and compounded by probably an unoptimized database. I 
don't want to start flame wars here about PHP; I use PHP to build client 
sites and like it for the "easy building of dynamic sites" but the 
downside is that there is no "memory"...every page is compiled each time 
a request is made. I doubt if Wikipedia site uses an optimizer (like 
Zend) or caching mechanisms. Optimizers and/or PHP caches make a huge 
performance difference.

Also, PHP has put dynamic sites within easy reach of several programmers 
who slap together sites in no time. These sites may have spaghetti code 
and even the best infrastructure is not enough to support shabby design 
(code, db setup and even server tuning). I have seen people become 
programmers overnight! There are also LAMP sites that use Apache 1.3 
that is a resource hog; I guess production sites do not want to upgrade 
to Apache 2.x/PHP combo!

Coming to python, to be honest, I have not seen many LAMPy sites. I use 
blogspot.com frequently and it is pretty reliable; I hear that it is 
written in Python but I have no idea about the server and database software.

The way to go is to build around application servers, IMHO. I like the 
Twisted.web/Nevow methodology, though for simple situations it may be an 
overkill. I like the Webware with Apache-thru-Webware-Adapter setup - 
that is what I am considering implementing for my organization. (Even in 
the App Server arena, I have seen Websphere with JSP/Servelets sites to 
be s slow that I could finish my breakfast and still wait for the page)

From my experience it is an overall tuning thing. Usual culprits are 
untuned Linux boxes, unoptimized database design, poorly designed 
queries and/or poor application logic...and ah! table-driven pages. 
Pages built on tables for the layout kill the browser. CSS is the way to go.

Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: IDLE history, Python IDE, and Interactive Python with Vim

2005-02-03 Thread Kartic
Ashot said the following on 2/2/2005 9:45 PM:

Vim related:
--
Ideally, it would be nice to have a command mapped to a keystroke that 
can  append the last executed command to a file.  Even better would be a 
system  that would integrate the file editing and interactive command 
line tool  more seamlessly.  Something along the lines of a debugger + 
file editor  + command line utility, where file editor = vim.  I know 
that vim has a  utility for running python commands from its command 
prompt, but I have  had a hard time getting this to work in windows and 
haven't explored it.   Has anyone seen/tried a system along these lines, 
perhaps incorporating  the python debugger (pdb)?  I can see something 
that will run the file you  are editing in vim up to the cursor or a 
mark with a set_trace at the line  you are editing.

I am VIM guy too but I have not got to the point of writing a VIM macro 
to execute a selection.

VIM on UNIXish OSes can be built with the Python interpreter (so using 
:python  will execute it). AFAIK, Vim on Windows is 
 able to execute Python using the :python notation; I guess it uses the 
Python installation. I actually did not have to do anything other than 
install GVim; it just works on windows with :python.

Try :help python in Vim to read the relevant help entries.
I was considering writing a macro, map it to a keystroke for one to 
execute a selected code block in VIM but have not yet got around to 
doing it. May be one of these days..sigh...

This probably does not help you very much but there is hope :-)
Like Fuzzyman said you can set the EDITOR environment variable and use 
IPython. The magic %edit  
will fire up your editor and the script will be saved to a temp file. 
Though I am not entirely happy with that feature (may be something that 
I am missing) but I live it. So if you set EDITOR as gvim.exe in 
Windows, IPython fires up Gvim instead of the default notepad (yuck!).

In IPython, you can type pdb at the prompt and it toggles the debugger 
state. So if your program raises an error, IPython starts pdb if debug 
is on. IPython is nifty but I am just getting a feel for it.

Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: errors

2005-02-03 Thread Kartic
Joel Eusebio said the following on 2/2/2005 4:53 PM:
Can someone help me on this, I don' know where the "testmptest" came from
but the mptest.py is at the /usr/local/apache2/htdocs/test directory and
this error came from apache's error_log
PythonHandler mod_python.publisher: ImportError: No module named testmptest
Thanks,
Joel
I found this link from Googling -
http://www.modpython.org/pipermail/mod_python/2004-January/014857.html
Please read the entire thread and see if it provides your resolutions 
(the mod_python OP's issue was similar but for a different module).

It might also do you some good to join mod_python mailing list if you 
are going to use it regularly.

Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: Finding user's home dir

2005-02-02 Thread Kartic
Nemesis said the following on 2/2/2005 2:26 PM:
Hi all, I'm trying to write a multiplatform function that tries to
def getHomeDir():
''' Try to find user's home directory, otherwise return current 
directory.'''
Please, could you test it on your systems and tell me what you got?
I'd like to know what it returns on different operating systems because
I'm developing a multiplatform software.
Thank you all.

Neat!
Works fine on Freebsd 5.3, Python 2.4
Thanks,
-Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: How do you do arrays

2005-02-01 Thread Kartic
Tom - I answered your question even before you posted it!

You have to use iMatrix.append(k) and NOT iMatrix[index] = k.

Also,  what do you expect out of:
while index < majorlop1:
print '- %s %s' % ( iMatrix[index], sep)

This loop will never get executed because your previous loop finishes
due to the same condition index < majorlop1.

I am not sure what book you are using but I don't think it is a very
good one.

>  I would like to set the size of the List/array independent
> of having to intialialize it prior to use.

You can  do the following when you allocate your list.
iMatrix = [''] * size # where size is an integer
and this will give you a list of size empty elements. If you do this,
do not use iMatrix.append(). Use the array notation like you have in
you code currently.

Thanks
-Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you do arrays

2005-02-01 Thread Kartic
Tom,

It has to be iMatrix.append(k), not iMatrix[index] = k. Python will
give an error - list assignment index out of range - for that.
Just curious - what book are you following?

-Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you do arrays

2005-02-01 Thread Kartic
and it is called a "List" in Python parlance.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do you do arrays

2005-02-01 Thread Kartic
Tom,

Before you use iMatrix[index], you have to tell python to use iMatrix
as an array. You will do that using iMatrix = [] *outside* the loop.

iMatrix = []
while index < majorlop1: # rest of the loop statements

Since you are new, please take a look at the Python tutorial to get you
started.
http://docs.python.org/tut/tut.html

Thanks,
-Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Building Python with Tcl/Tk on Cygwin_NT-5.1

2005-02-01 Thread Kartic
Dean,

It has been quite sometime since I did that. I had installed Tcl/TK in
a non-standard location on my Freebsd box.

So, for Python to compile _tkinter,  in the configure script I passed
the location of the Tcl/Tk includes and libs. So, you will have to find
out where in the Cygwin tree the tcl includes and libraries are
installed.

On my Freebsd box, I did:
CFLAGS="-I/usr/local/tcl/include" \ # that is a - capital i
LDFLAGS="-L/usr/local/tcl/lib" \
./configure \
 rest of configure options.

(put this in something like do-conf) and at the prompt type sh do-conf.

OR

you can use the --with-libs='lib1 ...'  option for the configure
script. You will to give the path to your TCL libraries against this
option.

Do a configure --help to see the available configure options with some
help strings.

But like Jason mentioned, why don't you use the stock Python install
that comes with Cygwin; it is tkinter enabled and works just fine?
(unless you have a compelling reason to install from source)
Thanks,
--Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Suggesion for an undergrad final year project in Python

2005-02-01 Thread Kartic
Sridhar said the following on 2/1/2005 2:11 AM:
Hi,
I am doing my undergrade CS course.  I am in the final year, and would
like to do my project involving Python.  Our instructors require the
project to have novel ideas.  Can the c.l.p people shed light on this
topic?
You try and implement some CS concepts you have learnt using Python. For 
example, if you had a course on parsing and compiler design, try to 
implement a simple language in Python.

Or if you like Computer Graphics, see if you can implement things like 
Phong shading and things in that field. This may not be novel like your 
professors want. But you can make it novel by allowing the user to 
rotate the object and show how the shadow and shading get transformed.

Or if you are the networking types, come up with a peer-to-peer chat 
application with whitetboard capability, which I am sure will be fairly 
novel.

Look within for answers :-)
That way you will reinforce your theory and learn Python as well.
Thanks,
--Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: "Mail receiver server"

2005-01-31 Thread Kartic
manatlan said the following on 1/31/2005 5:46 PM:
I like the idea, but how to connect the virtual smtp and a python script ?
but ... There should be a way to be python only ... because i don't want 
to be very complex, i just want to get the subject of the email, to run 
some commands (and perhaps get a attachment file) ... but that's all
i am pretty sure that a recipe exists ... that a man has already done 
that !
But i don't know what to query on google ...
Hi,
What you are trying to do is what is called a mail filter. So google for 
python mail filter and see what you get.

With this setup, lets say Computer B sends an email to user controluser 
on Computer  A , the email is actually passed off to a script (in your 
case python script) to process the incoming email, instead of actually 
delivering the email to the user's inbox on "A".

I don't have the faintest the idea how you would do this on IIS's 
virtual SMTP server; there is probably a setup user panel. In any case, 
on UNIXish systems, there are a few ways of doing it of which one way is 
to setup a user in a file called /etc/aliases and put an entry like this:

controluser: | /usr/local/bin/mailprocessor.py
which tells the SMTP server to pass off the email to script after the | 
(pipe) when controluser gets an email.

So, see if the SMTP control panel provides you with some such feature. 
If IIS does not, my suggestion to you will be to install Cygwin from 
cygwin.com and use the Exim Mail transfer agent available with Cygwin 
(You will have to choose that when installing Cygwin, it is not 
automatically installed) or please google for Windows SMTP Server and 
see if something piques your interest.

Now, coming to the Python related part. Your SMTP server will invoke 
your script by sending the incoming email data on your script's sysin.

So, from python you will do...
#!/usr/local/bin/python
import sys, email, os
em = email.message_from_file(sys.stdin) # Read message from Std Input
subject = em.get('Subject') # Get the subject from em object
if subject.startswith('reboot'):
   os.system('shutdown -r') # reboot the Server
For more information, please read the email module in the Python Module 
Docs.

Hope that will help you get started!
Thanks,
--Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: Problem with loading textfiles into dictionaries.

2005-01-30 Thread Kartic
Kartic said the following on 1/30/2005 8:21 PM:
[EMAIL PROTECTED] said the following on 1/30/2005 7:43 PM:

Hi - It looks like your code encountered a blank line when you got this 
error.

You should move "if len(siteline) == 0" part right after your readline. 
The way you have done it really does not help.

def do_load(self, arg):
sitefile = file('sitelist', 'r+', 1)
while True:
  siteline = sitefile.readline()
  if len(siteline) == 0:
 break
  site_rawlist = siteline.split()
  sitelist[site_rawlist[0]] = site_rawlist[1:]

Sorry...siteline = sitefile.readline().strip()
--
http://mail.python.org/mailman/listinfo/python-list


Re: Problem with loading textfiles into dictionaries.

2005-01-30 Thread Kartic
[EMAIL PROTECTED] said the following on 1/30/2005 7:43 PM:
Hello,
I want to do the following:
def do_load(self, arg):
sitefile = file('sitelist', 'r+', 1)
while True:
siteline = sitefile.readline()
site_rawlist = siteline.split()
sitelist[site_rawlist[0]] = site_rawlist[1:]
if len(siteline) == 0:
break
I want to load a textfile into a dictionaries and use the first word on
a line as the key for the list, then take the remaining words of the
line and make them values of the key. This doesn't work:
File "ftp.py", line 57, in do_load
sitelist[site_rawlist[0]] = site_rawlist[1:]
IndexError: list index out of range
Hi - It looks like your code encountered a blank line when you got this 
error.

You should move "if len(siteline) == 0" part right after your readline. 
The way you have done it really does not help.

def do_load(self, arg):
sitefile = file('sitelist', 'r+', 1)
while True:
  siteline = sitefile.readline()
  if len(siteline) == 0:
 break
  site_rawlist = siteline.split()
  sitelist[site_rawlist[0]] = site_rawlist[1:]
Thanks,
--Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: An mysql-python tutorial?

2005-01-28 Thread Kartic
Dfenestr8 said the following on 1/28/2005 5:21 PM:
Hi.
Been told by the admin of my (free!) server that he'd rather I should
learn to use mysql if I want to continue writing cgi scripts there.
Not even sure exactly what mysql is.
Is there a simple tutorial anywhere on the web about using python + mysql?  
Did you try googling?
There are two items in the very first page that should be of use to you. 
One is the Python-MySQL module, which you should have installed.

http://sourceforge.net/projects/mysql-python
There is an examples directory that has some concrete stuff to help you 
learn.

Another hit is a basic tutorial, simple to follow and learn :- 
http://images.devshed.com/Server_Side/Python/PythonMySQL/PythonMySQL.pdf

And here is one more site, good stuff here too:-
http://www.kitebird.com/articles/pydbapi.html
You might also want to check the "Charming Python" pages at IBM.com but 
I dont know if they have articles covering mysql.

HTH!
Thanks,
--Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: Problem with win32net on Windows 2K

2005-01-27 Thread Kartic
Thomas,

I have a Win2K machine and win32net imports just fine.

Here is what I did - started python shell with the -v switch and
imported win32net. This is what it says:
py>>> import win32net
# c:\python24\lib\encodings\cp437.pyc matches
c:\python24\lib\encodings\cp437.py
import encodings.cp437 # precompiled from
c:\python24\lib\encodings\cp437.pyc
import win32net # dynamically loaded from
C:\Python24\Lib\site-packages\win32\win32net.pyd

I tried this on Python 2.4, pywin32 build 203 and Win2k Version
5.00.2195 SP 4.

What version of Python are you using? Do you have the Python-version
corresponding version of the pywin32 extensions installed?

Another item you may want to check is if your PYTHONPATH is correct.
Are you able to import other win32 components correctly, for example,
win32com.client? Here is my Pythonpath:
c:\python24;c:\python24\lib;c:\python24\scripts;C:\Python24\Lib\site-packages\wi
n32;C:\Python24\Lib\site-packages\win32\lib;C:\Python24\Lib\site-packages\Python
win;C:\WorkArea\Python

/
Thanks,
--Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wx.Image: Couldn't add an image to the image list.

2005-01-26 Thread Kartic
Laszlo,

If you are using PIL just for scaling, you can do away with PIL. Even
if you do other things with PIL, you can use the Rescale method of the
wx.Image instance to resize. Here is the code (adapted from the Demo):

data = open('C:/TEMP/test.bmp'), "rb").read()
stream = cStringIO.StringIO(data)
img = wx.ImageFromStream( stream )
img.Rescale(32, 32) # Resize your image to 32x32
bmp = wx.BitmapFromImage( img ) # Convert Image to Bitmap
# Now display Bitmap in Panel
wx.StaticBitmap(self, -1, bmp, (bmp.GetWidth(), bmp.GetHeight()))
Try this and see if this works for you.

Thank you,
--Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help With Python

2005-01-26 Thread Kartic
Py>>> print "Spam, " * 115
Spam, Spam, Spam, Spam, Spam, . Spam,

Multiplies (repeats) the string 115 times.

To eliminate the last ", " (that is, a comma followed by space), you
can do it using the slice notation and say:
Py>>> print ("Spam, " * 115) [:-2]
Spam, Spam, Spam, Spam, Spam, ., Spam

The [:-2] means that you asking Python to print everything from the
beginning to the last but two characters of the string. You can also
write this as [0:-2]

[or [0:length_of_spam - 2] where length_of_spam = len("Spam, " * 115)]

Since you are starting off, please read and follow the tuturial that
available with your Python installation or on the Python.org site at
http://docs.python.org/tut/tut.html

Thank you,
--Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: import hook, overwrite import?

2005-01-26 Thread Kartic
Hi Torsten,

If you want to use other methods to import (other than good ole file
system), yes, you can create an importer class and register it as an
importer module, that import will use to search and import.

For example, it is possible to use zip imports (this functionality is
already builtin) to import from a zip archive.
py>>> import zlib # required
py>>> import sys
py>>> sys.path.append('/location/to/zippedmodules.zip')
py>>> import testzip
py>>> testzip.__file__
'/location/to/zippedmodules.zip/testzip,py'

To generally do it, you have to:
1. Create a class that provides a load_module method that returns a
module type.
2.  Install your class as a hook using
sys.path_hooks.append(your_importer_class)

Please take a look at the imp module :
http://docs.python.org/lib/module-imp.html for a complete description
on accessing the import internals. There is also a simple example in
this section.

Is this is what you are looking for?

Thanks,
--Kartic
PS: This about how much I know...the more I find out, I will share :-)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: FTP Server

2005-01-26 Thread Kartic
Michele -

Listen to your inner voice :-)

If simple is all you want, try twisted. You can use mktap to create a
simple ftp server and be ready to serve in a few minutes. And if you
are upto it, get buried in the documents and you can customize your ftp
server.

If you are looking for something simpler but not asynchronous, I found
this at the Vault called pyFTPDrop, which is aimed at *NIX.

http://www.mythi.cx/python/pyFTPdrop.py

/
Thank you,
--Kartic
PS: I am sure Medusa is fairly straightforward too, but I have no
experience with it.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Import from database

2005-01-25 Thread Kartic
Steve,

Hmmm... Yes, I see what you are saying. Could you post your create
table statement so that I can create a db and play around with
dbimport?

Thanks,
--Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Import from database

2005-01-24 Thread Kartic
Steve,

I believe you have to put ntpath, macpath and posixpath in the module
database for os.path to work.

I tried it with zipimporter builtin and I got the same traceback till I
added ntpath.py to my zip file. (Of course, I renamed the original
ntpath to _ntpath so that the original did not get imported)
Thanks,
--Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Tarfile module error

2005-01-21 Thread Kartic
Your NewBackupFilename contains ":" which is not a valid character in a
filename in Windows.

You could do something like this:
>>> NewBackupFilename = DirBackup + '\\' + '%s' %
str(datetime.today()).replace(':', '-') + '.tar.bz2'
>>> NewBackupFilename
'c:skpdc01Backups\\2005-01-21 12-26-21.373000.tar.bz2'
>>> TarFileBackup = tarfile.open(NewBackupFilename, 'w:bz2')
>>> # Works!
I changed your DirBackup to 'C:\skpdc01\Backups'

Thanks,
--Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Print a string in binary format

2005-01-20 Thread Kartic
neutrino said the following on 1/20/2005 8:21 PM:
Mmm, the output format that I want is like:
00011100
I tried your code on Cygwin under Windows 2000, and on Linux, but it
prints out ASCII characters.
Aha..I guess I posted too soon.
You might want to take a look at this cookbook entry:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/219300
Defines lambdas to convert integer to binary. The one you probably want is -
>>> bstr = lambda n, l=16: n<0 and binarystr((2L<>1).lstrip('0')+str(n&1) or '0'
>>> bstr(ord('a'))
'111'

--Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: Print a string in binary format

2005-01-20 Thread Kartic
neutrino said the following on 1/20/2005 7:53 PM:
Greetings to the Python gurus,
I have a binary file and wish to see the "raw" content of it. So I open
it in binary mode, and read one byte at a time to a variable, which
will be of the string type. Now the problem is how to print the binary
format of that charater to the standard output. It seems a common task
but I just cannot find the appropriate method from the documentation.
Thanks a lot.
Not a guru, but I will try to help out :-)
how about this:
>>> import binhex
>>> binhex.binhex('C:/windows/system32/telnet.exe', 'C:/TEMP/telnet.hex')
>>>
Now this is what telnet.hex looks like:
(This file must be converted with BinHex 4.0)
:#R4PE'jPG#jPH'8!2j!)[EMAIL PROTECTED]"d!
!N#2J$Kqk$J#d#FdKZ!&-c5&8D'Pc)("[EMAIL PROTECTED]&ZEQpd)'*P)(*eEL"
TEL"[EMAIL PROTECTED]([EMAIL PROTECTED]&THS#Cj([EMAIL PROTECTED]&TIS'P
DAU!QH8HJceTHS%Yj'[EMAIL PROTECTED]"RP#S-TDAU!'[EMAIL PROTECTED]
DAU!!N""343!!6!%$!&VGE6d!N!MJ!!m"#`%(!!$!"J)!N!AQ[3!!!"$
3!*!&!3!3!J!!"3!"!!8!!3!%!*!)i!)!!!3!!&Hl!3!$!!#%!!!3!*!
%%!!!%!#3"K!!N!Z3!-%!!-J!N!5J!J"B1!#3'[!5!!!F!*!M8!)!!-`!N!33!!$
F!J#3'LjdCAKdrVm3`!3!N!iJ!!"J,Q4KG'%!!!"mb`%!!0!
(... Big Snip ...)
Or how about this?
>>> f = open('C:/windows/system32/telnet.exe', 'rb')
>>> fcontents = f.read()
>>> import binhex
>>> print binhex.binascii.hexlify(fcontents[0:10])
'4d5a93000400'
>>>
Is this what you want???
Thanks,
--Kartic
--
http://mail.python.org/mailman/listinfo/python-list


Re: Using Sqlite with Python under Windows

2005-01-14 Thread Kartic

Michael Goettsche wrote:

> I succeeded in convincing my CS teacher to use Python and Sqlite
instead of
> Microsoft Access to get started with databases.
> We are working on a windows terminal server to which I have no admin
access,
> so I'd like to ask you which module is best suited to use Sqlite with
Python
> under windows. The best would be a module which is easy to install
without
> further dependencies.


Michael,

I posted this morning but I don't know what happened to my post!

In any case, PySqlite is the distribution I have used and is available
at pysqlite.org.

I believe there is another module called APSW (Another Python Sqlite
Wrapper) available, that I stumbled upon just today, after reading your
post. Home page : http://www.rogerbinns.com/apsw.html

Please read the section "pysqlite differences" to see which one you
want to install.

As for installation, it should be as simple as downloading the win32
binaries for your Python distro and executing it. I do not have admin
rights on my Win2K PC at work, but it installed and worked just fine.
So, you should not have any problem. You will not have to install
anything additional other the python-sqlite module itself.

Good choice on selecting Sqlite..I love it and hope you will enjoy it
too!

Thanks,
--Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Free python server.

2005-01-13 Thread Kartic
And yes, they have python installed...

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Free python server.

2005-01-13 Thread Kartic
You can try for a free shell access at www.arbornet.org.

telnet (or better SSH) to m-net.arbornet.org and at the login prompt,
type newuser, press enter and follow the on-screen instructions to
register.

Once you register, you get a shell account with email and web space.
Since it is a free service, space is very limited but should more than
serve your needs now.

--Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: encryption/decryption help

2005-01-12 Thread Kartic
Hi,

Can you use ssh tunneling? You will not be changing anything except add
an extra ssh layer to tunnel your data through. There is how-to at
http://www.ccs.neu.edu/groups/systems/howto/howto-sshtunnel.html

(or you can google for tunneling)

Please note you can not use MD5 as it is not reversible.
Thanks,
--Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python guy ide

2005-01-11 Thread Kartic
Ionel,

There are IDE's based on wxPython like SPE and DrPython. SPE is great,
but it stops responding when I try to run my wxPython apps (probably
something I am doing!). DrPython is another free IDE and it is nice
too.

>From what I have read, WingIDE is an excellent product (it is a
commercial product).

Actually , the "best" IDE depends on how you will be using it. If you
are looking at nifty debugging features I believe WingIDE is one of the
top environments.

SPE has it own GUI designer (basically invokes wxGlade), also has a 3D
modelling tool (Blender), does syntax checking using pycheck and has
good debug capabilities. From what I have seen, I like SPE quite a bit
(except for my wx programs hanging).

SPE - http://spe.pycs.net/
DrPython - http://drpython.sourceforge.net/
WingIDE - http://www.wingide.com/
You can google for Python IDE and see what comes up.

Thanks,
--Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Importing Problem on Windows

2005-01-10 Thread Kartic
It is quite possible that in linux, you launched the python interpreter
shell from the same directory you stored your parser.py and parse.py
files.

On windows, you probably saved the parser*.py files to some place like
"my documents" and launched the python interpreter or IDLE.

So, you could probably try this:
1. Launch command shell.
2. CD to the directory where you saved the parser*.py files.
3.  Start python.exe from the command prompt (not from the Program
Files shortcut)
4. Try importing.

Easier...copy the parser*.py files into the Libs folder of your python
installation in your windows machine.

Thanks,
--Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: path to python file given module

2005-01-09 Thread Kartic
That is because your module in not in a standard location that python
can find it in. It is not that inspect.getsourcefile() is not working.

Actually if you try reloading your filegen module after the os.chdir(),
you will see that import fails. If you copy your filegen directory to
the site-packages directory of python, you will get the complete path
of the module no matter where you are inside your script.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: path to python file given module

2005-01-09 Thread Kartic
Try this:;

>>> import filegen
>>> import inspect
>>> print inspect.getsourcefile(filegen.SomeClass)
'C:\\Python23\\Lib\\site-packages\\filegen\filegen.py'

Cheers,
--Kartic

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: use a file as a database, access rights

2005-01-09 Thread Kartic
Steve Holden wrote:


> Sounds to me like you need to add a rights layer to gadfly.


Aha...I did not consider that possibility. I have not gone indepth into
Gadfly...is that a straigtforward thing to implement?

-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   >