<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Stuart Millington</title>
    <description>The latest articles on DEV Community by Stuart Millington (@stuart_millington_01066b5).</description>
    <link>https://dev.to/stuart_millington_01066b5</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2301960%2F8707ee78-397e-4048-9608-7612534a29a5.png</url>
      <title>DEV Community: Stuart Millington</title>
      <link>https://dev.to/stuart_millington_01066b5</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/stuart_millington_01066b5"/>
    <language>en</language>
    <item>
      <title>Can't run python script from terminal but can from PyCharm: ModuleNotFoundError</title>
      <dc:creator>Stuart Millington</dc:creator>
      <pubDate>Tue, 29 Oct 2024 15:55:14 +0000</pubDate>
      <link>https://dev.to/stuart_millington_01066b5/cant-run-python-script-from-terminal-but-can-from-pycharm-modulenotfounderror-gjj</link>
      <guid>https://dev.to/stuart_millington_01066b5/cant-run-python-script-from-terminal-but-can-from-pycharm-modulenotfounderror-gjj</guid>
      <description>&lt;p&gt;I have never run python from a terminal before so I don't know what is involved, I have always run my project from PyCharm. My project runs fine from PyCharm. I am running on Linux. My file structure is as follows:&lt;/p&gt;

&lt;p&gt;BackTesting        - This is my project&lt;br&gt;
    BackTestPkg    - One of my packages&lt;br&gt;
        &lt;strong&gt;init&lt;/strong&gt;py&lt;br&gt;
        Parameters.py&lt;br&gt;
        ...&lt;br&gt;
    MAX1           - My main development&lt;br&gt;
        MAX1_Controller.py&lt;br&gt;
        MAX1_Main.py&lt;br&gt;
        ...&lt;br&gt;
    TradingPkg     - My other package&lt;br&gt;
        &lt;strong&gt;init&lt;/strong&gt;.py&lt;br&gt;
        PlatformLib.py&lt;br&gt;
        ...&lt;br&gt;
MAX1_Controller.py calls MAX1_Main.py, and both call modules in both BackTestPkg and TradingPkg packages, which in turn call other modules in these 2 packages.&lt;/p&gt;

&lt;p&gt;When I perform the following at the linux terminal:&lt;/p&gt;

&lt;p&gt;/data/stuart/Projects/Python/Env/bin/python /data/stuart/Projects/Python/BackTesting/MAX1/MAX1_Controller.py 'EpicConfigs.csv' 'MAX1.param'&lt;br&gt;
I get the following terminal error:&lt;/p&gt;

&lt;p&gt;Traceback (most recent call last):&lt;br&gt;
  File "/data/stuart/Projects/Python/BackTesting/MAX1/MAX1_Controller.py", line 10, in &lt;br&gt;
    import MAX1_Main as main&lt;br&gt;
  File "/data/stuart/Projects/Python/BackTesting/MAX1/MAX1_Main.py", line 8, in &lt;br&gt;
    import TradingPkg.PlatformLib as pl&lt;br&gt;
ModuleNotFoundError: No module named 'TradingPkg'&lt;/p&gt;

&lt;p&gt;I have created a requirements.txt with the following contents, but to no avail.:&lt;br&gt;
attrs~=24.2.0&lt;br&gt;
colorlog~=6.8.2&lt;br&gt;
matplotlib~=3.9.2&lt;br&gt;
mplfinance~=0.12.10b0&lt;br&gt;
munch~=4.0.0&lt;br&gt;
numpy~=2.1.1&lt;br&gt;
pandas~=2.2.2&lt;br&gt;
pillow~=10.4.0&lt;br&gt;
python-dateutil~=2.9.0.post0&lt;br&gt;
pytz~=2024.1&lt;br&gt;
requests~=2.32.3&lt;br&gt;
six~=1.16.0&lt;br&gt;
tenacity~=9.0.0&lt;br&gt;
termcolor~=2.4.0&lt;br&gt;
pip~=24.2&lt;br&gt;
BackTestPkg&lt;br&gt;
TradingPkg&lt;/p&gt;

&lt;p&gt;I have never worked with python outside PyCharm so I don't know what I can try. Other posts I looked at looked complicated and overkill for what I am sure is a simple solution. Can anybody point me in the right direction please.&lt;/p&gt;

&lt;p&gt;Regards, StuartM&lt;/p&gt;

</description>
      <category>python</category>
      <category>terminal</category>
    </item>
  </channel>
</rss>
