Subject: Marine Geospatial Ecology Tools (MGET) help
Text archives
From: | "Jason Roberts" <> |
---|---|
To: | "'Mark Zimmermann - NOAA Federal'" <> |
Cc: | <> |
Subject: | RE: [mget-help] Fit GAM output? |
Date: | Thu, 17 Apr 2014 17:57:17 -0400 |
Hi Mark, Thanks for your interest in MGET. It sounds like there is an installation problem. Did the tool complete very quickly (in just a second or two)? If so, and there is no output as you indicated, then an installation problem is probably preventing MGET from running, to the point that it cannot even report messages to the ArcGIS logging system. To gather additional evidence, you could try another tool. All of them should fail. A simple test is to try MGET/Statistics/Evaluate R Statements/Evaluate R Statements. Put in print(1) for the first parameter and run it. You should get output similar to this: Executing: REvaluate print(1) true # # x y z m true # # # Start Time: Thu Apr 17 17:51:34 2014 Running script REvaluate... [1] 1 Completed script REvaluate... Succeeded at Thu Apr 17 17:51:40 2014 (Elapsed Time: 5.37 seconds) The [1] 1 is what comes from R. If the tool appears to execute successfully but you don’t see that, then the installation is likely broken. If so, could you please do this to help me diagnose it? 1. Save the attached Python script to your Windows desktop. 2. Double click on it to run it. 3. It will create a file on the desktop called GetMoreInformation.txt. Please email me that file. Also, please let me know what version of ArcGIS you have, and whether you have ever installed Python yourself (vs. just allowing the ArcGIS setup program install Python). Best, Jason From: Mark Zimmermann - NOAA Federal [mailto:] Dear MGET Help, Just trying to get started with and it appeared to work using variables within a point shape file, but I can't find any results or output. There were no errors reported. I see that there is an "Evaluate R Statements" tool but I can't find any file to evaluate. Any hints? Thanks, Mark |
outputTextFile = os.path.join(os.path.dirname(__file__),
os.path.splitext(os.path.basename(__file__))[0] + '.txt')
f = open(outputTextFile, 'w')
f.write(__file__ + '\n')
f.write(sys.executable + '\n')
sitePackagesDir = os.path.join(os.path.dirname(sys.executable), 'Lib',
'site-packages')
f.write(sitePackagesDir + ' : ' + repr(os.path.isdir(sitePackagesDir)) + '\n')
f.write(os.path.join(sitePackagesDir, '_GeoEcoArcGISHelper.pyd') + ' : ' +
repr(os.path.isdir(os.path.join(sitePackagesDir, '_GeoEcoArcGISHelper.pyd')))
+ '\n')
f.write(os.path.join(sitePackagesDir, 'GeoEco') + ' : ' +
repr(os.path.isdir(os.path.join(sitePackagesDir, 'GeoEco'))) + '\n')
f.write(sys.version + '\n')
f.write(repr(glob.glob('C:\\*')) + '\n')
if os.path.isdir(sitePackagesDir):
f.write('\n')
f.write(repr(glob.glob(sitePackagesDir + '\\*')) + '\n')
installedFromFile = 'C:\\Program
Files\\GeoEco\\ArcGISToolbox\\InstalledFrom.txt'
installedFromX86File = 'C:\\Program Files
(x86)\\GeoEco\\ArcGISToolbox\\InstalledFrom.txt'
f.write('\n')
f.write(os.path.dirname(installedFromFile) + ' : ' +
repr(os.path.isdir(os.path.dirname(installedFromFile))) + '\n')
f.write(installedFromFile + ' : ' + repr(os.path.isfile(installedFromFile)) +
'\n')
if os.path.isfile(installedFromFile):
try:
f2 = file(installedFromFile, 'rU')
f.write(f2.read())
f2.close()
except:
pass
f.write('\n')
f.write(os.path.dirname(installedFromX86File) + ' : ' +
repr(os.path.isfile(os.path.dirname(installedFromX86File))) + '\n')
f.write(installedFromX86File + ' : ' +
repr(os.path.isfile(installedFromX86File)) + '\n')
if os.path.isfile(installedFromX86File):
try:
f2 = file(installedFromX86File, 'rU')
f.write(f2.read())
f2.close()
except:
pass
f.write('\n')
f.write('Trying to import _GeoEcoArcGISHelper\n')
try:
import _GeoEcoArcGISHelper
except:
traceback.print_exc(file=f)
else:
f.write('Successfully imported _GeoEcoArcGISHelper from %s\n' %
sys.modules['_GeoEcoArcGISHelper'].__file__)
f.write('\n')
f.write('Trying to import numpy\n')
try:
import numpy
except:
traceback.print_exc(file=f)
else:
f.write('Successfully imported numpy from %s\n' %
sys.modules['numpy'].__file__)
f.write('The numpy version is %s\n' % sys.modules['numpy'].__version__)
f.write('\n')
f.write('Trying to import _winreg\n')
try:
import _winreg
except:
traceback.print_exc(file=f)
else:
def GetRegistryValue(f, hkey, hkeyStr, subkey, valueName=None):
if valueName is None:
f.write('Trying to get the value of %s\\%s\n' % (hkeyStr, subkey))
else:
f.write('Trying to get the %s value of %s\\%s\n' % (valueName,
hkeyStr, subkey))
try:
h = _winreg.OpenKey(hkey, subkey)
try:
try:
if valueName is None:
value = _winreg.QueryValue(h, None)
else:
value = _winreg.QueryValueEx(h, valueName)[0]
except:
traceback.print_exc(file=f)
else:
f.write('The value was: %r\n' % value)
finally:
_winreg.CloseKey(h)
except:
traceback.print_exc(file=f)
GetRegistryValue(f, _winreg.HKEY_CLASSES_ROOT, 'HKEY_CLASSES_ROOT',
'Python.CompiledFile\\shell\\open\\command')
GetRegistryValue(f, _winreg.HKEY_CLASSES_ROOT, 'HKEY_CLASSES_ROOT',
'Python.File\\shell\\open\\command')
GetRegistryValue(f, _winreg.HKEY_LOCAL_MACHINE, 'HKEY_LOCAL_MACHINE',
'SOFTWARE\\Classes\\Python.CompiledFile\\shell\\open\\command')
GetRegistryValue(f, _winreg.HKEY_LOCAL_MACHINE, 'HKEY_LOCAL_MACHINE',
'SOFTWARE\\Classes\\Python.File\\shell\\open\\command')
f.write('\n')
GetRegistryValue(f, _winreg.HKEY_LOCAL_MACHINE, 'HKEY_LOCAL_MACHINE',
'SOFTWARE\\R-core\\R32', 'Current Version')
GetRegistryValue(f, _winreg.HKEY_LOCAL_MACHINE, 'HKEY_LOCAL_MACHINE',
'SOFTWARE\\R-core\\R32', 'InstallPath')
GetRegistryValue(f, _winreg.HKEY_LOCAL_MACHINE, 'HKEY_LOCAL_MACHINE',
'SOFTWARE\\R-core\\R', 'Current Version')
GetRegistryValue(f, _winreg.HKEY_LOCAL_MACHINE, 'HKEY_LOCAL_MACHINE',
'SOFTWARE\\R-core\\R', 'InstallPath')
f.write('\n')
f.write('Trying to import GeoEco.OceanographicAnalysis.Fronts\n')
try:
import GeoEco.OceanographicAnalysis.Fronts
except:
traceback.print_exc(file=f)
else:
f.write('Successfully imported GeoEco.OceanographicAnalysis.Fronts from
%s\n' % sys.modules['GeoEco.OceanographicAnalysis.Fronts'].__file__)
cleanFrontsFile =
os.path.join(os.path.dirname(sys.modules['GeoEco.OceanographicAnalysis.Fronts'].__file__),
'CleanFronts.py')
if os.path.exists(cleanFrontsFile):
f.write('%s exists\n' % cleanFrontsFile)
f.write('Trying to import win32api\n')
try:
import win32api
except:
traceback.print_exc(file=f)
else:
f.write('Calling win32api.FindExecutable on %s\n' %
cleanFrontsFile)
try:
executable = win32api.FindExecutable(cleanFrontsFile,
cleanFrontsFile)[1]
except:
traceback.print_exc(file=f)
else:
f.write('win32api.FindExecutable returned %s\n' % executable)
else:
f.write('%s DOES NOT EXIST' % cleanFrontsFile)
f.write('\n')
f.write('Initializing MGET logging\n')
f.close()
loggingIniContents = u"""
[handlers]
keys=LogFile
[handler_LogFile]
class=FileHandler
formatter=LogFile
args=(u'""" + outputTextFile + """',)
[formatters]
keys=LogFile
[formatter_LogFile]
format=%(asctime)s %(levelname)s %(message)s
[loggers]
keys=root,GeoEco,ArcGIS,COM,DatabaseAccess,Datasets,R
[logger_GeoEco]
level=DEBUG
handlers=LogFile
propagate=0
qualname=GeoEco
[logger_ArcGIS]
level=DEBUG
handlers=LogFile
propagate=0
qualname=GeoEco.ArcGIS
[logger_COM]
level=DEBUG
handlers=LogFile
propagate=0
qualname=GeoEco.COM
[logger_DatabaseAccess]
level=DEBUG
handlers=LogFile
propagate=0
qualname=GeoEco.DatabaseAccess
[logger_Datasets]
level=DEBUG
handlers=LogFile
propagate=0
qualname=GeoEco.Datasets
[logger_R]
level=DEBUG
handlers=LogFile
propagate=0
qualname=GeoEco.R
[logger_root]
level=DEBUG
handlers=LogFile
"""
loggingIniPath = os.path.join(os.path.dirname(__file__),
os.path.splitext(os.path.basename(__file__))[0] + '_Logging.ini')
fLoggingIni = open(loggingIniPath, 'w')
try:
fLoggingIni.write(loggingIniContents)
finally:
fLoggingIni.close()
try:
from GeoEco.Logging import Logger
Logger.Initialize(loggingConfigFile=unicode(loggingIniPath))
finally:
os.remove(loggingIniPath)
Logger.Info('Trying to access R')
try:
from GeoEco.R import R, RDependency
d = RDependency(2, 5, 0)
d.Initialize()
r = R.GetInterpreter()
Logger.Info('Trying 1+1 with R.')
r('print(1+1)')
except:
Logger.LogExceptionAsError()
f.close()
#raw_input()