ArcMap copying the default Python libraries like smtp.py while publishing GPService in \v101\<toolbox_name> folder.

2273
2
Jump to solution
04-17-2016 10:07 PM
ShreyaChatterjee
New Contributor

Hello,
I am facing a strange issue since last 2 days. I am trying a publish a GP service containing a simple code to send an email to the provided userid using smtplib. The tool is running successfully and the email is being sent.


After the tool is published, when I am opening the folder

C:\arcgisserver\directories\arcgissystem\arcgisinput\<folder name>\<service_name>.GPServer\extracted
strangely I am finding a tilingservice.xml file.


And when I am opening the folder:
C:\arcgisserver\directories\arcgissystem\arcgisinput\<folder name>\<service_name>.GPServer\extracted\v101\<toolbox_name>
I found that smtplib.py has been copied !

I tried publishing the service from a ArcMap in a different server to mine this issue is not getting reproduced. But when I am publishing my from ArcMap in my laptop to any other server the same issue is getting reproduced.
I have tried deleting the Python27 folder and repairing it but this does not help.
Any help or leads is really appreciated.

Thanks in advance,

Shreya

0 Kudos
1 Solution

Accepted Solutions
JonMorris2
Occasional Contributor II

I've had this problem, where the publisher takes forever to publish a simple script, then I found it has imported lots of builtin python modules to the gp service folder.

I managed to workaround it though, by changing my imports so only the functions I needed were imported. E.g. change "import module" to "from module import a, b, c, etc."

This post pointed me in the right direction.

View solution in original post

2 Replies
JonMorris2
Occasional Contributor II

I've had this problem, where the publisher takes forever to publish a simple script, then I found it has imported lots of builtin python modules to the gp service folder.

I managed to workaround it though, by changing my imports so only the functions I needed were imported. E.g. change "import module" to "from module import a, b, c, etc."

This post pointed me in the right direction.

ShreyaChatterjee
New Contributor

Hello Jon Morris !
Thanks for replying!
As suggested by you I made the following amendments to the code:

from arcpy import *
from smtplib import SMTP

and it worked!

Thanks again!
Shreya

0 Kudos