Sending gmail with no clear password

2016-03-28 Thread zljubisicmob
Hi, I have a python3 script that runs 24/7 on linux (raspberry pi) server. It would be very nice for the script to be able to send an email message about certain statuses. As the linux server is headless, I don't have an option to key in the password while starting the script. Furthermore, fro

Why dropbox.client.DropboxClient.put_file needs file_obj as a parameter?

2015-05-25 Thread zljubisicmob
Hi as I can see dropbox.client.DropboxClient.put_file has four parameters: " full_path The full path to upload the file to, including the file name. If the destination folder does not yet exist, it will be created. file_obj A file-like object to upload. If you would like,

How to deploy a custom common module?

2015-05-15 Thread zljubisicmob
While working on one python script (test.py), I developed some functions that I will probably need in my future projects, so I decided to put such functions in another python file (cmn_funcs.py). So in my test.py there is import cmn_funcs in order to use common functions and everything works we

Re: Python file structure

2015-05-12 Thread zljubisicmob
On Tuesday, May 12, 2015 at 9:49:20 PM UTC+2, Ned Batchelder wrote: > On Tuesday, May 12, 2015 at 3:13:32 PM UTC-4, zljubi...@gmail.com wrote: > > Hi, I have python file with the following structure: > > > > import... > > > > A = configparser.get(...) > > B = configparser.get(...) > > > > Comma

Python file structure

2015-05-12 Thread zljubisicmob
Hi, I have python file with the following structure: import... A = configparser.get(...) B = configparser.get(...) Command line parameters parsing [they can change variable A or B] Def usage() Print how to use script parameters def main(): ... if __name__ == "__main__": m

Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

2015-05-12 Thread zljubisicmob
I would say so as well. Thanks to everyone who helped. Regards and best wishes. -- https://mail.python.org/mailman/listinfo/python-list

Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

2015-05-10 Thread zljubisicmob
> No, we can't see what ROOTDIR is, since you read it from the config > file. And you don't show us the results of those prints. You don't > even show us the full exception, or even the line it fails on. Sorry I forgot. This is the output of the script: C:\Python34\python.exe C:/Users/zoran/P

Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

2015-05-10 Thread zljubisicmob
> > It works, but if you change title = title[:232] to title = title[:233], > > you will get "FileNotFoundError: [Errno 2] No such file or directory". > > > Which is a *completely different* error from > > SyntaxError: 'unicodeescape' codec can't decode bytes in position 2-3: > truncated \U

Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

2015-05-09 Thread zljubisicmob
Steven, please do look at the code bellow: # C:\Users\zoran\PycharmProjects\mm_align\hrt3.cfg contents # [Dir] # ROOTDIR = C:\Users\zoran\hrt import os import shutil import configparser import requests import re Config = configparser.ConfigParser() Config.optionxform = str # preserve case in i

Re: SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

2015-05-08 Thread zljubisicmob
Thanks for clarifying. Looks like the error message was wrong. On windows ntfs I had a file name more than 259 characters which is widows limit. After cutting file name to 259 characters everything works as it should. If I cut file name to 260 characters I get the error from subject which is wron

SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

2015-05-08 Thread zljubisicmob
The script is very simple (abc.txt exists in ROOTDIR directory): import os import shutil ROOTDIR = 'C:\Users\zoran' file1 = os.path.join(ROOTDIR, 'abc.txt') file2 = os.path.join(ROOTDIR, 'def.txt') shutil.move(file1, file2) But it returns the following error: C:\Python34\python.exe C:/Users

Re: How to set request module logging to certain level (python 3.4.2)

2015-04-04 Thread zljubisicmob
Looks like I have found (with your help) a solution. Instead of: logging.getLogger('requests.packages.urllib3').setLevel(logging.ERROR) the line should look like: logging.getLogger('urllib3').setLevel(logging.ERROR) After changing the line, everything is OK. Thank you all. Regards. -- http

Re: How to set request module logging to certain level (python 3.4.2)

2015-04-04 Thread zljubisicmob
On Saturday, April 4, 2015 at 5:23:02 PM UTC+2, Dennis Lee Bieber wrote: > implies the correct name to use for the logger is > "requests.packages.urllib3". I have changed a script log_test.py. Now it looks like this: #!/usr/bin/python3 import logging, requests logging.basicConfig(filename="obri

How to set request module logging to certain level (python 3.4.2)

2015-04-04 Thread zljubisicmob
Hi, if I execute: import logging, requests logging.basicConfig(filename="obrisi.log", level=10, format='%(asctime)s %(levelname)s %(message)s',datefmt='%d.%m.%Y %H:%M:%S') logging.getLogger('requests').setLevel(logging.ERROR) url = 'http://radio.hrt.hr/prvi-program/arhiva/povijest-cetvrtkom/126/