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 8578233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:20:25+00:00 2026-06-11T20:20:25+00:00

Say I am in the python interpreter and define a function as follows: def

  • 0

Say I am in the python interpreter and define a function as follows:

def h(a):
  return a

If I want to look at the bytecode (not a disassembly using dis), I can typically use h.func_code.co_code. Is there any other way to look at the bytecode?

For example, in the interpreter, if I just type h without making it a function call, I get the address of the function. Can I use that address to get the bytecode? Is there some other way?

Some additional info from the comments:

The app is written in python and packed using something like Py2App, cx_freeze, or py2exe. I played some tricks on the executable and now, when launched, the executable dumps me to a python command line. From there, I manually typed my function h into the interepeter.

Other attributes of h.func_code are present such as co_varnames, co_argcount, etc, but co_code is not.

If I type in h.func_code.co_code into the interpreter, I get 'code' object has no attribute 'co_code'.

UPDATE: From the comments again. As far as I can tell the opcodes have been remapped for the python interpreter that was shipped with the app.

  • 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-11T20:20:26+00:00Added an answer on June 11, 2026 at 8:20 pm

    If you have defined your own def h(): pass dummy function, and that function does not have a .func_code.co_code value, then most likely the included python interpreter is a custom compiled version where the co_code slot has been cleared.

    The work-around is simple, copy the Contents/Resources zipfiles (in all subdirs) elsewhere, add those to your PYTHONPATH and import the code into your own interpreter.

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

Sidebar

Related Questions

Let's say I need to use Python and C++. I can call Python function
Let's say there are two python scripts that want to write data to the
The python docs say: Return the length (the number of items) of an object.
What is the highest number Python 2.6's x86 id() function can return? I presume
So, here's my situation. I'm using PyDev in Eclipse, Python interpreter version 2.7.2 in
I want to create a user group using python on CentOS system. When I
Let's say I've already imported a python module in the interpreter. How can I
For a personal research/fun project I am using the Python urllib2() function. However, when
Various Python guides say to use x is None instead of x == None
I have a simple python script (say, simple.py) , like a = 5 b

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.