Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.

Alteryx App runs fine in Designer but fails in Server

mohdfaraz47
7 - Meteor

Hello All,

I have an App that currently runs fine in designer but when scheduling in Gallery it fails. After many trials and errors with AYX support we were able to find one thing that we need to test to rule this out i.e. When the APP is running it creates  PDF/PNG's in the folder where the APP is saved but for Server as it runs in the temporary engine space AYX told us that it could be that they python code that comes after the download tool step is unable to find the files PDF and PNG in the server directory where pythoon tool is looking as its because the files are created in engine space and python tool is looking in a directory specified by us so to tackle this we need to do 1)Either move the files from temp space to the directory we specified in python tool.  or 2) Use the engine path in the python tool so that the code can look into the temp engine folder for PDF/ PNG and then do the post processing. 

 

Is there a way I can use the temp path in the python code .

mohdfaraz47_0-1646771844081.png

from ayx import Alteryx
from ayx import Package
from pptx import Presentation
from pptx.util import Inches

# Giving Images path
img_path1 = '//vc2crtp2602830/WSA/Landing Page.png'
img_path2 = '//vc2crtp2602830/WSA/IT 01_1.png'
img_path3 = '//vc2crtp2602830/WSA/IT 01_2.png'
img_path4 = '//vc2crtp2602830/WSA/IT 02.png'
img_path5 = '//vc2crtp2602830/WSA/IT 03.png'
img_path6 = '//vc2crtp2602830/WSA/IT 04_1.png'
img_path7 = '//vc2crtp2602830/WSA/IT 04_2.png'
img_path8 = '//vc2crtp2602830/WSA/IT 05.png'
img_path9 = '//vc2crtp2602830/WSA/IT 06.png'
img_path10 = '//vc2crtp2602830/WSA/IT 07_1.png'
img_path11 = '//vc2crtp2602830/WSA/IT 07_2.png'
img_path12 = '//vc2crtp2602830/WSA/IT 08.png'
# Creating an Presentation object
ppt = Presentation()

# Selecting blank slide
blank_slide_layout = ppt.slide_layouts[6]

# Attaching slides to ppt
slide1 = ppt.slides.add_slide(blank_slide_layout)
slide2 = ppt.slides.add_slide(blank_slide_layout)
slide3 = ppt.slides.add_slide(blank_slide_layout)
slide4 = ppt.slides.add_slide(blank_slide_layout)
slide5 = ppt.slides.add_slide(blank_slide_layout)
slide6 = ppt.slides.add_slide(blank_slide_layout)
slide7 = ppt.slides.add_slide(blank_slide_layout)
slide8 = ppt.slides.add_slide(blank_slide_layout)
slide9 = ppt.slides.add_slide(blank_slide_layout)
slide10 = ppt.slides.add_slide(blank_slide_layout)
slide11 = ppt.slides.add_slide(blank_slide_layout)
slide12 = ppt.slides.add_slide(blank_slide_layout)
# adding images
top = Inches(0)
left = Inches(0)
height = Inches(7.5)
width = Inches(10)

pic1 = slide1.shapes.add_picture(img_path1, left,
top, height = height, width = width)
pic2 = slide2.shapes.add_picture(img_path2, left,
top, height = height, width = width)
pic3 = slide3.shapes.add_picture(img_path3, left,
top, height = height, width = width)
pic4 = slide4.shapes.add_picture(img_path4, left,
top, height = height, width = width)
pic5 = slide5.shapes.add_picture(img_path5, left,
top, height = height, width = width)
pic6 = slide6.shapes.add_picture(img_path6, left,
top, height = height, width = width)
pic7 = slide7.shapes.add_picture(img_path7, left,
top, height = height, width = width)
pic8 = slide8.shapes.add_picture(img_path8, left,
top, height = height, width = width)
pic9 = slide9.shapes.add_picture(img_path9, left,
top, height = height, width = width)
pic10 = slide10.shapes.add_picture(img_path10, left,
top, height = height, width = width)
pic11 = slide11.shapes.add_picture(img_path11, left,
top, height = height, width = width)
pic12 = slide12.shapes.add_picture(img_path12, left,
top, height = height, width = width)
# save file
ppt.save('\\vc2crtp2602830\WSA\Investment/Trends.pptx')

print("Done")

5 REPLIES 5
mohdfaraz47
7 - Meteor

--------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) <ipython-input-2-61150c278137> in <module> 42 width = Inches(10) 43 ---> 44 pic1 = slide1.shapes.add_picture(img_path1, left, 45 top, height = height, width = width) 46 pic2 = slide2.shapes.add_picture(img_path2, left, c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\pptx\shapes\shapetree.py in add_picture(self, image_file, left, top, width, height) 330 without regard to its native aspect ratio. 331 """ --> 332 image_part, rId = self.part.get_or_add_image_part(image_file) 333 pic = self._add_pic_from_image_part(image_part, rId, left, top, width, height) 334 self._recalculate_extents() c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\pptx\parts\slide.py in get_or_add_image_part(self, image_file) 37 relationship already exists, they are reused, otherwise they are newly created. 38 """ ---> 39 image_part = self._package.get_or_add_image_part(image_file) 40 rId = self.relate_to(image_part, RT.IMAGE) 41 return image_part, rId c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\pptx\package.py in get_or_add_image_part(self, image_file) 34 otherwise a new one is created. 35 """ ---> 36 return self._image_parts.get_or_add_image_part(image_file) 37 38 def get_or_add_media_part(self, media): c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\pptx\package.py in get_or_add_image_part(self, image_file) 149 that instance is returned, otherwise a new image part is created. 150 """ --> 151 image = Image.from_file(image_file) 152 image_part = self._find_by_sha1(image.sha1) 153 return ImagePart.new(self._package, image) if image_part is None else image_part c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\pptx\parts\image.py in from_file(cls, image_file) 160 if is_string(image_file): 161 # treat image_file as a path --> 162 with open(image_file, "rb") as f: 163 blob = f.read() 164 filename = os.path.basename(image_file) FileNotFoundError: [Errno 2] No such file or directory: '//vc2crtp2602830/WSA/Landing Page.png'

--------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) <ipython-input-2-802b8b79873a> in <module> 2 from ayx import Alteryx 3 from PyPDF2 import PdfFileMerger ----> 4 df=Alteryx.read("#1") 5 vInputFile = df['File Path'].iloc[0] 6 vFilename=df['Output File Name'].iloc[0] c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\ayx\export.py in read(incoming_connection_name, debug, **kwargs) 33 When running the workflow in Alteryx, this function will convert incoming data streams to pandas dataframes when executing the code written in the Python tool. When called from the Jupyter notebook interactively, it will read in a copy of the incoming data that was cached on the previous run of the Alteryx workflow. 34 """ ---> 35 return __CachedData__(debug=debug).read(incoming_connection_name, **kwargs) 36 37 c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\ayx\CachedData.py in read(self, incoming_connection_name) 304 try: 305 # get the data from the sql db (if only one table exists, no need to specify the table name) --> 306 data = db.getData() 307 # print success message 308 print("".join(["SUCCESS: ", msg_action])) c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\ayx\Datafiles.py in getData(self, data, metadata) 498 if data is None: 499 # read in data as a list of numpy ndarrays --> 500 data = self.connection.read_nparrays() 501 # check if data is a list of numpy structs 502 elif isinstance(data, list) and all( RuntimeError: DataWrap2WrigleyDb::GoRecord: Attempt to seek past the end of the file

marcusblackhill
12 - Quasar
12 - Quasar

Hi @mohdfaraz47 !

You tried to run it from the designer in the server machine as well?

 

If yes and that runs ok from there, look if your server is configured to run as a different user, maybe that user don't have access to the path you're setting to get the image files.

mohdfaraz47
7 - Meteor

Hello Marcus, Yes I did. Designer it works totally fine. Its only when its run from Gallery or when it is being scheduled. Any help is appreciated. We checked and the run as user has all the necessary permissions.

marcusblackhill
12 - Quasar
12 - Quasar

@mohdfaraz47 !

 

I see, try to add the installation code to your script. Maybe that package isn't installed in the run as user. If that fails to install, cehck your proxy settings in the server machine.

mohdfaraz47
7 - Meteor

Yep we ensured that the correct libs are installed in the Server, That is not the issue. The error code when I run the app is as follows:

--------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) <ipython-input-2-61150c278137> in <module> 42 width = Inches(10) 43 ---> 44 pic1 = slide1.shapes.add_picture(img_path1, left, 45 top, height = height, width = width) 46 pic2 = slide2.shapes.add_picture(img_path2, left, c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\pptx\shapes\shapetree.py in add_picture(self, image_file, left, top, width, height) 330 without regard to its native aspect ratio. 331 """ --> 332 image_part, rId = self.part.get_or_add_image_part(image_file) 333 pic = self._add_pic_from_image_part(image_part, rId, left, top, width, height) 334 self._recalculate_extents() c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\pptx\parts\slide.py in get_or_add_image_part(self, image_file) 37 relationship already exists, they are reused, otherwise they are newly created. 38 """ ---> 39 image_part = self._package.get_or_add_image_part(image_file) 40 rId = self.relate_to(image_part, RT.IMAGE) 41 return image_part, rId c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\pptx\package.py in get_or_add_image_part(self, image_file) 34 otherwise a new one is created. 35 """ ---> 36 return self._image_parts.get_or_add_image_part(image_file) 37 38 def get_or_add_media_part(self, media): c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\pptx\package.py in get_or_add_image_part(self, image_file) 149 that instance is returned, otherwise a new image part is created. 150 """ --> 151 image = Image.from_file(image_file) 152 image_part = self._find_by_sha1(image.sha1) 153 return ImagePart.new(self._package, image) if image_part is None else image_part c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\pptx\parts\image.py in from_file(cls, image_file) 160 if is_string(image_file): 161 # treat image_file as a path --> 162 with open(image_file, "rb") as f: 163 blob = f.read() 164 filename = os.path.basename(image_file) FileNotFoundError: [Errno 2] No such file or directory: '//vc2crtp2602830/WSA/Landing Page.png'

--------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) <ipython-input-2-802b8b79873a> in <module> 2 from ayx import Alteryx 3 from PyPDF2 import PdfFileMerger ----> 4 df=Alteryx.read("#1") 5 vInputFile = df['File Path'].iloc[0] 6 vFilename=df['Output File Name'].iloc[0] c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\ayx\export.py in read(incoming_connection_name, debug, **kwargs) 33 When running the workflow in Alteryx, this function will convert incoming data streams to pandas dataframes when executing the code written in the Python tool. When called from the Jupyter notebook interactively, it will read in a copy of the incoming data that was cached on the previous run of the Alteryx workflow. 34 """ ---> 35 return __CachedData__(debug=debug).read(incoming_connection_name, **kwargs) 36 37 c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\ayx\CachedData.py in read(self, incoming_connection_name) 304 try: 305 # get the data from the sql db (if only one table exists, no need to specify the table name) --> 306 data = db.getData() 307 # print success message 308 print("".join(["SUCCESS: ", msg_action])) c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\ayx\Datafiles.py in getData(self, data, metadata) 498 if data is None: 499 # read in data as a list of numpy ndarrays --> 500 data = self.connection.read_nparrays() 501 # check if data is a list of numpy structs 502 elif isinstance(data, list) and all( RuntimeError: DataWrap2WrigleyDb::GoRecord: Attempt to seek past the end of the file