• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Jython script issue for List/Arrays

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,



I have a jython custom script to convert data from table to a text file. It is working for one table. But I tried using arrays/list so that I can have multiple files generated from multiple tables. This script, through creating multiple files, is retrieving data only for the last file. All the other files remain as 0 kb files with no data. Here I see data only for CN, file for AC & CH are 0 KB files. if I have list with one member 'AC', then I see data for AC. Can anyone let me know what I am missing here in logic.


 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to CodeRanch.
Since white space is important in Python, it is vital you use Code Tags to preserve your code's formatting. I have added them to your post.
When writing a file, data may not be committed to disk as it is written due to caching at various levels (application, OS, hardware, etc.). The python method close() will flush a buffer and make sure all the data is written. Are you closing all your files?
 
Bartender
Posts: 2407
36
Scala Python Oracle Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, if your code here is the same as what you have been executing, then I think it could be that your while() loop is not indented correctly.

Right now you read all the items, then you execute the query for each item. The last item is "CN", so that is the last query you execute.

Then you are taking the results of the last query (for "CN") and processing these. You never process the results for the other queries.

Try indenting the while() block so it runs for each item in your for loop.
reply
    Bookmark Topic Watch Topic
  • New Topic