Pages

Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Thursday, April 20, 2017

Fedora 25 and fix python modules.

This tutorial is a simple way to fix your python modules under Fedora distro.
I used Fedora 25 and python 2.7.13 version.
First try to use this command:
pip freeze --local | grep -v '^\-e' | cut -d = -f 1  | xargs -n1 pip install -U
This command will try to update based by:
  • to skip "-e" package definitions;
  • the newer versions of pip allow you to list outdated python modules;
  • added -n1 to xargs, prevents stopping everything if updating one python module fails;
If you got this error about Python.h error:
...fatal error: Python.h...
Use this command to install the development library of Python:
[root@localhost mythcat]# dnf install python-devel.x86_64 python-devel.i686
Try to install also the devel libs for each error include.
Another example is this lib: opensslv.h
So install this:
[root@localhost mythcat]# dnf install openssl-devel.x86_64 
Last metadata expiration check: 1:58:33 ago on Thu Apr 20 18:52:10 2017.
Dependencies resolved.
================================================================================
 Package              Arch          Version                Repository      Size
================================================================================
Installing:
 openssl-devel        x86_64        1:1.0.2k-1.fc25        updates        1.5 M

Transaction Summary
================================================================================
Install  1 Package

Total download size: 1.5 M
Installed size: 3.1 M
Is this ok [y/N]: y
Downloading Packages:
openssl-devel-1.0.2k-1.fc25.x86_64.rpm          580 kB/s | 1.5 MB     00:02    
--------------------------------------------------------------------------------
Total                                           394 kB/s | 1.5 MB     00:03     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Installing  : openssl-devel-1:1.0.2k-1.fc25.x86_64                        1/1 
  Verifying   : openssl-devel-1:1.0.2k-1.fc25.x86_64                        1/1 

Installed:
  openssl-devel.x86_64 1:1.0.2k-1.fc25                                          

Complete!
Try to run again the first command:
pip freeze --local | grep -v '^\-e' | cut -d = -f 1  | xargs -n1 pip install -U
See the first result of list outdated python modules:
[root@localhost mythcat]# pip list --outdated --format=freeze
CCColUtils==1.4
cryptography==1.5.3
evdev==0.6.1
fedmsg==0.18.2
ipykernel==4.5.2
M2Crypto==0.25.1
matplotlib==1.5.2rc2
mercurial==3.8.1
mysqlclient==1.3.7
psutil==4.3.0
pycryptopp==0.6.0.1206569328141510525648634803928199668821045408958
pyopencl==2015.2
pyOpenSSL==16.0.0
pyxattr==0.5.3
requests-kerberos==0.10.0
service-identity==14.0.0
Sphinx==1.5.3
SQLAlchemy==1.1.6
Tempita==0.5.1
tornado==4.4.2
Twisted==16.3.0
txZMQ==0.7.4
After this steps the result is this:
[root@localhost mythcat]# pip list --outdated --format=freeze
mysqlclient==1.3.7
pyopencl==2015.2
pyxattr==0.5.3
I will fix this next time.

Monday, October 31, 2016

News: Free books from OReilly.

I saw OReilly books in the past and are very great books.
I like paper books, but the free books come with epub, mobi and pdf formats.
Now,  OReilly.com offering free ebooks about computer programming and development.
You will see ebooks about javascript, python, C++ and Rust and many free ebooks.
You can download all free books from here.

Saturday, May 23, 2015

News: San Francisco Python Meetup Group ...

 ... Python Meetup is putting out a call for speakers:

Meet other local Python Programming Language enthusiasts! Please join us on the second Wednesday of each month for a Presentation Night of intermediate and advanced Python talks. Please join us on the third Wednesday of each month for a Project Night of Python tutorials, mentors helping new and intermediate Python developers, sprints on Python projects, and developers working on their own projects.

More about this www.meetup.com- sfpython.

Sunday, January 4, 2015

News: FOSDEM 2015 and python room.

FOSDEM is a free event that offers open source communities a place to meet, share ideas and collaborate. It is renowned for being highly developer-oriented and brings together 5000+ geeks from all over the world.
You can find a schedule of python room here.
The FOSDEM 2015 will take place at ULB Campus Solbosch on Saturday 31 January and Sunday 1 February 2015 - Brussels.
Also no registration necessary for this event, according to the FOSDEM website.

Sunday, September 28, 2014

Should I Learn Flask or Django? by Techy Help.

Very nice animation about Django and Flask. I started with django and I used now Flask. I think is more easy to try Flask for the first time...

Thursday, September 18, 2014

News: Wing IDE 5.0.9 Released .

At September 10, 2014, the development team released the new version of Wing IDE.
See the details here: 5.0.9 - CHANGELOG.txt , also if you want to purchase licenses then you have this choice:

Wing IDE Pro:

Commercial Use
For companies, paid individuals, organizations, and government
Full-Featured Python IDE
Windows, Linux, and OS X
Includes One Year Support+Upgrades
Extend Support+Upgrades at $89/year
License is Transferable
$245 per user
$1150 5-pack

Non-Commercial Use
For students, educators, academic researchers, hobbyists, and publicly funded charities
Full-Featured Python IDE
Windows, Linux, and OS X
Optional Support+Upgrades at $89/year
$95 per user

Wing IDE Personal:
General Use
A low-cost alternative Python IDE for students and hobbyists
Omits Some Features
Windows, Linux, and OS X
Optional Support+Upgrades at $89/year
$45 per user

Thursday, September 12, 2013

Working with sunpy python module ...

Today I worked with sunpy python module.

So I make one simple tutorial about this module.

If somebody want to see it or maybe to read some python tutorial the go to this website.

Monday, September 9, 2013

News : Python 3.4.0 alpha 2 .

From python official website I found this :

Python 3.4.0 alpha 2 was released on September 9th, 2013. This is a preview release of the next major release of Python, Python 3.4, and is not suitable for production environments.

Major new features of the 3.4 series, compared to 3.3

Python 3.4 includes a range of improvements of the 3.x series, including hundreds of small improvements and bug fixes. Major new features and changes in the 3.4 release series so far include:

PEP 435, a standardized "enum" module

PEP 442, improved semantics for object finalization

PEP 443, adding single-dispatch generic functions to the standard library

PEP 445, a new C API for implementing custom memory allocators

PEP 446, changing file descriptors to not be inherited by default in subprocesses...

Saturday, September 7, 2013

Make one menu using pygame

This is the result of my tutorial named : PyGame - first interface - part 6 .

I use the rect function to make buttons.

Also I check the mouse position and changed the color.

Thursday, August 15, 2013

Few tutorials with pygame and android ...

Linux can be a goof tool for development...

In the last days I deal with pygame and android.

So if you want to make applications for your tablet or mobile phone then see this:

pygame-first-interface-part-4

working-with-pygame-subset-for-android

working-with-android-emulator-part-001

... also I saw the pygame can give some errors on android. I got this error : android pygame error : failed to dequeue buffer from native window.

So if is somebody know pygame then you can read more here.

Tuesday, July 30, 2013

News: The new pygobject come with version 3.9.5 .

GObject is an object system used by GTK+, GStreamer and other libraries.
The new PyGObject 3.9.5 provides a convenient wrapper for use in Python programs when accessing GObject libraries.
The news comes from Simon Feltman - pygtk digest: I am pleased to announce version 3.9.5 of the Python bindings for GObject. This is the third release of the 3.9.x series which will eventually result in the stable 3.10 release for GNOME 3.10.
The new release is available from ftp.gnome.org.

Saturday, July 13, 2013

Selenium can deal with your cookies browser.

Today I will show how to deal with cookies and Firefox.

Selenium Python Client Driver is a Python language binding for Selenium Remote Control.

You can read more about this module here.

You can find some examples , but most of webpages working with cookies.So let's make one simple tutorial.

The next source code is very simple and most of the python users knows what means.


$ python 
Python 2.7.3 (default, Jan  2 2013, 16:53:07) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from selenium import webdriver
>>> from selenium.common.exceptions import NoSuchElementException
>>> from selenium.webdriver.common.keys import Keys
>>> browser = webdriver.Firefox()
>>> browser.get("http://facebook.com/")

If you want then you can read more about my tutorial here.

Also you can see more about my work with python here.

Monday, June 24, 2013

The font python module from pygame is missing .

Today I try to see some old python source code.

I got this error and seam many python users have same error.

NotImplementedError: font module not available
(ImportError: No module named font)

It's the last release of pygame.

When I try to config the pygame I got this

pygame-1.9.1release]$ python2.7 config.py
Using UNIX configuration...


Backup existing "Setup" file [Y/n]:

Hunting dependencies...
sh: smpeg-config: command not found
WARNING: "smpeg-config" failed!
SDL     : found 1.2.13
FONT    : not found
IMAGE   : found
MIXER   : not found
SMPEG   : not found
PNG     : found
JPEG    : found
SCRAP   : found
PORTMIDI: not found
PORTTIME: not found


Warning, some of the pygame dependencies were not found. Pygame can still
compile and install, but games that depend on those missing dependencies
will not run. Would you like to continue the configuration? [Y/n]:

Not only FONT is not here. I will try to fix this issue.

Monday, February 25, 2013

Newton fractal with Python 2.7.3

Today I worked with fractals and python.

It was a litte hard. I have used the internet and wikipedia documentation.

If somebody want to make something better like this:

My source code can be found : here.

Monday, May 21, 2012

News: Working with python , opengl and ARB ...

Today I test a simple script that uses the OpenGL ARB "Architecture Review Board".
The script is very simple and can be found on my graphic-3d.blogspot.com.
I make this with Python 2.6.4 , pyopengl module.

Saturday, September 24, 2011

Creating folders and documents with gdata module

Today I played with gdata python module.
The problem that I solved it:
creating folders and documents in your Gmail account.
First, you need to install the gdata module.
In fedora I used:
yum install python-gdata.noarch 
Here are the first lines of source code that creates a folder named test-fedora
Python 2.7.1 (r271:86832, Apr 12 2011, 16:16:18) 
[GCC 4.6.0 20110331 (Red Hat 4.6.0-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gdata.docs.service
>>> my=gdata.docs.service.DocsService()
>>> my.ClientLogin('your-account@gmail.com','your-password')
>>> my.CreateFolder('test-fedora')
I tried to automate the process of creating folders and I used a list and instruction for
>>> folders=['aaa','bbb','ccc']
>>> for f in folders:
...     my.CreateFolder(f)
... 
To create a document to write more lines of code.
This is because there are many types of documents
>>> new_entry = gdata.GDataEntry()
>>> new_entry.title = gdata.atom.Title(text='fedora-test')
>>> category = my._MakeKindCategory(gdata.docs.service.DOCUMENT_LABEL)
>>> new_entry.category.append(category)
>>> created_entry = my.Post(new_entry, '/feeds/documents/private/full')
Here's a simple solution to avoid loss of mail password.
>>> import getpass
>>> username = raw_input('Please enter your username: ')
Please enter your username: user1
>>> password = getpass.getpass()
Password: 
>>> print username
user1
>>> print password
pass1
I hope you will use this

Friday, December 10, 2010

Christmas - new decor script for your desktop .

Last year I made a python script to beautify your desktop on Christmas Day.
I wrote it here about this script.
I lost the script, but now  I wrote this script again.
The script is very simple and you can get it here.
Here's what makes this script:

Thursday, November 11, 2010

Notifications in Fedora 14

We use the following command
$ notify-send  "This is some text"
or
$zenity --info --text "This is some text"
This will display a text balloon "This is some text".
The problem appears when we want to display the output of a command.
For this, I used a python script. Here's the source code:
#!/usr/bin/env python
import os
import sys
import pynotify
pynotify.init("Output comand")
arg=sys.argv[1]
print arg
s = os.popen(arg).read()
n = pynotify.Notification("Output",s)
n.show()
If you wish to use a compound command, then you will need to use quotes.
For example, we use the command "ls-a 'as follows:
$python testpy.py "ls -a"
This is just a small example, you can create more complex applications.

Wednesday, September 22, 2010

Python, pyuno and OpenOffice

Some time ago, I discovered Python. Then I saw that he can work with the OpenOffice.
Today I will briefly introduce how to do this. I do this in Windows XP, and Windows users could benefit.
In the folder : C:\Program Files\OpenOffice.org 3\program there was a file called python.exe.
Go there and type the following script to start OpenOffice:

import os
import subprocess
import sys
import time
import uno

NoConnectionException = uno.getClass("com.sun.star.connection.NoConnectException")
ooffice = 'soffice "-accept=socket,host=localhost,port=8100;urp;"'
def start_OOo():
    '''Starts OpenOffice.org with a listening socket.'''
    # Start OpenOffice.org and report any errors that
    # occur.
    try:
        retcode = subprocess.call(ooffice, shell=True)
        if retcode < 0:
            print >>sys.stderr, \
                "OOo was terminated by signal", \
                -retcode
        elif retcode > 0:
            print >>sys.stderr, \
                "OOo returned", \
                retcode
    except OSError, e:
        print >>sys.stderr, "Execution failed:", e
    # Terminate this process when OOo has closed.
    raise SystemExit()
started_OOo = False
if not started_OOo:
    print "Starting OOo"
    started_OOo = True
    start_OOo()
time.sleep(3)
print "OOo started"
This will start OpenOffice 3.
We can use now python scripts to create any type of file used by OpenOffice.
Let show one image create with few lines :

Tuesday, April 13, 2010

Simple script to get the exchange rate.

Some time ago I made a small script to find out the exchange rate.
I have not used it much and today I came across it.
Who needs something, here's how it looks:
from xml.dom import minidom as dom
import urllib
def fetchPage(url):
a = urllib.urlopen(url)
return ''.join(a.readlines())

def extract(page):
a = dom.parseString(page)
item2 = a.getElementsByTagName('SendingDate')[0].firstChild.wholeText
print "DATA ",item2
item = a.getElementsByTagName('Cube')
for i in item:
if i.hasChildNodes() == True:
e = i.getElementsByTagName('Rate')[10].firstChild.wholeText
d = i.getElementsByTagName('Rate')[26].firstChild.wholeText
print "EURO  ",e
print "DOLAR ",d

if __name__=='__main__':
page = fetchPage("http://www.bnro.ro/nbrfxrates.xml")
extract(page)

That's all.