Are you getting the same error using the pymel that ships with 2014?—
Sent from Mailbox for iPhone

On Thu, Jan 9, 2014 at 2:55 PM, Jesse Kretschmer <[email protected]> wrote:

> I've tested this in windows with Maya 2014 (2.7.3), and I am getting the
> error regardless of slashes.
> I just did a basic monkey patch, and it seems to work. If you create a
> userSetup.py in your PYTHONPATH, you should be able to overwrite the isdir
> function.
> Here's what I tested (http://pastebin.com/RU7eTk14). I don't know how
> robust the isdir function has to be:
> import sys
> import os
> import stat
> import os.path
> def my_isdir(path=None):
>     if path and hasattr('root',path):
>         path = path.root
>     return stat.S_ISDIR(os.stat(path).st_mode)
> os.path.isdir = my_isdir
> class foo(str):
>     isdir = os.path.isdir
> print foo('C:/temp').isdir()
> print sys.version
> result:
> True
> 2.7.3 (default, Aug  1 2012, 16:33:56) [MSC v.1600 64 bit (AMD64)]
> On Thu, Jan 9, 2014 at 2:42 PM, dgovil <[email protected]> wrote:
>> In Linux, it's working in Python 2.7.3 and 2.6.4 for me, but I can't say
>> I'm a fan of that style of implied argument passing.
>> The only issue I can think of is that I had weird bugs sometimes with
>> using backslashes on Windows. Python supports forwards slashes on windows,
>> so maybe try that?
>>
>> Otherwise I would just make an isdir wrapper instead of passing it through
>> like that. That should work.
>>
>>
>> On Thursday, 9 January 2014 14:26:04 UTC-8, Jesse Capper wrote:
>>>
>>> That works fine. My issue is when using the path module, which pymel also
>>> uses. We have code that utilizes the path module inside and outside of
>>> pymel. It's easy to patch fix the issue outside of pymel but since pymel
>>> includes its own path.py, and that lives locally on every user's machine,
>>> replacing that is a bit more cumbersome.
>>>
>>> A simplified version of the issue:
>>>
>>>
>>> import os.path
>>>
>>> path = 'c:\\temp'
>>> class foo(unicode):
>>>     isdir = os.path.isdir
>>>
>>> foo(path).isdir()
>>> # 2.6.4 # True
>>> # 2.7.3 # TypeError: _isdir() takes exactly 1 argument (0 given) #
>>>
>>> print os.path.isdir(path)
>>> # 2.6.4 # True
>>> # 2.7.3 # True
>>>
>>>
>>> On Thursday, January 9, 2014 2:01:17 PM UTC-8, Kurian wrote:
>>>>
>>>> path = 'path/to/file'
>>>>
>>>> if os.path.isdir(path):
>>>>      print "Yes it is ! "
>>>>
>>>> This didnt work for you ?
>>>>
>>>>
>>>> On Thu, Jan 9, 2014 at 1:47 PM, Jesse Capper <[email protected]>wrote:
>>>>
>>>>> Loading the same path.py module into a 2.6.4 and 2.7.3 session produces
>>>>> different results when calling Path(path/to/file).isdir()
>>>>>
>>>>> 2.6.4 works as expected - outputs True or False
>>>>> 2.7.3 raises a TypeError: *TypeError: _isdir() takes exactly 1
>>>>> argument (0 given)*
>>>>>
>>>>> Anyone know why the behavior changed?
>>>>>
>>>>> This is an easy manual fix except that we also use pymel which ships
>>>>> with its own path.py module that pymel calls return. Replacing that on 
>>>>> each
>>>>> user's machine is more involved and I was hoping for an easier solution.
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Python Programming for Autodesk Maya" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> To view this discussion on the web visit https://groups.google.com/d/
>>>>> msgid/python_inside_maya/7fe466f0-9628-4b31-8ed8-
>>>>> 0e872a94974d%40googlegroups.com.
>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> --:: Kurian ::--
>>>>
>>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>>  To view this discussion on the web visit
>> https://groups.google.com/d/msgid/python_inside_maya/485a5536-5a89-47fb-8d6e-729300f258ae%40googlegroups.com
>> .
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/python_inside_maya/CANESWi3Le6GZ2QXzgyaHRoyPNRFYq%3DN-0ZH9JruUTmVdx3TxPw%40mail.gmail.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/1389308451714.3ce34a83%40Nodemailer.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to