Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-09-01 Thread andydtaylor
Mark - it's more that I just didn't understand what you mean. Here's you: Probably an out and out programmer; uses a number of languages; a decade of experience, educated in best practice via your experience. Here's me: Idiot. A decade of experience in VBA and Excel in mindless finance jobs, h

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-09-01 Thread andydtaylor
Posting style point taken. Google groups doesn't exactly help you with that. * You guys have probably been tinkering with this stuff for years. I haven't. * Your man on the street would say I described the error fairly well. * It's not like I wasn't trying my best to fix it myself * So far as e

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-08-31 Thread andydtaylor
I have gone ahead and set it all up by using pip install psycopg2 but I would still like to determine why Pycharm couldn't find the $PATH variable -- https://mail.python.org/mailman/listinfo/python-list

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-08-31 Thread andydtaylor
FYI My mac version is Mavericks 10.9.4 -- https://mail.python.org/mailman/listinfo/python-list

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-08-31 Thread andydtaylor
Chris- I have removed the second copy of postgres I had (postgres.app) and updated path variables in .bash_profile: export PATH=$PATH:/usr/local/share/python export PATH=$PATH:/usr/local/bin export PYTHONPATH=$PYTHONPATH:/usr/local/bin/python export PATH=$PATH:/usr/local/Cellar/postgresql/9

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-08-31 Thread andydtaylor
Chris- I have removed the second copy of postgres I had (postgres.app) and updated path variables in .bash_profile: export PATH=$PATH:/usr/local/share/python export PATH=$PATH:/usr/local/bin export PYTHONPATH=$PYTHONPATH:/usr/local/bin/python export PATH=$PATH:/usr/local/Cellar/postgresql/9.3.5_

Re: Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-08-31 Thread andydtaylor
Actually I realise that postgres app didn't come from brew I wonder if that's the issue On Sunday, 31 August 2014 15:19:24 UTC+1, andyd...@gmail.com wrote: > Hi, > > > > I have a puzzle, for which I would appreciate your opinion on! > > > > I have been trying to setup a project in Pych

Psycopg2 package installation puzzle in Pycharm - any thoughts?

2014-08-31 Thread andydtaylor
Hi, I have a puzzle, for which I would appreciate your opinion on! I have been trying to setup a project in Pycharm with psycopg2. If I install it using pip install it is added. However if I use the Pycharm "preferences>project interpreter>add package" option it fails with the below message.

Re: Best way to convert number of minutes to hh:mm AM/PM?

2013-03-02 Thread andydtaylor
Brilliant, thanks to all -- http://mail.python.org/mailman/listinfo/python-list

Best way to convert number of minutes to hh:mm AM/PM?

2013-03-01 Thread andydtaylor
Hi, I need to create a list of equally spaced times (as in hh:mm AM/PM) within a day to loop through. Having selected 30 minute intervals I figured I could: * Create a list from 1 to 48 * Multiply each value by 30 * Convert minutes to a time. datetime.timedelta seems to do this, but it's not a

Re: Escaping list of numbers for Postgres column names

2013-02-23 Thread andydtaylor
In reply to my own question, postgres column names must begin with a letter or an underscore. So this is what I have done: >>> for row in cursor_from: ... if row[8]: ... stn_list_short.append("_" + row[0]) I can now use stn_list_short to create my columns -- http://mail.python.org/m

Escaping list of numbers for Postgres column names

2013-02-23 Thread andydtaylor
Hi I have some convenient short place name IDs which would be handy for column names. Unfortunately, many begin with a number. I can work around this by appending a letter to each one, but should I escape the number in such a way that I can use it directly as my column name, in the same way a

Re: psycopg2 craziness

2013-02-21 Thread andydtaylor
I'd actually forgotten about commit, thanks! I'll have another go with this in mind. -- http://mail.python.org/mailman/listinfo/python-list

psycopg2 craziness

2013-02-21 Thread andydtaylor
Hi, I'm trying to use psycopg2 but having some issues. Would it be possible to get some pointers? I seem unable to execute any SQL statements. So here are my database tables before (and after) I try to do anything: postgres=# \c You are now connected to database "postgres" as user "postgres"

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread andydtaylor
Thanks for your help guys. I was actually doing a few things wrong, but I have got this script to work by declaring fields as varchar and all values as strings. But I would like to log journey time values in hours/minutes, so I will have to look into the following: 1. Retrieving this data from

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread andydtaylor
Hi John, He're the code I would like to see work. The cursor_to is an oversight. I extracted this element from some other code in an attempt to isolate/resolve the problem myself, hence having a simplified table version. Which works actually, but unfortunately that's not educating me suffiecien

Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread andydtaylor
Hi, I'm a bit stuck on this "INSERT INTO" syntax error. I have no idea why it's not working actually... I've tried changing column types to char but that didn't work. I've gone a bit blind looking at it, but hopefully you can set me right. With the '#'d out lines instead the file does work. Wh

Re: Best way to do this? List loop (matrix?) iteration

2013-01-09 Thread andydtaylor
Thanks for your help - this is what I did - though it's probably obvious to most people reading this. for rowcount in range (0, stn_count): row_durations.append(stn_list_short[rowcount]) for colcount in range (0, stn_count): # 3. Determine Station pairs for API query

Best way to do this? List loop (matrix?) iteration

2013-01-08 Thread andydtaylor
Hi! I might be missing the obvious, or I may have found something more complicated than the VBA I am used to. Could it be I need to use a maths library? For a given list of k items I'd like to turn it into an k*k matrix of item pairs. List_sample = ['a', 'b', 'c'] Output: aa ab ac ba bb bc c

Re: Difference between these two lists?

2013-01-07 Thread andydtaylor
Thanks, I think I'm clear now. I guess (map(str, stn_list)) was all about how to make a string starting with integers. I picked that up and began using it without realising it was over catering for a list already containing strings, and join(stn_list) was really all I required. Repr and Eval

Re: Difference between these two lists?

2013-01-07 Thread andydtaylor
I think I can answer my own question on reflection the first one is actually a string I think? I was confused by the square brackets around the placeholder %s. -- http://mail.python.org/mailman/listinfo/python-list

Difference between these two lists?

2013-01-07 Thread andydtaylor
Hi, Python newbie here again - this is probably a quick one. What's the difference between the lines I've numbered 1. and 2. below, which produce the following results: Results: 1. [ANG, BAR, BPK, CTN, QGH, QHD, KXX] 2. ['ANG', 'BAR', 'BPK', 'CTN', 'QGH', 'QHD', 'KXX'] Code: cursor_from.ex

Re: psycopg2 cursor.execute CREATE TABLE issue

2013-01-06 Thread andydtaylor
Wow it's as simple as that! I'm afraid my database experience is in Microsoft Access in Windows and not at the command line, so that wasn't intuitive for me. Thanks again, Andy -- http://mail.python.org/mailman/listinfo/python-list

psycopg2 cursor.execute CREATE TABLE issue

2013-01-06 Thread andydtaylor
Hi all, I'm trying to create a process which will create a new table and populate it. But something is preventing this from working, and I don't know enough to figure it out, despite having spent most of today reading up. The code executes with no error, yet no table is created or populated.

Re: Evaluate postgres boolean field

2013-01-05 Thread andydtaylor
Brilliant, thanks guys -- http://mail.python.org/mailman/listinfo/python-list

Evaluate postgres boolean field

2013-01-04 Thread andydtaylor
Hi, I'm hoping for some help on a python script I need to query an api. I'm not a (Python) programmer ordinarily, but do plan to improve! Specifically I have a for loop evaluating a database row, which I think I can treat as a list. My [4] is a postgres boolean field, and I'm temporarily stuck