Python Forum
Script works when executed from command prompt but not when executed in SDP
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script works when executed from command prompt but not when executed in SDP
#1
I have a python script with the line

latin1_2 = unicode_esc.encode('cp1252')

and when I execute the script in a Windows Command prompt it executes just fine. But when python and the script is executed from A custom trigger in ServiceDesk Plus (https://www.manageengine.com/se/service-desk/) a web application (using tomcat) that allows you to run console commands in the background. the script generates this error

Could not convert data to an integer. traceback: Traceback (most recent call last): File "SDPToSDPRequestCreate\SDPToSDPRequestCreate.py", line 34, in <module> data = json.loads(string_escapeV2(jsonString)) File "C:\ManageEngine\ServiceDesk9335\integration\custom_scripts\SDPToSDPRequestCreate\myFunctions.py", line 119, in string_escapeV2 latin1_2 = unicode_esc.encode('cp1252') # 1:1 mapping back to bytes File "C:\Users\David\AppData\Local\Programs\Python\Python37\lib\encodings\cp1252.py", line 12, in encode return codecs.charmap_encode(input,errors,encoding_table) UnicodeEncodeError: 'charmap' codec can't encode character '\x96' in position 56: character maps to <undefined>

I don't understand what could be causing cp1252.py to behave differently. Does anyone know what could be causing this?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is possible to run the python command to call python script on linux? cuten222 6 719 Jan-30-2024, 09:05 PM
Last Post: DeaD_EyE
  How to not open the context menu if a mouse gesture is executed? MicheliBarcello 2 661 Aug-22-2023, 02:47 PM
Last Post: deanhystad
  return next item each time a function is executed User3000 19 2,276 Aug-06-2023, 02:29 PM
Last Post: deanhystad
  code not working when executed from flask app ThomasDC 1 876 Jul-18-2023, 07:16 AM
Last Post: ThomasDC
  What is the difference between Command Prompt and Sublimes yaoyao22 1 634 Jul-09-2023, 02:56 PM
Last Post: snippsat
  package script cant find sibling script when executed from outside Bock 3 870 Mar-03-2023, 04:26 PM
Last Post: snippsat
  Facing Problem while opening a file through command prompt vlearner 4 1,901 Jan-30-2022, 08:10 AM
Last Post: snippsat
  script with imports works but pytest gives "ModuleNotFoundError"? Hpao 0 1,560 Jun-27-2021, 08:30 PM
Last Post: Hpao
  Automatic user/password entry on prompt by bash script PBOX_XS4_2001 3 2,764 May-18-2021, 06:42 PM
Last Post: Skaperen
  Run CMD Command In Python Script shantanu97 2 6,505 May-13-2021, 08:08 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020