Interesting but encountering similar problems to *backseat *on windows 7 
using the following command from a prompt in web2py root folder: i.e.

c:\web2py> set path=%path%;c:\web2py\gluon
c:\web2py> c:\python27\python scripts\cpdb.py -d gluon -f 
application\app\databases 
-y 'sqlite://storage.sqlite' -Y 
'postgres://postgres:password@localhost:5432/db_target'

It ends up with the attached errors, implying more path issues:

<https://lh5.googleusercontent.com/-kslYmw5agt4/UOpg5uzEtNI/AAAAAAAAAGs/suKvc8G0x8Q/s1600/copy+database1.png>
Can anyone suggest windows commands/ path's that may work? 

(Noted the Aptana environment solution, but have a time frame issue. 
Otherwise may have to go back to backseat's solution of individual exports/ 
imports)




On Saturday, May 26, 2012 11:32:20 PM UTC+10, mart wrote:
>
> the first message is expected because of this import:
>
> try:
>
>     from gluon import DAL
>
> except ImportError as err:
>
>     print('gluon path not found')  
> It wants to assume that that gluon is already loaded as part of the web2py 
> environment (or as part of some other environment, like Aptana for example) 
> and that you already have /gluon in your path (maybe even hard coded). If 
> the gluon path is not set, well, you will get that "gluon path not found" 
> message and the -d option will be expected. Because the -d option is 
> expecting a *relative* path, your cmd line args will look different 
> depending on the environment in which you are running the script. 
>
> Hum... I guess being relative is relative ;) 
>
> So, as an example, if you were to run this cmd from a simple bash shell 
> (outside of any dev environment, or outside of a web2py context), you would 
> simply cd and drill down into .../blabla/.../web2py/scripts/. In which 
> case, your -d option would look like this:
> -d ../gluon.  
>
> I just did this, and it all worked fine:
>
>
> macMart:Documents mart$ cd Aptana\ Studio\ 
> Workspace/_p4/src/web2py/scripts/
>
> macMart:scripts mart$ python cpdb.py -f ../../db_storage -d ../gluon -y 
> sqlite://storage.sqlite -Y sqlite://storage2.sqlite -F ../../db_storage2
>
> gluon path not found    <== THIS IS AN EXPECTED MESSAGE
>
> creating tables...
>
> exporting data...
>
> importing data...
>
> done!
>
>
> Hope it helps and that it makes sense!
>
> Mart :)
>
> On Thursday, May 17, 2012 2:00:08 AM UTC-7, backseat wrote:
>>
>> I'm trying to copy a database from Sqlite to MySQL using the cpdb.py 
>> script. In the manual, it states: 
>>
>> cd web2py 
>> python scripts/cpdb.py \ 
>>    -f applications/app/databases \ 
>>    -y 'sqlite://storage.sqlite' \ 
>>    -Y 'postgresql://username:password@hocalhost/mydb' 
>>
>> However, if I do that I get "gluon path not found". The help file 
>> suggests 
>> that I can specify the path to dal.py with -d, but: 
>>
>> python scripts/cpdb.py -d gluon/dal.py -f applications/pytrack2/databases 
>> -y 'sqlite://storage.sqlite' -Y 
>> 'mysql://pytrack2:pytrack2@localhost/pytrack2' 
>> gluon path not found 
>> EXCEPTION: could not set DAL 
>> No module named dal 
>>
>> If I use '-d gluon', it's better but now fails with a MySQL error (which 
>> I 
>> think relates to foreign keys), although it still gives the 'gluon path 
>> not found' error: 
>>
>> $ python scripts/cpdb.py -d gluon -f applications/pytrack2/databases -y 
>> 'sqlite://storage.sqlite' -Y 
>> 'mysql://pytrack2:pytrack2@localhost/pytrack2' 
>> gluon path not found 
>> creating tables... 
>> EXCEPTION: could not make a copy of the database 
>> (1005, u"Can't create table 'pytrack2.t_companies_archive' (errno: 150)") 
>>
>> I'm going to continue by migrating by hand; if I should report this 
>> elsewhere or if you need more details, let me know. 
>> -- 
>> "You can have everything in life you want if you help enough other people 
>> get what they want" - Zig Ziglar. 
>>
>> Who did you help today? 
>>
>

-- 



Reply via email to