Changeset 1721:921b3780c6cc in orange-bioinformatics for server_update/updatemiRNA.py


Ignore:
Timestamp:
09/14/12 12:20:53 (20 months ago)
Author:
markotoplak
Branch:
default
Message:

Moved common functionality of the server files update scripts to a separate file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server_update/updatemiRNA.py

    r1719 r1721  
     1 
     2from common import * 
    13 
    24import urllib 
    35import re 
    4 import pylab 
    5 import random 
    6 import os 
    7 import math 
    8 import locale 
    9 import gzip 
    106import StringIO 
    11 import sys 
    12 from getopt import getopt 
    137import zipfile 
    148 
    159import Orange.bio.obiTaxonomy as tax 
    16 import Orange.utils.serverfiles as orngServerFiles 
    17 import Orange.utils.environ as orngEnviron 
    1810 
    1911def fastprint(filename,mode,what): 
     
    2517 
    2618def sendMail(subject): 
    27      
    28     print "MAIL", subject 
    29     toaddr = "rsberex@yahoo.it" 
    30     fromaddr = "orange@fri.uni-lj.si"; 
    31     msg = "From: %s\r\nTo: %s\r\nSubject: %s" % (fromaddr, toaddr, subject) 
    32     try: 
    33         import smtplib 
    34         s = smtplib.SMTP('212.235.188.18', 25) 
    35         s.sendmail(fromaddr, toaddr, msg) 
    36         s.quit() 
    37     except Exception, ex: 
    38         print "Failed to send error report due to:", ex 
    39  
     19    print "SHOULD MAIL:", subject 
    4020         
    4121def format_checker(content): 
     
    221201############################################################################################################################################################## 
    222202 
    223 opt = dict(getopt(sys.argv[1:], "u:p:", ["user=", "password="])[0]) 
    224  
    225 username = opt.get("-u", opt.get("--user", "username")) 
    226 password = opt.get("-p", opt.get("--password", "password")) 
    227  
    228 path = os.path.join(orngEnviron.buffer_dir, "tmp_miRNA") 
     203path = os.path.join(environ.buffer_dir, "tmp_miRNA") 
    229204print 'path: ', path 
    230205 
    231 serverFiles = orngServerFiles.ServerFiles(username, password) 
     206serverFiles = sf_server 
    232207 
    233208try: 
     
    235210except OSError: 
    236211    pass 
    237  
    238212 
    239213org_taxo = [tax.name(id) for id in tax.common_taxids()] 
     
    322296    print "Check the address of miRNA file on %s" % address 
    323297 
    324                  
    325              
    326  
    327  
    328  
    329     
Note: See TracChangeset for help on using the changeset viewer.