Problems using Colorama on Python 2.7 -


i'm learning use colorama in python, installed , i'm able import module no problems primary prompt.

>>> import colorama >>> colorama import * >>> print(fore.blue + 'blue text')  blue text 

now, if create small piece of code this:

#!/usr/bin/env python2.7  colorama import *  print(fore.blue + 'blue text') 

i following message:

file "colorama_test.py", line 3, in <module>   colorama import * file "/home/olg32/python/colorama_test.py", line 5, in <module>    print(fore.blue + 'blue text') nameerror: name 'fore' not defined   

which tells me module not being found. mentioned installed , tested primary prompt. path definition issue or that? current directory module installed:

usr/local/lib/python2.7/dist-packages/colorama-0.3.7-py2.7.egg 

does path needs defined somewhere? sorry i'm new on python.

any appreciated.

thank you.

hopefully have worked out answer have tried specifying fore?

when use colorama module start this:

import os, colorama colorama import fore,style,back #specifying 3 types os.system("mode con: cols=120 lines=30") #sometimes colorama doesnt work  #when double clicking python app use "prompt" command line  #and works fine colorama.init() should work 

example code:

import os, colorama colorama import fore,style,back os.system("mode con: cols=120 lines=30")  print(fore.red + 'some red text') print(back.green + 'and green background') print(style.dim + 'and in dim text') print(style.reset_all) print('back normal now') 

if doesnt work let me know :)


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -