[Spambayes-checkins] spambayes/windows pop3proxy_service.py,1.2,1.3

Mark Hammond mhammond at users.sourceforge.net
Sat Mar 22 23:21:55 EST 2003


Update of /cvsroot/spambayes/spambayes/windows
In directory sc8-pr-cvs1:/tmp/cvs-serv19274

Modified Files:
	pop3proxy_service.py 
Log Message:
Fix [ 707491 ] Pop3 proxy service code for Windows doesn't work...
__file__ doesn't exist for __main__ pre Python 2.3.


Index: pop3proxy_service.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/windows/pop3proxy_service.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pop3proxy_service.py	12 Mar 2003 13:27:51 -0000	1.2
--- pop3proxy_service.py	23 Mar 2003 07:21:52 -0000	1.3
***************
*** 21,25 ****
  # need the parent on sys.path, so 'spambayes.spambayes' is a package,
  # and 'pop3proxy' is a module
! sb_dir = os.path.dirname(os.path.dirname(__file__))
  
  sys.path.insert(0, sb_dir)
--- 21,35 ----
  # need the parent on sys.path, so 'spambayes.spambayes' is a package,
  # and 'pop3proxy' is a module
! try:
!     # module imported by service manager, or 2.3 (in which __main__
!     # exists, *and* sys.argv[0] is always already absolute)
!     this_filename=__file__
! except NameError:
!     # Python 2.3 __main__
!     # patch up sys.argv, as our cwd will confuse service registration code
!     sys.argv[0] = os.path.abspath(sys.argv[0])
!     this_filename = sys.argv[0]
! 
! sb_dir = os.path.dirname(os.path.dirname(this_filename))
  
  sys.path.insert(0, sb_dir)





More information about the Spambayes-checkins mailing list