I probably should use the correct terminology - package, not module, a
module being just a python file with statements in it, and a package
being a way of structuring them in a file hierarchy to give you
namespaces of a sort (Justin, feel free to correct me since I'm being
very handwavey here). In short, it lets you use a dot notation to import
packages that are split up down a filesystem tree, amongst other things.

https://docs.python.org/2/tutorial/modules.html#packages


By way of example, on my filesystem here, i've just created the
following tree:

d:\devzone\scratchpad\working\foo
d:\devzone\scratchpad\working\foo\bar.py
d:\devzone\scratchpad\working.\foo\__init__.py
d:\devzone\scratchpad\working\foo\bacon
d:\devzone\scratchpad\working\foo\bacon\__init__.py
d:\devzone\scratchpad\working\food\bacon\sandwich.py

and then the following should work:

import sys sys.path.append(r'd:\devzone\scratchpad\working')
# append the root of my package structure

import foo import foo.bar import foo.bacon import foo.bacon.sandwich

For your problem, assuming that the root path of NSUV is visible Johan
Bogström earlier suggested checking that you've an __init__.py and
it's not missing - this is just the same check in a fashion, but even
more brutal.

Also, as a side check - is everything cased correctly? I recall tearing
my hair out once until i noticed i had two copies of a file, one with an
uppercase first letter..


On Mon, Apr 20, 2015, at 08:28 AM, Crest Christopher wrote:
> Sorry, how do I create a generic python module, newbie to this, yet to
> being my python quest :)
>
> Anthony Tan wrote:
>>
>> I suspect this is rehashing something stupidly obvious, but are you
>> able to just create your own generic python module (e.g. a dir within
>> your scripts area with an __init__.py placeholder) and import it?
>> I.e. is it a problem importing NSUV, or does the issue extend to
>> something generic? On Mon, Apr 20, 2015, at 06:45 AM, Crest
>> Christopher wrote:
>>>
>>> When I remove the Maya.env file, surprisingly a new Maya.env is
>>> created, now that is not the surprise, the surprise is, it loads a
>>> five month old Maya.env file, not a blank environment file, when I
>>> run the same command as mentioned; import NSUV reload(NSUV) I
>>> continue to get this error; # Error: line 1: Impo
rtError: file
>>> <maya console> line 1: No module named NSUV #. Justin Israel wrote:
>>>>
>>>>
Not sure how to solve your problem at this point then. Seems you have
>>>>
a ghost in the machine.
>>>>
Did you try removing the custom Maya env and trying a standard install
>>>>
to a scripts location?
>>>>
On Mon, 20 Apr 2015 1:46 AM Christopher. <[email protected]
>>>>
<mailto:[email protected]>> wrote:
>>>>
I can confirm I see the location where NSUV exists usin g the
>>>>
command you posted.
>>>>
On Sunday, April 19, 2015 at 12:41:30 AM UTC-4, Justin Israel wrote:
>>>>
That is where I think your problem is. If you have made a
>>>>
custom script location, and set that as your maya script path,
>>>>
and placed a python package in there, then it won't work. Maya
>>>>
by default has the default script locations also on the
>>>>
PYTHONPATH. But in your custom Maya script location, I doubt
>>>>
it too is on the PYTHONPATH. Can you do the following from the
>>>>
Script Editor
>>>>
import sys
>>>>
for p in sys.path :
>>>>
print p
>>>>
And confirm that you see the location where your NSUV python
>>>>
package exists?
>>>>
On Sun, 19 Apr 2015 11:08 AM Christopher.
>>>>
<[email protected]> wrote:
>>>>
MAYA_SCRIPT_PATH = C:\[folder name]\[sub-folder-name]\scripts
>>>>
PYTHONPATH = C:\""\""\pythonscripts\
>>>>
That is exactly how I have it laid out in my Maya.env
>>>>
file. All script get placed in the scripts folder, all
>>>>
&n bsp; python scripts, get placed in the python folder. In this
>>>>
case NSUV gets placed in the scripts folder, I have tested
>>>>
it in the python scripts folder as well with no positive
>>>>
results.
>>>>
On Saturday, April 18, 2015 at 4:20:17 PM UTC-4, Justin
>>>>
Israel wrote:
>>>>
I just grabbed a copy of that Nightshade plugin and
>>>>
tried it. Worked right away. Are you sure you followed
>>>>
&n bsp; the instructions? I just copied over the contents of
>>>>
the bundled "scripts" dir ectory to my Maya's scripts
>>>>
location. I happened to put it in the shared scripts
>>>>
location, on my mac:
>>>>
|$ ls -1 /Users/justin/Library/Preferences/Autodesk/maya/scripts
>>>>
NSUV
>>>>
calcUVStats.py
>>>>
&nb sp; texturePanel_NSUV.mel
>>>>
texturePanel_NSUV_2015.mel
>>>>
textureWindowCreateToolBar_NSUV.mel
>>>>
textureWindowCreateToolBar_NSUV_2014.mel
>>>>
textureWindowCreateToolBar_NSUV_2015.mel
>>>>
|
>>>>
The NSUV package gets picked up because the shared
>>>>
; scripts location is on the default Maya pythonpath
>>>>
Maybe post what your installation location looks like?
>>>>
I haven't tried to customize my Maya.env to point
>>>>
specifically to this or anything. More information
>>>>
would be helpful.
>>>>
On Sun, Apr 19, 2015 at 7:41 AM johan Borgström
>>>>
<[email protected]> wrote:
>>>>
&n bsp; Maybe a missing __init__.py ?
>>>>
--
>>>>
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 ema il to
>>>>
[email protected].
>>>>
To view this discussion on the web visit
>>>>
https://groups.google.com/d/msgid/python_inside_maya/b51db530-6074-437e-93e0-07675264f128%40googlegroups.com.
>>>>
For more options, visit
>>>>
https://groups.google.com/d/optout.
>>>>
--
>>>>
&nb sp; 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/667c64a9-f646-40be-b276-45606081541f%40googlegroups.com
>>>>
;
>>>>
<https://groups.google.com/d/msgid/python_inside_maya/667c64a9-f646-40be-b276-45606081541f%40googlegroups.com?utm_medium=email&utm_source=footer&;
gt;.
>>>>
For more options, visit https://groups.google.com/d/optout.
>>>>
--
>>>>
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]
>>>>
<mailto:[email protected]>.
>>>>
To view this discussion on the web visit
>>>>
https://groups.google.com/d/msgid/python_inside_maya/5ab9d017-7194-47c1-a71b-59d82d2aa4ee%40googlegroups.com
>>>>
<https://groups.
>>>>
google.com/d/msgid/python_inside_maya/5ab9d017-7194-47c1-a71b-59d82d2aa4ee%40googlegroups.com?utm_medium=email&utm_source=footer>.
>>>>
For more options, visit https://groups.google.com/d/optout.
>>>>
--
>>>>
You received this message because you are subscribed to a topic in the
>>>>
Google Groups "Python Programming for Autodesk Maya" group.
>>>>
To unsubscribe from this topic, visit
BR>
https://groups.google.com/d/topic/python_inside_maya/bkJcnVhSI0Y/unsubscribe.
>>>>
To unsubscribe from this group and all its topics, send an email to
>>>>
[email protected]
>>>>
<mailto:[email protected]>.
>>>>
To view this discussion on the web visit
>>>>
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0c7p%2BkD74WOSK-Cs9bjLAZTs9AbXE8hjZcSF39zRojVw%40mail.gmail.com
>>>>
>>>>
<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0c7p%2BkD74WOSK-Cs9bjLAZTs9AbXE8hjZcSF39zRojVw%40mail.
>>>>
gmail.com?utm_medium=email&utm_source=footer>.
>>>>
For more options, visit https://groups.google.com/d/optout.
>>>>
>>>>
>>>>
--
>>>>
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]
>>>>

<mailto:[email protected]>.
>>>>
To view this discussion on the web visit
>>>>
https://groups.google.com/d/msgid/python_inside_maya/553413FF.8060007%40gmail.com
>>>>
<https://groups.google.com/d/msgid/python_inside_maya/553413FF.8060007%40gmail.com?utm_medium=email&utm_source=footer>.
>>>>
For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> You received this message because you are subscribed to a topic in
>> the Google Groups "Python Programming for Autodesk Maya" group. To
>> unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/python_inside_maya/bkJcnVhSI0Y/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected]
>> <mailto:[email protected]>. To view
>> this discussion on the web visit https://groups.google.com/d/msgid/py
thon_inside_maya/1429481208.829772.255806813.3970AD8C%40webmail.messagingengine.com
>> <https://groups.google.com/d/msgid/python_inside_maya/1429481208.829772.255806813.3970AD8C%40webmail.messagingengine.com?utm_medium=email&utm_source=footer>.
>> For more options, visit https://groups.google.com/d/optout.
>>


>> --
>> 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/55342C18.6010406%40gmail.com[1].
>> For more options, visit https://groups.google.com/d/optout.



Links:

  1. 
https://groups.google.com/d/msgid/python_inside_maya/55342C18.6010406%40gmail.com?utm_medium=email&utm_source=footer

-- 
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/1429509799.1482371.255913857.4B46B936%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to