Re: Python 3.4.1 and blitzdb issue

2014-10-22 Thread Juan Christian
new millennium.","birthday":"1944-05-14","deathday":"","homepage":"","id":1,"imdb_id":"nm184","name":"George Lucas","place_of_birth":"Modesto - California - USA&qu

Python 3.4.1 and blitzdb issue

2014-10-22 Thread Juan Christian
Testing code: CODE - #!/usr/bin/env import requests from blitzdb import Document, FileBackend API_URL = 'http://api.themoviedb.org/3' API_KEY = 'ddf30289' class Actor(Document): pass def get_actor(_id): r = requests.get('{}/person/{}?api_key={}'.format(A

Python 3.4.2 + PyQt4 + PyCharm 3.4.1

2014-10-28 Thread Juan Christian
Python 3.4.2 Windows x64 PyQt4 4.11.2 Py3.4 Qt4.8.6 (x64) PyCharm 3.4.1 Pro Edition So, PyCharm works 100% with everything here but PyQt. I have this folder structure: Disk C: > PyQt4 >> Lib/site-packages/PyQt4/(tons of files here) > Python34 (normal/default installation) --- I tried copying

Re: Python 3.4.2 + PyQt4 + PyCharm 3.4.1

2014-10-29 Thread Juan Christian
It only occurs whule using PyCharm I tried it via pure terminal and everything works... =/ On Tue, Oct 28, 2014 at 7:45 PM, Juan Christian wrote: > Python 3.4.2 Windows x64 > PyQt4 4.11.2 Py3.4 Qt4.8.6 (x64) > PyCharm 3.4.1 Pro Edition > > > So, PyCharm works 100% with everyt

Re: Python 3.4.2 + PyQt4 + PyCharm 3.4.1

2014-11-01 Thread Juan Christian
No one here uses PyCharm and Qt? =/ On Wed, Oct 29, 2014 at 8:45 PM, Juan Christian wrote: > It only occurs whule using PyCharm I tried it via pure terminal and > everything works... =/ > > On Tue, Oct 28, 2014 at 7:45 PM, Juan Christian > wrote: > >> Python 3.4.2 Win

Re: Python 3.4.2 + PyQt4 + PyCharm 3.4.1

2014-11-06 Thread Juan Christian
ov 6, 2014 at 12:50 farshad akbari wrote: > On Saturday, November 1, 2014 3:11:54 PM UTC+3:30, Juan Christian wrote: > > No one here uses PyCharm and Qt? =/ > > > > > > On Wed, Oct 29, 2014 at 8:45 PM, Juan Christian > wrote: > > > > It only occurs whule u

PySide 1.2.2 setMaxWidth and AeroSnap

2014-11-16 Thread Juan Christian
PySide 1.2.2 Python 3.4.2 Code: from PySide.QtGui import * class MainWindow(QWidget): def __init__(self): QWidget.__init__(self) self.setMinimumSize(600, 700) self.setMaximumWidth(600) self.setLayout(QVBoxLayout()) * Call to this module in another module * app = QApplication(sys.argv) window =

Re: PySide 1.2.2 setMaxWidth and AeroSnap

2014-11-16 Thread Juan Christian
On Sun Nov 16 2014 at 3:46:40 PM Vincent Vande Vyvre < vincent.vande.vy...@telenet.be> wrote: > > No probleme with PyQt but I think this is a window manager question. > Window, gnome, KDE, Mate, ... > > > If your widget is a QMainWindow or a QDialog add a size grip: > > self.setSizeGripEna

How to access Qt components loaded from file?

2014-11-18 Thread Juan Christian
I have this simple code that load any Qt Designer .UI file: from PySide.QtCore import QFile from PySide.QtGui import QApplication from PySide.QtUiTools import QUiLoader def loadui(file_name): loader = QUiLoader() uifile = QFile(file_name) uifile.open(QFile.ReadOnly) ui = loader.load(uifile) uifi

Re: How to access Qt components loaded from file?

2014-11-18 Thread Juan Christian
Many thanks, worked. The only problem now is that I don't have auto-complete for anything, because of this approach... I'll have to check the doc more regularly. ^^ On Tue Nov 18 2014 at 10:48:44 AM Vincent Vande Vyvre < vincent.vande.vy...@telenet.be> wrote: > Le 18/

Re: How to access Qt components loaded from file?

2014-11-18 Thread Juan Christian
syntax is correct, I don't know why it failed, the btn is in the Form too, it's a QPushButton. The test func is just a simple func that returns a random text. On Tue Nov 18 2014 at 11:08:48 AM Juan Christian wrote: > Many thanks, worked. The only problem now is that I don't have

Re: How to access Qt components loaded from file?

2014-11-18 Thread Juan Christian
> > You can't have a slot like this: > > MainWindow.btn.clicked.connect(MainWindow.txtbox.setText(test())) > > because that's mean: "connect to the return of > MainWindow.txtbox.setText(test())" and it's not possible at this stage > of your program. > > Use instead a function: > > MainWindow.btn.cl

Re: How to access Qt components loaded from file?

2014-11-19 Thread Juan Christian
app.exec_() loop, so I need to have a trigger configured that will be called in a defined interval, then inside this trigger I configure the "set_avatar", "set_text", "set_btn_link", etc, is that right? On Tue Nov 18 2014 at 9:37:21 PM Chris Angelico wrote: >

Re: How to access Qt components loaded from file?

2014-11-19 Thread Juan Christian
onents just for testing.This shouldn't be normal, right? Am I doing something wrong? On Wed Nov 19 2014 at 7:00:43 PM Rob Gaddi wrote: > On Wed, 19 Nov 2014 20:47:31 + > Juan Christian wrote: > > > Let's say that I want to call the site in a 5min interval. I'm cur

Re: How to access Qt components loaded from file?

2014-11-20 Thread Juan Christian
Thu Nov 20 2014 at 1:43:21 PM Michael Torrie wrote: > On 11/19/2014 07:53 PM, Juan Christian wrote: > > Thanks, it's working using QTimer. The thing is that whenever the program > > is going to do something, in my case, draw a new QGroupBox with some > > components inside a

Re: How to access Qt components loaded from file?

2014-11-20 Thread Juan Christian
10:57 AM, Juan Christian wrote: > > So, I need to study QThreads, do you know any book or video-course that > > talks about this matter? I've seen the tutorials that you pointed but I > > need a "wider" approach regarding QThreads to really understand it and > > a

Re: How to access Qt components loaded from file?

2014-11-20 Thread Juan Christian
Another problem is that this doc doesn't use Python. On Thu Nov 20 2014 at 5:36:37 PM Juan Christian wrote: > Yes, I read everything and saw that stackoverlfow on Google too. I'm > reading this doc: http://pyqt.sourceforge.net/Docs/PyQt4/classes.html > > I just asked for a

Re: How to access Qt components loaded from file?

2014-11-20 Thread Juan Christian
**Back to the list So, as I said the PyQt doc is using C o.0 Yes, I read the tutorials, I'll google for some books and things related. On Tue Nov 18 2014 at 10:48:44 AM Vincent Vande Vyvre < vincent.vande.vy...@telenet.be> wrote: > Le 18/11/2014 13:18, Juan Christian a écrit : &

Re: How to access Qt components loaded from file?

2014-11-20 Thread Juan Christian
On Thu Nov 20 2014 at 7:07:10 PM Mark Lawrence wrote: > > You also need to study the difference between top posting, interspersed > posting and bottom posting. The second and third are very much the > prefered styles here. > Yes I know, but I'm using the new Google Inbox, and I limited to what I

Re: How to access Qt components loaded from file?

2014-11-20 Thread Juan Christian
On Thu Nov 20 2014 at 8:20:29 PM alister wrote: > > Then either do the necessary work (you have just proven you can)or find a > better way of communicating with this news group(NNTP or the mailing > list), otherwise you may find a number of good people simply ignore your > posts. > > While you are

Re: How to access Qt components loaded from file?

2014-11-21 Thread Juan Christian
On Fri Nov 21 2014 at 8:05:30 AM alister wrote: > All of this VVV > [...] I'm sorry, I didn't know, but it seems there isn't any option to remove that in the Inbox (new Gmail), do you guys use any special program or client to use list? -- https://mail.python.org/mailman/listinfo/python-lis

Python Signal/Slot + QThred code analysis

2014-11-23 Thread Juan Christian
This is a continuation of my other topic "How to access Qt components loaded from file", it was getting big and the focus changed completely, the real question there was already answered, and we were talking about signal/slot, QThred and other things. So, I read on the web (didn't find books talki

Re: Python Signal/Slot + QThred code analysis

2014-11-24 Thread Juan Christian
Oh, and this code I made by myself, I didn't copy. That's why I want you guys to see if everything is ok. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Signal/Slot + QThred code analysis

2014-11-25 Thread Juan Christian
On Mon Nov 24 2014 at 11:56:31 PM Michael Torrie wrote: Looks alright. Does it work? Well, no =/ First I had to remove the multiple inheritance, because Qt doesn't allow that, so I removed the QObject. Second, just for testing I'm calling the module directly using: timer = QTimer() timer.start

Fwd: Python Signal/Slot + QThred code analysis

2014-11-25 Thread Juan Christian
On Tue Nov 25 2014 at 1:42:24 PM MRAB wrote: I think that the problem there is that strings don't have an __exit__ method. I don't understand what you said, what you mean by that? =/ -- https://mail.python.org/mailman/listinfo/python-list

Re: Fwd: Python Signal/Slot + QThred code analysis

2014-11-25 Thread Juan Christian
So guys, I had to change to approach, I read that using Qt I can't do multiple inheritance. So my Outpost class can't be like 'Outpost(QObject, QThred)'. I had to change the code a bit: from PySide.QtCore import QObject, QThread, Signal import requests import bs4 class Worker(QThread): def __ini

Re: Fwd: Python Signal/Slot + QThred code analysis

2014-11-26 Thread Juan Christian
On Wed Nov 26 2014 at 1:16:11 AM Michael Torrie wrote: You're going to have to post a complete, but small, code example, I think. Working with fragments of code is very difficult if not impossible to assist with, resulting in obtuse, obvious replies from folks. As asked, here is all the code: ou

Re: Fwd: Python Signal/Slot + QThred code analysis

2014-11-27 Thread Juan Christian
On Thu Nov 27 2014 at 2:12:40 AM Michael Torrie wrote: Hmm, I hit a wall. There's no main.ui file. Can you rework your code so that you have a single file (plus a separate ui file that's okay), that simulates the url request, that I can execute easily. As you asked, here it's, everything on one m

Re: Fwd: Python Signal/Slot + QThred code analysis

2014-11-27 Thread Juan Christian
On Thu Nov 27 2014 at 8:53:16 PM Michael Torrie wrote: Hope this helps. Here's complete working code, minus the .ui file: http://pastebin.com/VhmSFX2t Thanks, I'll just repost the code on pastebin with a NEVER expire time and UNLISTED, so that it can be of some help for others here in the mailist

Re: Fwd: Python Signal/Slot + QThred code analysis

2014-11-27 Thread Juan Christian
On Thu Nov 27 2014 at 9:16:38 PM Juan Christian wrote: I'll read the code thoroughly and reply to you if I find something strange, many thanks! So, instantly I found one issue, you said that this code won't block the GUI, only the thread event loop, but if we keep moving the window

Re: Fwd: Python Signal/Slot + QThred code analysis

2014-11-28 Thread Juan Christian
On Fri Nov 28 2014 at 2:07:32 AM Michael Torrie wrote: Okay, here's a reworking of the code that invokes a new QThread instance each time. Note the QThread instance has to be bound to the MainWindow so that it won't be destroyed when it goes out of scope. Also the Worker thread sends a signal with

Is there a way to schedule my script?

2014-12-17 Thread Juan Christian
I know about the schedule modules and such but they work in situations like 'run this in a X hours/minutes/seconds interval', I already have my code in a while loop with sleep (it's a bit ugly, I'l change to a scheduler soon). What I really want is, for example: 24/7/365 9:00 AM -> Start 11:59 PM

Re: Is there a way to schedule my script?

2014-12-17 Thread Juan Christian
On Wed Dec 17 2014 at 5:45:31 PM John Gordon wrote: You could write a separate program whose only job is to send a STOP or CONTINUE signal to your main program, and then run that program from a scheduler. The standard system "kill" command would probably work for this purpose, assuming you have a

Re: Is there a way to schedule my script?

2014-12-17 Thread Juan Christian
Ops, sorry. It's: 9:00 AM ~ 11:59 PM -> Running ... and not 9:00 AM ~ 11:50 PM -> Running -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a way to schedule my script?

2014-12-17 Thread Juan Christian
On Wed Dec 17 2014 at 6:25:39 PM John Gordon wrote: If you want to solve your problem entirely within Python, look at the "scheduler" module. (Although even this isn't a complete solution, as you still have to make sure the program is running in the first place...) My script is running fine, Win

Re: Is there a way to schedule my script?

2014-12-17 Thread Juan Christian
On Wed Dec 17 2014 at 7:35:10 PM Chris Angelico wrote: time.time() % 86400 That's number of seconds since midnight UTC, ranging from 0 up to 86399. (I've no idea what 64562 would mean. That's an awfully big number for a single day.) If you offset that before calculating, you can get that in

Re: Is there a way to schedule my script?

2014-12-17 Thread Juan Christian
On Wed Dec 17 2014 at 9:40:52 PM Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > Juan Christian wrote: > > > I know about the schedule modules and such but they work in situations > > like 'run this in a X hours/minutes/seconds interval'

Re: Is there a way to schedule my script?

2014-12-18 Thread Juan Christian
On Wed Dec 17 2014 at 11:04:16 PM Juan Christian wrote: Thanks. That was a great answer. I'll redo my code. It's running and will only run in my Docker container (Ubuntu Server 14.04.1) so I'll use cron. Indeed, currently I'm using something like that: while True: if 9 &

Re: Is there a way to schedule my script?

2014-12-18 Thread Juan Christian
Thanks, using cron here. -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a way to schedule my script?

2014-12-18 Thread Juan Christian
On Thu Dec 18 2014 at 2:24:46 PM Ian Kelly wrote: What kind of random distribution of the time between executions are you looking for? A random sleep lends itself easily to a uniform distribution. The latter approach that you describe would result in a geometric distribution. I'm looking for a ra

Re: Is there a way to schedule my script?

2014-12-18 Thread Juan Christian
On Thu Dec 18 2014 at 11:35:11 PM Chris Angelico wrote: Why does this matter to you? Why am I getting the feeling that I should not be helping you? Because that's what my project is all about, I need to fake some 'human actions' inside the network to do some benchmarks and test internal stuffs. T

smtplib not working as expected

2014-12-26 Thread Juan Christian
I have the following test code: import smtplib fromaddr = 'mksfjnsfji4433j4...@bk.ru' toaddrs = ['mksfjnsfji4433j4...@bk.ru'] msg = ("From: %s\r\nTo: %s\r\n\r\n" % (fromaddr, ", ".join(toaddrs))) msg = msg + 'test' print("Message length is " + repr(len(msg))) server = smtplib.SMTP('sm

Re: smtplib not working as expected

2014-12-26 Thread Juan Christian
On Fri Dec 26 2014 at 11:07:30 PM MRAB wrote: According to the docs, if you let the port parameter default to 0, it'll use port 465. I tested with my ISP. Using port 465, it failed. Using the default, it succeeded. So, I changed the code how you said, but still not working. Code: import smt

Re: smtplib not working as expected

2014-12-27 Thread Juan Christian
On Sat Dec 27 2014 at 1:23:12 AM Vincent Vande Vyvre < vincent.vande.vy...@telenet.be> wrote: Try with the TLS: Many thanks, working like a charm, code: server = smtplib.SMTP('smtp.mail.ru') server.starttls() server.ehlo() server.login('SENDER EMAIL GOES HERE', 'PASSWD GOES HERE') server.sendmail

Re: smtplib not working as expected

2014-12-27 Thread Juan Christian
Denis it was already resolved, check my message above. ^^ -- https://mail.python.org/mailman/listinfo/python-list

PySide 1.2.2 and Python 3.4.1 - "native Qt signal is not callable"

2014-08-30 Thread Juan Christian
Hello everyone, I have a question regarding PySide 1.2.2 and Python 3.4.1 I have this code that I made following a Python tutorial , mine is a bit different because the tutorial is a bit old, and I'm trying to use Python n

Re: PySide 1.2.2 and Python 3.4.1 - "native Qt signal is not callable"

2014-08-30 Thread Juan Christian
Yes, indeed, my code was a mess! I did a clear code here (http://pastebin.com/XsVLSVky) that's fully working, thanks! 2014-08-30 16:05 GMT-03:00 MRAB : > On 2014-08-30 14:35, Juan Christian wrote: > >> Hello everyone, I have a question regarding PySide 1.2.2 and Python 3.4.1

Error reading from 'urllib.request' and iterating over lines

2014-08-30 Thread Juan Christian
My code: http://pastebin.com/CBgVvT4n Line 25 returns the text correctly [1], but it seems not being parsed to line 27-28 correctly. This is just a training program that I'm doing following some books/tutorials/docs, nothing special. [1] Output from line 25: http://pastebin.com/HSbAtDHQ Python 3

Re: Python is going to be hard

2014-09-03 Thread Juan Christian
I'm learning Python using this mailist, and the Tutor mailist, reading the docs and watching this course, Python Fundamentals ( http://www.pluralsight.com/training/Courses/TableOfContents/python-fundamentals ). Python is really easy and useful, OP don't blame the language because you didn't unders

Re: My backwards logic

2014-09-05 Thread Juan Christian
I made this code just for fun and learning, it's working, but would this be a good approach? Thanks. import sys def prime_checker(start = 1, stop = 1): for number in range(start, stop + 1): divisors = [(number % x) for x in range(1, number + 1)] print("{n} prime? {r}".format(n = number, r = (div

Re: My backwards logic

2014-09-05 Thread Juan Christian
What's [snip] ?? On Fri, Sep 5, 2014 at 3:48 PM, MRAB wrote: > On 2014-09-05 18:35, Juan Christian wrote: > >> I made this code just for fun and learning, it's working, but would this >> be a good approach? Thanks. >> >> import sys >> >>

Re: My backwards logic

2014-09-05 Thread Juan Christian
@Mark Lawrence: Sorry to ask, but what do you mean by "don't top post here, thanks.", I'm not familiar with mailing lists, so I may be doing something wrong and I don't know. On Fri, Sep 5, 2014 at 4:54 PM, Mark Lawrence wrote: > On 05/09/2014 20:34, Juan Christ

Re: Posting style: interleaved responses (was: My backwards logic)

2014-09-05 Thread Juan Christian
On Fri, Sep 5, 2014 at 11:37 PM, Ben Finney wrote: > Juan Christian writes: > > > @Mark Lawrence: Sorry to ask, but what do you mean by "don't top post > > here, thanks.", I'm not familiar with mailing lists, so I may be doing > > something wrong and

Best approach to get data from web page continuously

2014-09-18 Thread Juan Christian
I'll write a python (Python 3.4.1) script to fetch for new data (topics) from this page (http://steamcommunity.com/app/440/tradingforum) continuously. All the topics follow this structure: http://steamcommunity.com/app/440/tradingforum/TOPIC_ID/";> It will work like that: I'll get the last topic

Class Inheritance from different module

2014-09-20 Thread Juan Christian
I have the following structure: Third-party API installed via pip: steamapi / app.py consts.py core.py users.py [...] My script: test.py In the API, the module users.py has a class 'SteamUser' and I want to mimic it's usage on my code, like this: import steamapi [...] class User(Inheritance

Flask and Python 3

2014-09-23 Thread Juan Christian
I'm following a tutorial about Flask using Python 3.4.1, but I'm getting an error with a dead simple example: generator.py: from flask import Flask, render_template app = Flask(__name__) @app.route('/') def index(): return 'Hello World' @app.route('/blog/post/') def post(): return render_tem

Re: Flask and Python 3

2014-09-23 Thread Juan Christian
On Tue, Sep 23, 2014 at 6:48 PM, John Gordon wrote: > > > @app.route('/') > > def index(): > > return 'Hello World' > > As posted, your code is not indented. Is this literally how your code > looks? > > The mail screwed the indentation, it's indented in the file. > > {% block content %}{% endlb

Re: Flask and Python 3

2014-09-23 Thread Juan Christian
On Tue, Sep 23, 2014 at 8:46 PM, Terry Reedy wrote: > > Did you use tabs? They are more likely to disappear than spaces. Yes, I use tabs. On Tue, Sep 23, 2014 at 9:33 PM, Jon Ribbens wrote: > > app.run(port=8000, debug=True) might've made the problem easier to find. > I didn't learn debug wit

Re: Flask and Python 3

2014-09-24 Thread Juan Christian
On Wednesday, September 24, 2014, Chris “Kwpolska” Warrick < kwpol...@gmail.com> wrote: > Learning from videos is the worst thing you can do. Use the official > flask documentation at http://flask.pocoo.org/docs/0.10/quickstart/ — > it’s much friendlier than a video. > > Also, there is nothing to

Re: Flask and Python 3

2014-09-25 Thread Juan Christian
On Thu, Sep 25, 2014 at 2:28 PM, Chris “Kwpolska” Warrick < kwpol...@gmail.com> wrote: > > It doesn’t matter. Here, have some wisdom, as provided by the top > Google hit for “video tutorials suck”: > https://news.ycombinator.com/item?id=4565615 > Using your link, the first comment from user 'aroc

Re: Flask and Python 3

2014-09-25 Thread Juan Christian
On Thu, Sep 25, 2014 at 3:23 PM, Chris Angelico wrote: > Actually, what most of the comments are agreeing on is that videos > need their transcripts. Without them, they suck. Most videos don't > have any sort of transcript. Ergo, most videos suck. I'm not talking about "360p 3min kid's tutorial

Re: Programming for Everybody (Python)

2014-10-02 Thread Juan Christian
I recommend to everyone. Already took one of his courses on Coursera and he's amazing as a teacher. On Thu, Oct 2, 2014 at 4:24 PM, Seymore4Head wrote: > Starts in 3 days > Coursera.org > > About the Course > This course is specifically designed to be a first programming course > using the popul

Flask and Django

2014-10-10 Thread Juan Christian
So, I'm already familiar with Flask and I fell comfortable using it, but I see that no one uses it in "real business", everywhere I look regarding jobs and web dev, people always talk about Django, no one mentions Flask, no one uses Flask. I'm coding a personal tool using Flask but I feel the need

Re: Flask and Django

2014-10-12 Thread Juan Christian
Anyone? On Fri, Oct 10, 2014 at 7:22 PM, Juan Christian wrote: > So, I'm already familiar with Flask and I fell comfortable using it, but I > see that no one uses it in "real business", everywhere I look regarding > jobs and web dev, people always talk about Django, no

Re: Is there an easy way to control indents in Python

2014-10-14 Thread Juan Christian
Using PyCharm is easy: File > Settings > (IDE Settings) Editor > Smart Keys > Reformat on paste > choose "Reformat Block" On Tue, Oct 14, 2014 at 11:13 PM, ryguy7272 wrote: > I'm just learning Python. It seems like indents are EXTREMELY important. > I guess, since there are no brackets, everyt

Re: Is there an easy way to control indents in Python

2014-10-20 Thread Juan Christian
Ok, new code using ?: import sqlite3 db = sqlite3.connect('db.sqlite') def create_db(): db.execute(''' CREATE TABLE TOPICS( ID INT PRIMARY KEY NOT NULL, URL VARCHAR NOT NULL, AUTHOR VARCHAR NOT NULL, MESSAGE VARCHAR NOT NULL ); ''') def insert_db(_id, url, auth

Re: Is there an easy way to control indents in Python

2014-10-20 Thread Juan Christian
Sorry guys, my post about SQL was not meant to be here!!! On Mon, Oct 20, 2014 at 5:43 PM, MRAB wrote: > On 2014-10-20 20:04, Juan Christian wrote: > >> Ok, new code using ?: >> >> import sqlite3 >> >> db = sqlite3.connect('db.sqlite') >> >