Pages

Sunday, September 13, 2015

Convert python 2.7 code into Python 3.4 code

Convert python 2.7 into Python 3.4

Hello and welcome in this tutorial im going to teach you cool trick.how to convert the python 2 script in to python 3 script it is easy.
here is the step im going to do
create new folder in desktop
then save my python 2.7 file in that folder
then select the folder that i created before and press shift and then press right click it will ask for open command prompt here select it and boom then it will open the command prompt
 after that you have to type like this
python C:/Python/Tools/scripts/2to3.py then your file name
ex:-
python C:/Python/Tools/scripts/2to3.py mypythonfile.py

then press enter then it will show you the points you need to change [-] mark will represent the changes you wanna do.
or you can make the changes automatically you can type -w before your file name then it will automatically fix the errors for you

python C:/Python/Tools/scripts/2to3.py -w myfile.py

here is my python 2.7 file  
i saved in new folder in desktop
Press Shift and press right click to open command prompt in that folder

check corrections



errors are marked


Errors are fixed using -w command


Errors are fixed now


lets see the new changed code

Lets run the code and see the result







Monday, September 7, 2015

How to uninstall Django completely

pip uninstall

in this tutorial im going to teach you how to uninstall Django from your computer completely

open command prompt and type
pip uninstall django

this command completely remove django from your computer

How to uninstall Django version and install specific version

pip install package==version

in this tutorial im going to teach you.small tip how to install specific  version using pip install

first you 
you have to type
pip install package_name==version number
as example pip install django==1.6.5
that's it it will install the specific version


to check the version of the django you can open python shell and type
print(django.get_version())


Sunday, September 6, 2015

How to install sqlite3 on windows computer

Install sqlite3 on windows 10

when you are try to work with django .you need to have database sqlite3 is simple light weight database .you can check if your computer already have sqlite3 or not.
 open command prompt and type sqlite3

 if it shows error massage then you can go to sqlite3 website and download precompiled Binaries  and dll file and download the two zip file and unzip it.

 sqlite download page
precompiled binaries for  windows

 unzip files

inside ziped dll files

 copy all 3 files in to system 32 folder
 and copy both files and past in your computer system 32 folder 
thats it now open command prompt again and type sqlite3 it will show message like this now you have sqlite3

How to check how many python packages install in computer

pip freeze

hi there in this tutorial im going to teach you some small tip to check how many python framework installed on your computer

open your command prompt and type
pip freeze
 hit enter
it will show how many python frameworks are installed in your computer


How to install Django on windows Lesson 1

pip install Django

Hello there today i'm going to start new tutorial seris about python web framework called Django. most of major websites are created using Django as example pinterest.com,Disqus,Bitbucket
today we are going to start our first step.
lets install django on our windows machine

open command prompt and type pip install django it will automatically install the django and its dependencies



Friday, September 4, 2015

Python For Beginners Lesson 4 Numbers

Python Numbers

hi in this tutorial im going to teach you about numbers in python
go to start menu and type python and then you can see python IDLE its built in python editor
it can identify python data type and variables automatically.in python IDLE
type

5+5 then enter it will give out put as 10



 and also you can multiple numbers
type 20*5 it will give 100


if you type 6+4*10 it will give output as 46 but why its not 100 because it follows basic maths order
it consider maths functions as this order  (),/,*,+,-


and also you can divide numbers 19/5
answer is 3.8

 if 19//5 it will give rounded value and it will drop the decimal point

if you want remainder you have to use % mark
like 19%5 it will give remaining value 4

you can get power  or exponent like this 10*10*10 
or even get the same result easily using ** mark 

or even you can assign variable and values and add them together
sam=20
madu=10
sam+madu answer is 30

i hope you have learn something from this tutorial if you have any question please leave a comment below
have a good day








Python Beginner Tutorial Lesson 3 Install PyCharm

Install Pycharm

hello in this tutorial im going to teach you about install python editor called pycharm
it is easy way to edit and create python application.
first you need to download pycharm from
https://www.jetbrains.com/pycharm/download/
 after that there is linux,windows and mac os version dowload installer as your requirement
after that install as normal program.then it will automatically detect your python version
after that you are ready to go

How to install .whl extention package in Python

How to install .whl extention package in Python

hello friends today i'm going to teach you how to install python modules in .whl extension
its easy first go to command prompt (use can press windows key and type cmd in start menu)
after that chage your directory to where you have that .whl file actually .whl extension refer to wheel .
you can use cd command to change directory in command prompt
i have my kivy.whl file in drive D so i have to change my drive using cd  or D: command
after that type pip install yourwhlfilename and extension
then enter.
then it will install that module for you







How to Run Python on Android Device

How to Run Python on Android Device QPython and Kivy

Hello friends how are you .hope you are fine.in this tutorial im going to explain about how to run python code on android devices.there is android app called QPython.using this application you can code python code when you are in on the go.if you are serious python lover.you can code and run python script as hobby using your mobile phone or tablet.
here is the link for google play store
https://play.google.com/store/apps/details?id=com.hipipal.qpyplus&hl=en

 and also you can use Kivy .i hope to start kivy tutorials soon.using kivy you can write mobile application using python.
you can find more information about kivy http://kivy.org/

here is how to run helloworld using python in my mobile phone









Thursday, September 3, 2015

from engine import Engine ImportError: No module named 'engine' Solved

  from engine import Engine ImportError: No module named 'engine' Solved

Hello Viewers when you try to create text to speech program using python 3.4 or any python 3.x version .you have to face this error massage called
"  from engine import Engine
ImportError: No module named 'engine' "

because this libary is design for python 2 versions so we can fix the error.first you have to do go to your python folder and go to Libs folder and then go to site packages

C:\Python34\Lib\site-packages\pyttsx then pyttsx folder there is  engine.py file and driver.py files you have to change that two files

click on image to see in better

click on engine.py file and click edit
 go to line number 64 and there is "except Exception, e "then change it as "except Exception as e"
 then it will show like this then save it
 Then open Driver.py file and edit it in that file go to line number 105 and then you can see 
"except Exception, e" change it like previous one ."except Exception as e"


it will show like this now press save now you are ready to go

if you get help from this tutorial please share and comment
have a good day

Python Text To Speach Package Install pip install pyttsx

How to install Pyttsx Python Library Using pip install

Hi viewers today im going to show small tip .most of people try to create text to speech programs.if you are using python .then you can easily create text to speech program.so we have to use the python library called pyttsx. this is the easiest way to install pyttsx.

Open your command prompt and type pip install pyttsx and then press enter.Then it will automatically install the pyttsx library for you.now you can create text to speech program easily.


Saturday, August 29, 2015

Python For Beginners Start Code Python With Sam Lesson 2 Run Python script using command prompt

Python For Beginners Start Code Python With Sam Lesson 2 Run Python script using command prompt


hello there in previous tutorial i promised you to teach about how to run python script in command prompt
ok lets get started first create new text file and type print ('hello world')
now goto save as and give a name like hello.py remember to put extension as py after that save as type change text file to all files then save












then go to command prompt you can go to start menu and type cmd and then open cmd and type
python but it show error what is error
"python is not recognized as an internal or external command"

python is not recognized as an internal or external command Error solved 



first right click on my computer
 Go to advance settings

then go to Environmental variables and click path and click Edit

then open python folder you have installed in my computer its in c://python34 go to that folder and copy link
than go to again environmental variable path and go to end of the path (you can use arrow key to go to end of the path)
then past ; semicolon in the end of the path 
then past the previous copied path

ex existing path here ;c://python34 


now click ok ok ok now you have solve the problem
 now open command prompt again and type python now there is no errors


Run python script using command prompt


now lets run the previous created hello.py file


open command prompt

change command prompt location where the file is saved
 i saved in desktop so i change directory as cd Desktop
then type python hello.py
then it execute the python script and shows output in command prompt as hello world



all done now you know how to fix errors set path in python and how to run python script using command prompt

ok guys next tutorial im going to teaching how to install pycham IDE for fast coding
thanks for watching
have a good day
Sameera Dissanayaka

#pythonforbeginners ,#startcodepythonwithsam ,#runpythonscriptusingcmd