Pyfancy-2 icon indicating copy to clipboard operation
Pyfancy-2 copied to clipboard

'module' object is not callable

Open ghost opened this issue 6 years ago • 6 comments

>>> import pyfancy
>>> pyfancy().red("Hello, world!").output()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callable

ghost avatar May 12 '19 03:05 ghost

Workaround:

from pyfancy import pyfancy
pyfancy.pyfancy().red("Hello, world!").output()

ghost avatar May 12 '19 03:05 ghost

Are you running with Python 2 or 3?

skistaddy avatar May 12 '19 06:05 skistaddy

~~This used to be documented somewhere in the README. (It said something along the lines of "use from pyfancy import *")~~

This is in fact documented in the README on the last line of the 'Usage' section.

I don't remember if this is due to a quirk in Python's namespacing that prevents us from allowing it to be used as import pyfancy, or if it's just because I don't know how Python works.

TheMonsterFromTheDeep avatar May 13 '19 06:05 TheMonsterFromTheDeep

@TheMonsterFromTheDeep that doesnt fix it:

>>> from pyfancy import *
>>> pyfancy().red('aaaaa bbbbb')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callable

it would need to be like this:

>>> from pyfancy.pyfancy import pyfancy
>>> pyfancy().red('aaaaa bbbbb')
<pyfancy.pyfancy.pyfancy object at 0x6ffffd43d30>

ghost avatar May 13 '19 11:05 ghost

@cup Sadly the last time I worked on this project was years ago, so I can't say for sure what changed in the meantime.

I'll change the documentation to say from pyfancy.pyfancy import pyfancy so that at least it's usable...

TheMonsterFromTheDeep avatar May 13 '19 15:05 TheMonsterFromTheDeep

@TheMonsterFromTheDeep you rock - thanks!

ghost avatar May 13 '19 15:05 ghost