Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9055467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:57:38+00:00 2026-06-16T13:57:38+00:00

i am getting the following compilation error in the below code ,place where the

  • 0

i am getting the following compilation error in the below code ,place where the error is happening is the code where the variable names are being decoded?how to decode the variable names in HTML code?

 File "test.py", line 33
    """)(% hostname,change,pwd,changeref,changeref)
         ^
SyntaxError: invalid syntax

Following is the Code:-

from email.mime.text import MIMEText
from subprocess import Popen, PIPE
import socket
import os

def email (body,subject):
    msg = MIMEText("%s" % body)
    msg["Content-Type"] = "text/html"
    msg["From"] = "test@company.com"
    msg["To"] = "test@company.com"
    msg["Subject"] = '%s' % subject
    p = Popen(["/usr/sbin/sendmail", "-t"], stdin=PIPE)
    p.communicate(msg.as_string())
def main ():
    change="2009"
    pwd=os.getcwd()
    changeref="refs/changes/59/206059/2"
    subject=change + "Test subject"
    hostname=socket.gethostname()
    body = ("""\
        <html>
         <head></head>
         <body>
          <p>%s<br>
            change - https://company/#/c/%s \n.<br>
            change Directory - %s for details \n.<br>
            Instructions: cd to the change Directory on hostname and execute the following commands \n.<br>
            git checkout %s<br>
            git fetch ssh://username@company:29418/platform/vendor/company-proprietary/code %s && git cherry-pick FETCH_HEAD".
         </p>
         </body>
        </html>
""")(% hostname,change,pwd,changeref,changeref)
    email(body,subject)

if __name__ == '__main__':
    main()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:57:39+00:00Added an answer on June 16, 2026 at 1:57 pm

    What you want is

    """
    your HTML stuff here
    """ % (hostname, change, pwd, changeref, changeref)
    

    Note that the % sign goes outside the tuple.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting a compilation error on following code: public abstract class DbHandler<T> { public
I am getting following STL compilation error in the following code. #include <cstdio> #include
I'm getting this compilation error with the following code: error C2143: syntax error :
Strangely I am getting compilation error in C++ for the following code. class A
I am getting a compilation error for the following statement: void read_text(int & c1,
Following on from my previous question, I am getting another compilation error on my
I am getting the following compilation errors:** 4>c1xx : fatal error C1083: Cannot open
I'm getting the following error with memcpy. It doesn't give compilation error but doesn't
I am getting the following error message. Any ideas how to resolve this? Compilation
I am getting the following error while migrating VC6 code to VS2008. This code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.