Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
package import issues
#1
Hi all,

I am a little Stuck!
I have successfully imported the package COLORAMA onto my system.
I have a test program that I have been playing around with. When I run it in the terminal, it works fine, bet when I try to use it in my IDE's shell (Thonny) it shows seemingly gibberish!

Here is my test program from the COLORAMA website:
from colorama import Fore, Back, Style

print(Fore.RED + 'some red text')
print(Back.GREEN + 'and with a green background')
print(Style.DIM + 'and in dim text')
print(Style.RESET_ALL)
print('back to normal now')
I am pretty sure that COLORAMA is only meant to colour the terminal but on the website: COLORAMA Website I interpreted it as you could colour the console.

I apologise if this question has been a waste of time and I am just being a spoon but any help would be appreciated.

Kind Regards,

Groovydingo.
Reply
#2
you should check issues here: https://github.com/tartley/colorama/issues
if not already reported, report issue with author.
Reply
#3
Thankyou,

I think it may just be a PEBKAC (Problem, Exists, Between, Keyboard and Chair). I will keep looking, and for the time being will use the terminal to run the program. It is mainly a convenience thing.

Thanks again.
(I think I will report it...)
Reply
#4
(Oct-03-2018, 10:53 AM)groovydingo Wrote: Hi all,

I am a little Stuck!
I have successfully imported the package COLORAMA onto my system.
I have a test program that I have been playing around with. When I run it in the terminal, it works fine, bet when I try to use it in my IDE's shell (Thonny) it shows seemingly gibberish!
Fore.<color> is just a string that contains escape sequence supported by some terminals
Output:
In [5]: Fore.RED Out[5]: '\x1b[31m'
Obviously, Thonny terminal is not supported
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
Reply
#5
Yea done some digging and that seems like the reason thanks! I won't bother to report as it is not that important.

Thanks.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Unable to import sklearn after installing any package ilango 0 770 Oct-25-2021, 07:03 AM
Last Post: ilango
  Can't import package hubenhau 1 3,891 Jan-15-2021, 06:23 PM
Last Post: buran
  import scalalib package doesn't work manu_brighter 2 2,155 Apr-17-2020, 06:36 PM
Last Post: snippsat
  Importing module from a package results in import error goghvv 2 1,674 Mar-27-2020, 07:13 PM
Last Post: goghvv
  Import all items from all modules from package DD169 3 1,417 Jan-25-2020, 12:33 PM
Last Post: buran
  ValueError: Attempted relative import in non-package JoeB 1 9,860 Mar-08-2018, 11:01 AM
Last Post: Gribouillis
  I can't import own package of file from file. harun2525 4 3,063 Jun-07-2017, 06:03 PM
Last Post: nilamo
  PostgreSQL- import package elhetch 2 4,005 Jun-07-2017, 02:07 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020