oxnan
oxnan

Reputation: 13

PyPI Module not working

So today i started working on a simple python module, but i cant make it work. the module itself works, but when i have uploaded it to PyPI and i then install it using Pip, it wont work. Please notice that it is built for python-2.7 The source code can be seen here:

https://github.com/1m0r74l17y/FortyTwo

and it can be downloaded using:

sudo pip install FortyTwo

whenever i try to run a test program like this:

from FortyTwo import *

FortyTwo.nope()

It just gives me an error:

Traceback (most recent call last):

File "test.py", line 3, in

FortyTwo.nope()

AttributeError: 'module' object has no attribute 'fortytwo'

I would really appreciate any help, as it might lead me onto what i have to do to fix the problem.

Upvotes: 1

Views: 220

Answers (2)

giosans
giosans

Reputation: 1178

What if you do

from FortyTwo import fortytwo
fortytwo.nope()

* credits to eandersson.

Upvotes: 1

eandersson
eandersson

Reputation: 26362

You would need to do the following.

from FortyTwo import fortytwo
fortytwo.nope()

If you want to call nope directly from FortyTwo you would need to import that function in __init__.py.

e.g.

from FortyTwo.fortytwo import nope

def Start():
    """No Clue what to add here"""

Upvotes: 1

Related Questions