Mel2py - Need Some Help Here

hey folks

i installed the pymel module and everything works fine.It is aboslutely wonderfull.

I just have one question :

I do

import pymel.mel2py as melpy

then i do

melpy (spinFaces.mel)

and it shows erros ... I read the docs but can't find what am i doing wrong here.

I also tried

melpy("spinFaces.mel")
melpy(spinFaces)

heeeeeelp

thanks

mel2py is the name of the sub-module and also the name of one of the functions within that module. sorry for the confusion.

import pymel.mel2py
pymel.mel2py.mel2py( 'myscript.mel' )

or

from pymel.mel2py import *
mel2py( 'myscript.mel' )

or

import pymel.mel2py as mel2py
mel2py.mel2py( 'myscript.mel' )

pymel.mel2py.mel2py( 'spinFaces.mel' )

and i get error

pymel.mel2py.mel2py( 'spinFaces.mel' )
# Error: (2, 'No such file or directory', path(u'Documents/maya/2008/scripts/spinFaces.mel'))
# Traceback (most recent call last):
# File "", line 1, in
# File "C:\Program Files\Autodesk\Maya2008\Python\lib\site-packages\pymel\mel2py.py", line 255, in mel2py
# data = melfile.bytes()
# File "C:\Program Files\Autodesk\Maya2008\Python\lib\site-packages\pymel\path.py", line 525, in bytes
# f = self.open('rb')
# File "C:\Program Files\Autodesk\Maya2008\Python\lib\site-packages\pymel\path.py", line 521, in open
# return file(self, mode)
# IOError: (2, 'No such file or directory', path(u'Documents/maya/2008/scripts/spinFaces.mel')) #

What am i doing wrong?

it's probably a windows specific pathing issue.

what do you get when you execute this in mel:

whatIs spinFaces.mel

when i get back home to my windows machine i'll check this out more thoroughly, but if you give me the results of that command, i might be able to track it down before then.

-chad

whatIs spinFaces.mel;
// Script found in: C:/Documents and Settings/pythonBoy/My Documents/maya/2008/scripts/spinFaces.mel //

ah, silly mistake on my part. the whitespace in the path to 'My Documents' is tripping it up. i get so used to working in a production environment where you're not allowed to name files with spaces.

if you change this line in mel2py.py:

melfile = path.path( pymel.mel.whatIs( melfile ).split()[-1] )

to read:

melfile = path.path( pymel.mel.whatIs( melfile ).split(': ')[-1] )

i think it should fix it. let's hope. i don't have much experience working with windows paths.

thanks for helping me find these bugs. i hope you can do the same with the rest of pymel.

-chad

Ok this is way too complicated ...

you gota make it simpler for all the lazies out there like me

cheers

haha pythonBoy, i will make it simpler, but people like yourself have to use it first before i can know where the bugs are. c'mon, you're pythonBoy, you need to live up to your namesake.

it's up to you. you can wait for me to release a new version or you can make this tiny change.

-chad

For the record, this advice is outdated. As of 0.9.0, mel2py.py has been replaced by mel2py\__init__.py and the change has been made.

QUOTE(Chadrik @ 01/10/08, 08:39 AM) [snapback]279498[/snapback]
haha pythonBoy, i will make it simpler, but people like yourself have to use it first before i can know where the bugs are. c'mon, you're pythonBoy, you need to live up to your namesake.

it's up to you. you can wait for me to release a new version or you can make this tiny change.

-chad