Re: Re: PyDS as a service

Georg Bauer <gb-BRhJDZTO+/[email protected]> Mon, 29 Mar 2004 22:01:41 +0200
Newsgroups gmane.comp.pythin.pyds.devel
Message-ID <r02010100-1028-E5DA70BA81BB11D8A517000A9573A72A@[10.0.0.145]>
Hi!

> I removed the following line:
> from Toolserver.Config import config

Ah, yes, that's right.

> And finally I removed '-c start' from the startcommand (3rd line from 
> bottom)

Yep, that one I forgot in my previous description, too.

> The service installs perfectly, but doesn't want to start. I guess it 
> has something to do with the absence of the HOME envrionment variable.

Ah. Ok, you need some settings for PyDS to run - they might not be
available if you run PyDS as a service under the Administrator account.
Try to choose your normal user account, as that one should have all
needed settings.

But it might be the same problem as what I wrote just recently, that the
environment settings for users are actually not the right ones as they
are currently used by PyDS. The problem is, the current windows version
is started by a command file that set's the home variable. This command
file isn't used when you directly start it as a service.

Hmm. We could switch to using %USERPROFILE% directly in
PyDS/DefaultConfig.py - currently it uses this code:

# compute some special filenames and paths
try:
  HOMEDIR = os.environ['PYDS_HOME']
except KeyError:
  if sys.platform == 'win32':
    try:
      home = os.environ['HOME'] # for custom environments
    except KeyError: # more likely default NT/2K/XP install
      home = os.environ['HOMEDRIVE'] + os.environ['HOMEPATH']
  else:
    home = os.environ['HOME']
  HOMEDIR = constructPath(home, '.PyDS')

It could be changed like this:

# compute some special filenames and paths
try:
  HOMEDIR = os.environ['PYDS_HOME']
except KeyError:
  if sys.platform == 'win32':
    try:
      home = os.environ['HOME'] # for custom environments
    except KeyError: # more likely default NT/2K/XP install
      try:
        home = os.environ['USERPROFILE']
      except KeyError:
        home = os.environ['HOMEDRIVE'] + os.environ['HOMEPATH']
  else:
    home = os.environ['HOME']
  HOMEDIR = constructPath(home, '.PyDS')

This would prefer USERPROFILE over HOMEDRIVE+HOMEPATH - so your PyDS
installation stuff for your user would be in
c:\System\Profiles\USERACCOUNT\.Toolserver\ - you might need to move
your current installation there.

It would be cool if you could check that out. I will put that into CVS
if it works (including your patched pyds-win32.py, if you send that to
the list).

> This is what I get in \PyDS\.PyDS\log\errors:
[...]
>   File "C:\Python23\lib\site-packages\PyDS\EventsTool.py", line 102,
in 
> getPref
>     return getattr(self.prefs[0], pref, '')
> AttributeError: EventsTool instance has no attribute 'prefs'

Hmmm. A rather weird one - looks like PyDS wanted to log an error before
it was actually initialized. This might be due to the fact of PyDS not
initializing correctly because of missing environment settings.

bye, Georg