RE: Doubt with files

2017-02-14 Thread Joaquin Alzola
>with open(dirFichero,'r') as reader: > for line in reader: > print line > >the problem is that shown is : >{\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf810 >{\fonttbl\f0\fswiss\fcharset0 Helvetica;} >{\colortbl;\red255\green255\blue255;} >{\*\expandedcolortbl;;} >\paperw11900\paperh1

RE: Problems with scp script in Python

2017-02-13 Thread Joaquin Alzola
>I have an SCP script that auto completes just fine from the terminal window in >Pi. When I use either subprocess or os to try and have it run under Python it >does not do the file >transfer from Pi to my Ubuntu machine. What am I doing >wrong? Here is the script: >from subprocess import cal

RE: Python

2017-01-25 Thread Joaquin Alzola
> Need help I need a beer Put your question in the mailing list I think you can get the help needed. This email is confidential and may be subject to privilege. If you are not the intended recipient, please do not copy or disclose its content but contact the sender immediately upon receipt. --

RE: Help with this code

2017-01-09 Thread Joaquin Alzola
>> elements. For example, if we have a list_a=["a","b","c","d"] and >> list_b=["a","b"] I want to obtain a new list_c containing elements that >> match between these lists (a and b here), >Perhaps this might work: list(set(list_a).intersection(set(list_b))) >['a', 'b'] >>> list_a={"a","b","

RE: Pexpect

2017-01-06 Thread Joaquin Alzola
> How to match latter(caps and small) ,numbers and # symbol in python pexpect. With a .* child = pexpect.spawnu("ssh cbpapp@%s"% CBP[cust_cbp_server]) child.setecho(False) child.logfile = open("/opt/webapi/logs/delete_accountID.log", "w") child.expect(".*assword:")

RE: List comprehension

2016-12-30 Thread Joaquin Alzola
>Now, this puzzles me: [x,y for a in data] > File "", line 1 >[x,y for a in data] > ^ >SyntaxError: invalid syntax >I expected: >[(1, 2), (3, 4)] You can try [(x,z) for x,z in data]. In your situation a takes the values (1,2) or (3,4) in the one that I put x and z take the

RE: for loop iter next if file bad

2016-12-21 Thread Joaquin Alzola
>def return_files(file_list): >""" >Take a list of files and return file when called. > >Calling function to supply attributes >""" >for file in file_list: >with open(os.path.join(dir_path, file), 'rb') as fd: >if os.stat(fd.name).st_size == 0: >

RE: Can json.dumps create multiple lines

2016-12-02 Thread Joaquin Alzola
On Thu, Dec 1, 2016 at 10:30 AM, Cecil Westerhof wrote: > I would prefer when it would generate: > '[ > "An array", > "with several strings", > "as a demo" > ]' > > Is this possible, or do I have to code this myself? > https://docs.python.org/3/library/json.html?highlight=

RE: How to handle errors?

2016-10-20 Thread Joaquin Alzola
> [root@bart /]# ./dataman.py >Enter a domain name: aslfhafja >Your domain is aslfhafja >Traceback (most recent call last): > File "./dataman.py", line 7, in > print socket.gethostbyname(str) >socket.gaierror: [Errno -2] Name or service not known >[root@bart /]# >I would like to be able to h

RE: smtplib TimeoutError not catch

2016-10-12 Thread Joaquin Alzola
>Not surprisingly, the exception you should catch is simply TimeoutError: >try: >server.sendmail(sender, receivers, msg.as_string()) >except TimeoutError as e: >print("SMTP could not be contacted: %s" % e) >finally: > server.quit() The error was thrown by a

smtplib TimeoutError not catch

2016-10-12 Thread Joaquin Alzola
Hi Guys Try to connect to the smtp via smtplib. The connection is down because the Firewall has not been open yet so the exception is something that should appear. Now I want to catch this timeout in case error happens in future. Here the exception trace. [2016-10-12 14:14:06,289] ERROR in app

RE: How to split value where is comma ?

2016-09-11 Thread Joaquin Alzola
>I have worked places where they put stuff like this at the bottom of emails >sent to the person sitting next to them :) -raising entropy-ly yrs- Robin >Becker Cannot do anything about it. It is not on my MTA client and it is added by the company server :( If it depended on my I will remove i

RE: What you can do about legalese nonsense on email (was: How to split value where is comma ?)

2016-09-08 Thread Joaquin Alzola
Hi Ben Thanks for the advice. > * Complain Basically what all comes down is to complain. I wonder if in a company of 80,000 people I will manage to change that behaviour. This email is confidential and may be subject to privilege. If you are not the intended recipient, please do not copy or di

RE: How to split value where is comma ?

2016-09-08 Thread Joaquin Alzola
https://mail.python.org/mailman/listinfo/python-list

RE: How to split value where is comma ?

2016-09-07 Thread Joaquin Alzola
> where is a comma there should start new line ... How can i do it ? Use the split a.split(",") for x in a: print(x) This email is confidential and may be subject to privilege. If you are not the intended recipient, please do not copy or disclose its content but contact the sender immediately

RE: dictionary total sum

2016-09-07 Thread Joaquin Alzola
On Wednesday, September 7, 2016 at 8:25:42 PM UTC-4, p...@blacktoli.com wrote: > Hello, > > any ideas why this does not work? > > >>> def add(key, num): > ... a[key] += num > ... > >>> a={} > >>> a["007-12"] = 22 if not a.has_key("007-12") else add("007-12",22) > >>> a > {'007-12': 22} # OK her

RE: The order of iterable de-referencing in assignment?

2016-08-24 Thread Joaquin Alzola
>> One might guess a.extend(a) would turn into an infinite loop. It turns out >> here Python first gets all the items of `a' and then append them to `a', so >> the infinite loop is avoided. >>> a = [1,2] >>> for x in a: a.append(x) >... >^CTraceback (most recent call last): > File "", line 1, i

RE: python 3.5.2 lounch: api-ms-win-crt-runtime-l1-1-0.dll is missing ?

2016-08-08 Thread Joaquin Alzola
>I installed the version for windows 64. After a succesfull installation, the >same system error occurs on the lounch of the program: >api-ms-win-crt-runtime-l1-1-0.dll is missing. Sometimes google save you time more than the list: https://www.smartftp.com/support/kb/the-program-cant-start-bec

RE: Python and 64bit Windows7

2016-08-08 Thread Joaquin Alzola
>I am having problems when installing Python on a 64bit windows7 laptop. >I am guessing that the problem is happening because of the 64bit architecture. >Could you please take a look at the attached file that has screen shots of the >problem I am facing? >Could you tell me how I can fix these issu

Unittest

2016-07-25 Thread Joaquin Alzola
Hi Guys I have a question related to unittest. I suppose a SW that is going to live will not have any trace of unittest module along their code. So is it the way to do it to put all unittest in a preproduction environment and then remove all lines relate to unittest once the SW is release into

JAR files into python

2016-07-01 Thread Joaquin Alzola
Hi Guys I have the following script which will be used in Spark. #!/usr/bin/env python3 from pyspark_cassandra import CassandraSparkContext, Row from pyspark import SparkContext, SparkConf from pyspark.sql import SQLContext import os os.environ['CLASSPATH']="/mnt/spark/lib" conf = SparkConf().se

RE: Question on compiling on linux

2016-06-24 Thread Joaquin Alzola
>That gives me many .so files but no python*.so* file :( Install the python-devel. This email is confidential and may be subject to privilege. If you are not the intended recipient, please do not copy or disclose its content but contact the sender immediately upon receipt. -- https://mail.pytho

RE: not able to install mysqldb-python

2016-06-23 Thread Joaquin Alzola
>ImportError: No module named 'ConfigParser' It is telling you the error This email is confidential and may be subject to privilege. If you are not the intended recipient, please do not copy or disclose its content but contact the sender immediately upon receipt. -- https://mail.python.org/

RE: Cassandra multiprocessing can't pickle _thread.lock objects

2016-06-21 Thread Joaquin Alzola
>I tried to use Cassandra and multiprocessing to insert rows (dummy data) >concurrently based on the examples in Same situation here. I was going to try this solution but on the reading side. Was even thinking of putting Spark-Cassandra just to avoid Python to do multiprocessing. This email is c

RE: Multiple files reading

2016-06-14 Thread Joaquin Alzola
> What I meant was that you would have a dict of dicts, where the key was the > country: Thanks MRAB I could not see that solution. That save me a lot of lines of code. Certainly my previous solution also manage to do that but yours is more clean-code wise. This email is confidential and may be

RE: log file.

2016-06-14 Thread Joaquin Alzola
>thanks I will look at them. As an example for your guide: ##log_handler### import sys import logging import logging.handlers from configfile_read import * def LogHandler(logger): CONFIG_FILE = ('./conf/' + 'config.ini') config = configfile(CONFIG_FILE) FORMAT = '%(ascti

RE: Multiple files reading

2016-06-14 Thread Joaquin Alzola
>> The dictionary that I am using in the classes: >> {'Country':'Empty','Service':'Empty','TimeStamp':'Empty','Ocg':'see3', >> 'DiameterCodes':{'2001':0,'4010':0,'4012':0,'4998':0,'4999':0,'5007':0 >> ,'5012':0}} >> >> Wanted help from your side on how to focus this just because I want to read >>

RE: log file.

2016-06-14 Thread Joaquin Alzola
>logging please. Check this modules: import logging import logging.handlers This email is confidential and may be subject to privilege. If you are not the intended recipient, please do not copy or disclose its content but contact the sender immediately upon receipt. -- https://mail.python.org/m

Multiple files reading

2016-06-14 Thread Joaquin Alzola
Hi Guys I am doing program that reads into a directory for the files that were created the last 5 mins. (working) Inside those files there are 242 fields in each line separated by | (pipe). Each file has about 5k records and there are about 5 files per 5 mins. I will look for field 29 and 200

RE: Design an encrypted time-limited API on Client/Server side

2016-06-09 Thread Joaquin Alzola
> I am planning design an encrypted time-limited API on both Client and Server > sides, If you want client/server communitation in an encypted way you can use the ssl module. This email is confidential and may be subject to privilege. If you are not the intended recipient, please do not copy or

RE: Matplotlib X-axis dates

2016-06-02 Thread Joaquin Alzola
>plt.plot(np.array(code_2001),label="2001") Simple solution: ax.plot(date_nump,np.array(code_2001),label="2001") Didn't see it until I took a rest. This email is confidential and may be subject to privilege. If you are not the intended recipient, please do not copy or disclose its content but co

Matplotlib X-axis dates

2016-06-02 Thread Joaquin Alzola
Hi Guys Have been all day looking for a solution on the x-axis and the time plot. The output that I get is this with all the dates shift to the right overlapping each other. http://postimg.org/image/fs4tx83or/ I want the x-axis to start at 0 and to finish after the 3 entries on the DB. X Axis

RE: starting docker container messes up terminal settings

2016-05-02 Thread Joaquin Alzola
>I am starting a docker container from a subprocess.Popen and it works, but >when the script returns, the terminal settings of my shell are messed up. >Nothing is echoed and return doesn't cause a >newline. I can fix this with >'tset' in the terminal, but I don't want to require that. Has anyone

RE: Basic Concepts

2016-04-27 Thread Joaquin Alzola
>>> x = 4 >>> x + 5 9 -Original Message- From: Python-list [mailto:python-list-bounces+joaquin.alzola=lebara@python.org] On Behalf Of Smith Sent: 27 April 2016 10:29 To: python-list@python.org Subject: Basic Concepts Fill in the blanks to declare a variable, add 5 to it and print it

RE: Howw to prevent the duplication of any value in a column within a CSV file (python)

2016-04-26 Thread Joaquin Alzola
import csv Use dictionary {key:value} -Original Message- From: Python-list [mailto:python-list-bounces+joaquin.alzola=lebara@python.org] On Behalf Of peakgraph...@gmail.com Sent: 26 April 2016 17:01 To: python-list@python.org Subject: Howw to prevent the duplication of any value in

RE: Howw to prevent the duplication of any value in a column within a CSV file (python)

2016-04-26 Thread Joaquin Alzola
Just an example. Didn't use the csv but just hope that it helps. name=[] name_exist="Dop" with open("dop.csv") as f: for line in f: line_split=line.split(',') name.append(line_strip[0]) if name_exist in name: print "found name " + na

RE: Python path and append

2016-04-25 Thread Joaquin Alzola
Strip() = white spaces. Description The method strip() returns a copy of the string in which all chars have been stripped from the beginning and the end of the string (default whitespace characters). Use to remove return carriage--> line[:-1] -Original Message- From: Python-list [mailt

RE: delete from pattern to pattern if it contains match

2016-04-25 Thread Joaquin Alzola
I put some code I did before for the xmlns: xml_root = ET.ElementTree(ET.fromstring(xml_decoded)).getroot() for elem in xml_root.getiterator(): if('{http://request.messagepush.interfaces.comv

RE: Xlms namespace

2016-04-20 Thread Joaquin Alzola
>> The problem: >> test\ntest\ntest<{[£ EURO&%]}> >If I had to make a guess, you need to escape the <, >, and &characters or else >they'll get parsed by the XML parser. Try sending >"test\ntest\ntest<{[£ EURO&%>]}>" Yes it is the xml itself. Putting the & and also the < I can make it work wit

Xlms namespace

2016-04-20 Thread Joaquin Alzola
Hi Guys I am currently doing this: IP client(Python) --> send SOAPXML request --> IP Server (Python) SOAP request: http://schemas.xmlsoap.org/soap/envelope/"; xmlns:req="http:/ /request.messagepush.interfaces.comviva.com" xmlns:xsd="http://request.messagepush.interfaces .comviva.com/xsd"> test

RE: delete from pattern to pattern if it contains match

2016-04-18 Thread Joaquin Alzola
Hi, Try to use the xml module. import xml.etree.ElementTree as ET That might help. BR Joaquin -Original Message- From: Python-list [mailto:python-list-bounces+joaquin.alzola=lebara@python.org] On Behalf Of harirammano...@gmail.com Sent: 18 April 2016 08:08 To: python-list@python

RE: How to print a part of a string?

2016-04-16 Thread Joaquin Alzola
list_append = [] with open('filename') as f: for line in f: t_line = line.split(' ') if (t_line[0] == 'ABC'): print(t_line[1]) list_append.append(t_line[1]) -Original Message- From: Python-list [mailto:python-list-bounces+joaquin.alzola=lebara@python.org] On Behalf Of durgadevi1 Se

RE: COnvert to unicode

2016-04-08 Thread Joaquin Alzola
Joaquin Alzola wrote: > Hi People > > I need to covert this string: > > hello there > this is a test > > (also \n important) > > To this Unicode: > 00680065006c006c006f0020002000740068006500720065000a00740068006900730020006900730020006100200074006500730074000a >

COnvert to unicode

2016-04-07 Thread Joaquin Alzola
Hi People I need to covert this string: hello there this is a test (also \n important) To this Unicode: 00680065006c006c006f0020002000740068006500720065000a00740068006900730020006900730020006100200074006500730074000a Without the \u and space. https://www.branah.com/unicode-converter I seem n

RE: Promoting Python

2016-04-05 Thread Joaquin Alzola
>"Gordon( Hotmail )" writes: >> I am struggling to understand the basic principles of Python >Welcome! Congratulations for embarking on Python as a language to learn. >Since as you say you are trying to learn the very basics, please participate >in our collaborative tutoring forum >https://m

RE: pdf version of python tutorial

2016-03-19 Thread Joaquin Alzola
Den 13-03-2016 kl. 14:45 skrev kamaraju kusumanchi: > Is there a pdf version of the python tutorial > https://docs.python.org/3/tutorial/index.html that I can download? The > idea is to have everything in one file so I can search easily, be able > to work offline. > > thanks > raju > >Try here: ht

RE: empty clause of for loops

2016-03-16 Thread Joaquin Alzola
You could do something like ... If len(my_iterable) is not 0: for x in my_iterable: # do else: # do something else There should be a more code efficient way to do this. -Original Message- From: Python-list [mailto:python-list-bounces+joaquin.alzola=lebara@python.org] On Be

RE: Remote Rsponse Socket Connection

2016-03-11 Thread Joaquin Alzola
> I received this from a socket connection. This is the received data: > > Adding more info --> the response is a mixture of hex numbers + ascii > > [...] > > How is the best way to decode such reply from server? >https://docs.python.org/3/library/struct.html#examples Thank Marko will take alook i

RE: Remote Rsponse Socket Connection

2016-03-11 Thread Joaquin Alzola
HI Guys I received this from a socket connection. This is the received data: Adding more info --> the response is a mixture of hex numbers + ascii >From python function --> data = s.recv(2048) b'\x01\x00\x00D\x00\x00\x01\x18\x00\x00\x00\x00p2E\xe1+\xe8xG\x00\x00\x01\x08@\x00\x00\x0bmmm\x00\x00\

Remote Rsponse Socket Connection

2016-03-11 Thread Joaquin Alzola
HI Guys I received this from a socket connection. This is the received data: >From python function --> data = s.recv(2048) b'\x01\x00\x00D\x00\x00\x01\x18\x00\x00\x00\x00p2E\xe1+\xe8xG\x00\x00\x01\x08@\x00\x00\x0bmmm\x00\x00\x00\x01(@\x00\x00\x16mmm.xx.com\x00\x00\x00\x00\x01\x0c@\x00\x00\x0

RE: Review Request of Python Code

2016-03-10 Thread Joaquin Alzola
SQL doesn't allow decimal numbers for LIMIT. Use decimal numbers it still work but is the proper way. Then clean up a bit your code and remove the commented lines # -Original Message- From: Python-list [mailto:python-list-bounces+joaquin.alzola=lebara@python.org] On Behalf Of subhab

RE: Read and count

2016-03-10 Thread Joaquin Alzola
Try to do a .split(' ') and then add field 0 and 1 to an list. For open the file you can do it easier: with open(file) as f: for line in f: print('line') -Original Message- From: Python-list [mailto:python-list-bounces+joaquin.alzola=lebara@python.org] On Behalf Of Val Krem via Pyt

RE: Adding Icon To Tkinter Window - Followup

2016-03-09 Thread Joaquin Alzola
> root.wm_iconphoto(True, img) What are the images format allowed? This email is confidential and may be subject to privilege. If you are not the intended recipient, please do not copy or disclose its content but contact the sender immediately upon receipt. -- https://mail.python.org/mailm