0

I have a sent.py file, and in this file I have a function getProcessing(), when I call this function I want to call a function (createmrjob) from another python file (processing.py).

Im trying to do this with code below and it is working fine, but after I call this function getProcessing() when user choose option 2, it is created a processing.pyc file. It is normal? There is a way that this file its not created?

def getProcessing():
    from processing import createmrjob

def nav():
    print ""
    while True:
        response_options = {'1': Choice(msg="User Managment", callback=userManagment), '2': Choice(msg="processing", callback=getProcessing)}
        result = make_choice(response_options)
        if result is None:
            print "Selected option not available."
        else:
            result.callback()
techman
  • 423
  • 1
  • 7
  • 17
  • Yes it is normal, a `.pyc` file is automatically generated when you import a Python script into another script. – ZdaR Jun 01 '15 at 19:56
  • possible duplicate of [If Python is interpreted, what are .pyc files?](http://stackoverflow.com/questions/2998215/if-python-is-interpreted-what-are-pyc-files) – Adam Smith Jun 01 '15 at 19:57
  • Or possibly a duplicate of [How to avoid .pyc files?](http://stackoverflow.com/questions/154443/how-to-avoid-pyc-files) – Adam Smith Jun 01 '15 at 19:58

3 Answers3

1

Yes, it is normal. The *.pyc file contains compiled version of your module.

dlask
  • 8,776
  • 1
  • 26
  • 30
1

That is normal. Python tries to optimize by generating a .pyc version of the .py, which is pre-compiled.

You can avoid this by environment variables, command-line parameters, or from inside the program. See this post

.

Community
  • 1
  • 1
jcoppens
  • 5,306
  • 6
  • 27
  • 47
1

It is normal. It is byte code file, which is generated by the Python interpreter and is executed by Python's virtual machine.

stardust
  • 83
  • 5