error: when i execute 1st item in setup

241 views
Skip to first unread message

Ronald Omegna

unread,
Nov 3, 2021, 10:52:10 AM11/3/21
to Python GCU Forum
folks,

i installed python, tried the 1st test: 
C:\google-python-exercises> python hello.py Hello World

i am on win10; and i included 2 statements into the user environment path:
- one addition for where python is installed
- one addition for where the google-python-exercises  are installed

python was confirmed found from cmd line (using win10) 
but i got the following when i tried hello.py: i got syntax error 'missing parentheses in call to 'print'. did you mean print('Hello', name)?

i tried this from the cmd line and also when i tried it under IDLE
when i tried 'hello.py ron', it gave me a syntax error pointing to 'ron'; name 'hello' is not defined

ok, i know i am doing something wrong, but i can't figure out what.
any help is appreciated. has to be something simple?

thanks,
ron

Prabhat upadhyay

unread,
Nov 3, 2021, 1:09:10 PM11/3/21
to Python GCU Forum
SURE

Darshan Bafna

unread,
Nov 3, 2021, 10:22:48 PM11/3/21
to python-g...@googlegroups.com
You should directly install it from Microsoft Store i.e pychram

--
You received this message because you are subscribed to the Google Groups "Python GCU Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-gcu-for...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-gcu-forum/5f31798e-b389-4188-b209-0e0bb9c51aden%40googlegroups.com.

Sudhagar V

unread,
Nov 11, 2021, 3:28:51 AM11/11/21
to python-g...@googlegroups.com
If your running your program in cmd. First you have to local your path on your cmd. And type

Python hello.py

This cmd used for running your python program.

Again if you getting an error. Just go to your environmental variable tool window and check whether python path has correctly inserted or not. 

After everything over. Just check your python version using your cmd.





e learn

unread,
Nov 12, 2021, 7:55:26 PM11/12/21
to Python GCU Forum
check version, both python 2.x and 3.x uses print differently
Small advice, post your code or code link. 
use online tool as well like google colab, replit.com
regards
Pavneet

Vimalkumar Chawda

unread,
Nov 15, 2021, 7:18:54 PM11/15/21
to Python GCU Forum
Hello Everyone Sir

I have good knowledge of matlab but new to python. Can you please help me to read few lines of matlab to python? My code is below and I mention too detailed all the data. I am ready to pay for if someone can help me within short notice also. Thank you all.  

close all
clear all
clc

%% Read image sequence
path2sequence = 'sequence';
search_string = fullfile(path2sequence, '*.jpeg');
file_list = dir(search_string);

%% Sequencial estimation of the gaussians parameters

% TODO: Learning rate
alpha = 1/50;

% Initial values
im_RGB = imread(fullfile(path2sequence, file_list(1).name));
[m,n] = size(rgb2gray(im_RGB));
 
mu = single(rgb2gray(im_RGB)); 
sigma_square = ones(m,n)*100;

% Structure element for morphological operation
se = strel('square',3);

h1 = figure(1);
colormap(gray);
dim = [0 0 1 1];%[0.262499999999998,0.002380951174668,0.480357129073569,0.06428571307943];
txt = [sprintf('Learning Rate: % .2f,  Number of Frames: % .2f' ,alpha,inv(alpha))];
ui = annotation('textbox',dim,'String',txt,'FitBoxToText','on','verticalalignment', 'bottom');

% Iterate over the sequence
for i = 2:length(file_list)
    im_RGB = imread(fullfile(path2sequence, file_list(i).name));
    im = single(rgb2gray(im_RGB));
    
    % TODO: Thresholding for background subtraction
    %variance is used as a local threshold
    delta_g = abs(im-mu);
    %background and foreground pixels are initialized with as 1
    mask_back = ones(m,n); %-> background pixels are 1, foreground pixels are set to 0
    mask_back(delta_g > 2.5*sqrt(sigma_square)) = 0; % setting foreground to 1 using the threshold
    mask_back = logical(mask_back); %convert to type "logical"
    
    % Eliminate noise
    % TODO: Closing using structure element "se"
    filtered_mask = imclose(mask_back,se);
    
    % Update Gaussian parameters 
    % TODO: Mean
    mu = (alpha * im) + ((1-alpha)*mu); %updating the mean
    % TODO: Variance
    sigma_square = (alpha * (mu - im).^2) + (1-alpha) * sigma_square; %updating the variance
    
    % Output
    subplot(231); 
    imagesc(im, [0 255]); % TODO: Show input image
    title('Input Image')
    subplot(232); 
    imagesc(mu, [0 255]); % TODO: Show mean values
    title('Mean Image')
    subplot(233);  
    imagesc(sigma_square, [0 255]); % TODO: Show variances
    title('Variance Image')
    subplot(234);  
    imagesc(delta_g, [0 255]); % TODO: Show difference between current image and mean values
    title('Delta_G Image')
    subplot(235);  
    imagesc(mask_back, [0 1]); % TODO: Show background mask (unfiltered)
    title('Unfiltered Image')
    subplot(236);  
    imagesc(filtered_mask, [0 1]); % TODO: Show background mask after eliminating noise
    title('Filtered Image')
    drawnow; 
%     txt = [sprintf('Frame No.: % .2f' ,i)];
    txt = [strcat("Frame Number",int2str(i))];
    box = annotation('textbox',dim,'String',txt,'FitBoxToText','on');
    pause(0.00000000001);
    delete(box)
end

Vimalkumar Chawda

unread,
Nov 15, 2021, 7:21:39 PM11/15/21
to Python GCU Forum
My first task is read all the images as which is available in set of images. 

How we can read the video which is set of images? I want to apply Gaussian on it. Thanks  

Vimalkumar Chawda

unread,
Nov 15, 2021, 7:22:48 PM11/15/21
to Python GCU Forum
S1-T1-C.00000.jpeg
this is the first image of the sequence and last image is below 

S1-T1-C.00999.jpeg
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages