Question about Python

Started by mowens, September 11, 2025, 01:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mowens

So AI is telling me that I can launch a python program from the command line.
First, find the python.exe file, then change the directory to wherever the python file to be executed resides.

Then you enter python filename.py

When I do that, nothing happens. The command prompt goes away for a few milliseconds then reappears again like "hey, how ya doing". Like, if you go to buy weed from a thug and he takes your money but doesn't give you the weed. That kind of feeling. I've even entered the full pathname of the python.exe file.

C:\Users\s2608092\AppData\Local\Microsoft\WindowsApps\python.exe python_test.py

Same result.

Am i doing something wrong or am I just locked out? Maybe I have to be an admin, This company keeps a pretty tight lid on anything to do with IT.

Any other thoughts?


"I would gladly risk feeling bad at times if it also meant that I could taste my dessert." - Data

SuperHoneyBadger

cd to the directory where your .py script lives, and the line you want to run is:

python python_test.py

mowens

#17
That's what I do. python_test.py resides on the Z:\ drive.

The command line looks like Z:\python python_test.py when I press enter.
The command line goes away for a few milliseconds then reappears.

Z:\

I think there are some environmental variables that need to be changed and I would have to be an admin for that.

"I would gladly risk feeling bad at times if it also meant that I could taste my dessert." - Data

SuperHoneyBadger

I have had a few scripts do the same thing, and I always wondered if they were working. I usually add in a section that outputs a .txt file named for the date/time that says "completed", or gives some warning or error. Especially when the script doesn't do something grand. At least if there is an output file, you'll know it ran!

Full disclosure, I get ChatGPT to make everything for me, as discussed earlier, I'm no python guy just made a few things to try it out.

mowens

ChatGPT is blocked here, so I've been using Google AI mode.

The python.exe file is just a placeholder. It has a file size of zero.

I was successfully able to translate the vbscript to Powershell. I have almost no knowledge of powershell, so I need to get familiar with it. I also need to check the output, though it looks good initially.
"I would gladly risk feeling bad at times if it also meant that I could taste my dessert." - Data

YoDoug

I added some more functionality. The app now polls the Okuma API every 5 seconds to read/write a few common variables that tell which part number from the trays is in the machine. The app highlights that part with a green square. Then using the cycle time we can calculate remaining time for the schedule. The remaining time also change colors, green > 2 hrs, Yellow = 1-2 hrs, Red < 1 hr. This way operators in the shop can tell from a quick glance if they are close to needing to reload or changeover. The app also populates a common variable with the remaining time. Our data tracking software can read that common variable and display remaining time of the current running schedule on our shop monitors.

Like Like x 1 View List
"In all my years here and on the old forum I have heard, and likely said, some pretty unhinged stuff. But congrats, you're the new leader in clubhouse."  - ghuns, 6/06/2025

Rstewart

Would you be able to download PyCharm on your work computer?  I'm pretty dumb at all of this, but trying to learn some.