Error with reading text file

Hi, I have the following error pop up when I go to run my scripts in Unity and I am looking for some help solving it. Not really sure why it is giving me this error as it says the code is fine before I run anything.

  • ArgumentException: get_dataPath can only be called from the main thread.
    Constructors and field initializers will be executed from the loading thread when loading a scene.
    Don’t use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
    Deck.Load (System.String file) (at Assets/Deck.cs:26)
    Deck…ctor () (at Assets/Deck.cs:17)

    public class Deck : MonoBehaviour {

     	public List<CardAttributes> deck = new List<CardAttributes>();
     	public List<CardAttributes> readFile = new List<CardAttributes>();
     	public string filename;
     
     	public Deck()
     	{
     		//This will be changed to take value from player + enemy current deck.
     		filename = "celtic.txt";
     		Load(filename);
     		AddToDeck(readFile);
     	}
     
     
     	public void Load(string file)
     	{
     		readFile.Clear(); //Clears the list that will store what is read in from the file.
     		//Creates StreamReader pointing to where application data is store + '/' or '\' + filename
     		StreamReader sw = new StreamReader(Application.dataPath + System.IO.Path.DirectorySeparatorChar + file);
     
     		while(!sw.EndOfStream)
     		{
     			string line = sw.ReadLine();
     			int i;
     			if(line != null)
     			{
     				i = Int32.Parse(line);
     				readFile.Add(new CardAttributes{cardType=i});
     			}
     		}
     
     	}
     
     	public void AddToDeck(List<CardAttributes> myDeck)
     	{
     		deck.Clear();
     		foreach(CardAttributes card in myDeck)
     		{
     			switch(card.cardType)
     			{
     				case CardAttributes.CARD1:
     					BattleChariot derivedCard = (BattleChariot) card;
     					deck.Add(derivedCard);
     					break;
     				case CardAttributes.CARD2:
     					Bondi derivedCard2 = (Bondi) card;
     					deck.Add(derivedCard2);
     					break;
     			}
     		}
     	}
     
     	public void Shuffle() 
     	{
     		// using Knuth Shuffle
     		List<CardAttributes> temp = new List<CardAttributes>();
     		System.Random random = new System.Random();
     		int j;
     		
     		for (int i = 0; i < deck.Count; i++){
     			j = random.Next(deck.Count);
     			temp _= deck*;*_
    

_ deck = deck[j];
deck[j] = temp*;
}
}*_

* public CardAttributes Deal()*
* {*
* CardAttributes returnCard = deck[0];*
* deck.RemoveAt(0);*
* return returnCard;*
* }*
}

As the error says, don’t write constructors, instead write an Awake function inside a MonoBehaviour.