<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Python script runs fine from within project, but not from command line</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/e799565c25/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/e799565c25/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/e799565c25/</id><updated>2021-06-07T23:18:59.076000Z</updated><subtitle>Recent posts to Python script runs fine from within project, but not from command line</subtitle><entry><title>Python script runs fine from within project, but not from command line</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/e799565c25/?limit=25#7ea5" rel="alternate"/><published>2021-06-07T23:18:59.076000Z</published><updated>2021-06-07T23:18:59.076000Z</updated><author><name>andyfox</name><uri>https://forge.codesys.com/u/andyfox/</uri></author><id>https://forge.codesys.com2576800aba64b343ae81c543e7930fa548cec3ae</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I copied the code from &lt;a href="https://help.codesys.com/webapp/_cds_access_cds_func_in_python_scripts;product=codesys;version=3.5.15.0" rel="nofollow"&gt;https://help.codesys.com/webapp/_cds_access_cds_func_in_python_scripts;product=codesys;version=3.5.15.0&lt;/a&gt; into a local file, "PrintDeviceTree.py". When I open the project in the IDE and execute the script file, it prints six messages, as expected. When I run the script from the command line, I get an error. It doesn't matter if I precede the command with "start /wait" or run it from a batch/command file. My goal is to be able to run a single script against any arbitrary project, extracting information about the project.&lt;/p&gt;
&lt;p&gt;Here is the command:&lt;br/&gt;
c:\Users\afox&amp;gt;"C:\Program Files\CODESYS 3.5.16.10\CODESYS\Common\CODESYS.exe" --profile='CODESYS V3.5 SP16 Patch 1' --project='C:\Users\afox\Projects\SampleProject.project' --noUI --runscript='C:\Users\afox\PrintDeviceTree.py'&lt;/p&gt;
&lt;p&gt;Here is the output:&lt;br/&gt;
c:\Users\afox&amp;gt;--- Printing the devices of the project: ---&lt;br/&gt;
Error: Running script 'C:\Users\afox\PrintDeviceTree.py' caused exception System.MissingMemberException: Traceback (most recent call last):&lt;br/&gt;
  File "C:\Users\afox\PrintDeviceTree.py", line 34, in &amp;lt;module&amp;gt;&lt;br/&gt;
AttributeError: 'NoneType' object has no attribute 'get_children'&amp;lt;/module&amp;gt;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>