Hi everybody,
I try to use Arcpy on Apache 2.4 and CGI that is basic example. But I can't, It always display error message like "Not signed into Portal".
Although I signed in.
And then, I check about Licensing
So, ArcGIS configuration is ok.
Now I show you see what Apache configuration
- httpd.conf, I have enabled LoadModule cgi_module modules/mod_cgi.so
- ViltualHost,
=> I checked, VirtualHost works well without use Arcpy.
Apache Service is running
Python example script
The result
But When I import Arcpy in my Python script, It has the problem.
The bellowing is apache-cgi-example.py content
#!C:/Program Files/ArcGIS/Pro/bin/Python/envs/arcgispro-py3/python.exe # coding: utf-8 print("Content-type: text/html\n\n") print("") print("<h2>ArcGIS runs on Apache 2.4 + CGI</h2>") import sys, os import bottle import cgitb cgitb.enable() realpath = os.path.dirname(os.path.realpath(__file__)) sys.path.append(realpath) print("<p><b>Project path</b>: {}</p>".format(str(realpath))) app = bottle.default_app() app.config.load_config("%s\\app.conf" % realpath) try: print("<p><b>Output path</b>: {}</p>".format(str(app.config['app.output_path']))) import arcpy # Arcpy can overwrite output arcpy.env.overwriteOutput = True # set workspace dir arcpy.env.workspace = app.config['app.output_path'] # initiation for volume calculation arcpy.CheckOutExtension("3D") arcpy.CheckOutExtension("spatial") except Exception as error: print("<p><b>Cannot import Arcpy. Error</b>: {}</p>".format(str(error)))
The problem is "Not signed into Portal"
The page content is
Can your please help me?
Thank many help!
Note:
- It has the same problem on IIS environment
- I am using ArcGIS Pro version 1.3 (Python version 3.4.4) 64bit
- I am using Apache 2.4.23 64bit
Why is this posted under "ArcGis Pro SKD" ?
your question isn't related to the .NET SDK. Maybe you should move it to Python?
Thank Gwen_roy. I moved
As suggested, your should probably move it Python ...see https://community.esri.com/docs/DOC-2258?sr=search&searchId=ba9cdc9d-b9e7-4a97-86b8-18c21f293f8c&sea... for help on that.
Also, I'll tag https://community.esri.com/community/gis/web-gis/portal-for-arcgis?sr=search&searchId=6f14e1a1-b673-... https://community.esri.com/community/gis/enterprise-gis?sr=search&searchId=4e398f00-945f-4d83-a81d-4... and https://community.esri.com/community/gis/applications/arcgis-pro?sr=search&searchId=b217f6e1-e6c7-42... for more exposure.
Thank a lot @Rebecca
What happens if you import arcpy within the Python window in Pro?
If I try to import acrpy in another environment, It works well.
C:\Users\Lab1-Python>python
Python 3.4.4 |Continuum Analytics, Inc.| (default, Feb 16 2016, 09:54:04) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import arcpy
>>>
Also, I run my Python script by python apache-cgi-example.py => It works
C:\Workspace\Arcpy\apache-env>python apache-cgi-example.py
Content-type: text/html<h2>ArcGIS runs on Apache 2.4 + CGI</h2>
<p><b>Project path</b>: C:\Workspace\Arcpy\apache-env</p>
<p><b>Output path</b>: C:\Workspace\Arcpy\apache-env\Temporary</p>
<p>Arcpy has been imported.</p>C:\Workspace\Arcpy\apache-env>
It doesn't work on Apache + CGI or IIS + CGI, It looks like Arcpy doesn't work on the environment as Windows service
Finally, If I use arcpy without Apache/IIS, It works
More info
I am using bottle to start my project like web page, almost my function calculate on the raster within big data and a lot user connect to request data. For example: I calculate CutFill of surface.
=> Sometime is suspended.
So, I need to set up a web server for my project. My script can run on Apache/Nginx, IIS or whatever.
----
I also have the problem when try to use Arcpy on Apache + mod_wsgi but I cannot use CutFill tool
I really need any help to resolve it.
so If someone has another way please help me.
Thank a lot.
You mention ArcGIS pro and arcpy in the same context. I am under the impression that arcpy for pro is tied to the anaconda distribution. Did you have evidence that it works elsewhere?
Also, version 1.3 is outdated and I see no reference in the What's new section going back that changes this. Have you field a support request?
Hi Dan Patterson
Yeah, I knew version 1.3 is very old but my customer is using that version. I cannot request they upgrade.
So I share to you about arcpy works on another environment via video
And I also use PyCharm to run my Python script. And It works well
sounds like a Support call... nothing in there helped me point you in the right direction.,.. sorry