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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:26:18+00:00 2026-06-15T14:26:18+00:00

is it possible with python to read a maya scene file without opening and

  • 0

is it possible with python to read a maya scene file without opening and get list of camera’s or render globals setting or perform some operations on it.
I need this so that if their are multiple scene files I do not have to open each maya scene and just tweak it from a python script, I would really appreciate if some one can show how to start rest I will do myself…

  • 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-15T14:26:19+00:00Added an answer on June 15, 2026 at 2:26 pm

    Its possible, may just not be practical. A Maya ASCII file is pretty trivial to parse. A Maya binary file not so much. It may be a bit premature to discuss there matters.

    First things first. Maya does offer a batch mode, the batch mode does not use up a full license. It still opens a full Maya environment but no GUI. This is the perfect platform to inject scripts. It doesn’t really fulfill your request of not opening Maya but it fulfills all other requirements. There are a few ways for using this batch mode. But mostly it boils down to two general methods.

    Method 1, using mayabatch: The mayaXX/bin/ directory contains a command called mayabatch. You can simply call this from a cmd/shell batch file/shellscript. This is a extremely simple way of calling existing scripts. Assuming mayabatch is in the path of your environment and your script is in Maya script path. Lets assume for simplicity that your script looks as follows (demo.py):

    import maya.cmds as cmd
    
    def func():
        print cmd.ls()
    
    # we want this to execute on import
    func()
    

    Now calling this for one file under windows would look as following:

    mayabatch -command "python(""import demo"") " -file filename.ma
    

    calling this over all Maya in the current folder files would then be simply:

    for %i in (*.ma) do mayabatch -command "python(""import demo"") " -file %i
    

    The quoting rules are a bit different on mac and Linux but should be easy to find. reefer to the manual of your shell.

    Method 2, using mayapy and standalone:

    Now you can also directly call the python script with mayapy. Its located in the same directory as mayabtach. Tough the standalone can be called form other python interpreters too if you include Maya modules in the system path. Now the script must be a bit changed so it does the same thing (demo_direct.py):

    #init maya
    import maya.standalone
    maya.standalone.initialize( name='python' )
    import maya.cmds as cmd
    import glob
    
    def func():
        print cmd.ls(shapes=True)
    
    for file in glob.glob('*.m[ab]'):
        cmd.file( file, o=True )
        func()
    

    call this form command line with:

    mayapy demo_driect.py
    

    Neither of these methods load Mayas graphical user interface. So you can not call stuff like playblast etc. Since they rely on a GUI, and thus a full Maya license. Nothing says you can not do a similar load loop in the GUI as above.

    Then for the methods without actually loading Maya. This is a bit tricky. Doing this is not necessarily worth it since the batch nodes are pretty fast as they don’t eventuate everything on load. A sample script that parses a Maya ASCII file for frame ranges. You might find it useful. See following post. For Maya binary files there is a python module in cgKit that will help you read Maya binary chunks. Unfortunately it doesn’t do anything for understanding the data.

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

Sidebar

Related Questions

Using Python's csv module, is it possible to read an entire, large, csv file
Is it possible to read settings in Python from my app.yaml configuration file?
Possible Duplicate: Python: How to read huge text file into memory To process a
Possible Duplicate: reading integers from binary file in python I've read the solution to
Is it possible to read a line from a gzip-compressed text file using Python
Possible Duplicate: Python : how to append new elements in a list of list?
Possible Duplicate: Python: What is the best way to check if a list is
Possible Duplicate: Python: Get object by id Typically when you see the string representation
Possible Duplicate: Python, compute list difference I have two lists For example: A =
Is it possible to create read only files in python which can not be

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.